Class ReactionManipulator
java.lang.Object
org.openscience.cdk.tools.manipulator.ReactionManipulator
Provides a variety of methods to manipulate and convert from/to
IReaction
.- Author:
- uli-f
- See Also:
- Source code:
- main
- Belongs to CDK module:
- standard
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic void
clearAtomConfigurations
(IReaction reaction) This method will reset all atom properties related to atom configuration to the valueCDKConstants.UNSET
.findMappedBonds
(IReaction reaction) Collect the set of bonds that mapped in both a reactant and a product.static IAtomContainerSet
getAllAgents
(IReaction reaction) Returns all agents of anIReaction
.static List<IAtomContainer>
getAllAtomContainers
(IReaction reaction) Returns allIAtomContainers
of the given reaction.static List<IChemObject>
getAllChemObjects
(IReaction reaction) static IAtomContainerSet
getAllMolecules
(IReaction reaction) Returns all components of anIReaction
, that is, reactants, agents and products.static IAtomContainerSet
getAllProducts
(IReaction reaction) Returns all products of anIReaction
.static IAtomContainerSet
getAllReactants
(IReaction reaction) Returns all reactants of anIReaction
.static int
getAtomCount
(IReaction reaction) static int
getBondCount
(IReaction reaction) static IChemObject
getMappedChemObject
(IReaction reaction, IChemObject chemObject) Returns theIAtom
that is mapped.static IAtomContainer
getRelevantAtomContainer
(IReaction reaction, IAtom atom) static IAtomContainer
getRelevantAtomContainer
(IReaction reaction, IBond bond) static void
perceiveAtomTypesAndConfigureAtoms
(IReaction reaction) static void
static void
removeAtomAndConnectedElectronContainers
(IReaction reaction, IAtom atom) static void
removeElectronContainer
(IReaction reaction, IElectronContainer electrons) static IReaction
Returns a newIReaction
which is the reverse of the given reaction.static void
setAtomProperties
(IReaction reaction, Object propKey, Object propVal) static IAtomContainer
toMolecule
(IReaction rxn) Converts a reaction to an 'inlined' reaction stored as a molecule.static IReaction
toReaction
(IAtomContainer mol) Converts an 'inlined' reaction stored in a molecule back to a reaction.
-
Constructor Details
-
ReactionManipulator
public ReactionManipulator()
-
-
Method Details
-
getAtomCount
-
getBondCount
-
removeAtomAndConnectedElectronContainers
-
removeElectronContainer
-
getAllMolecules
Returns all components of anIReaction
, that is, reactants, agents and products.- Parameters:
reaction
- all components of this reaction are returned- Returns:
- IAtomContainerSet containing all components of the reaction provided as an argument
-
getAllProducts
Returns all products of anIReaction
.- Parameters:
reaction
- all products of this reaction are returned- Returns:
- IAtomContainerSet containing all products of the reaction provided as an argument
-
getAllReactants
Returns all reactants of anIReaction
.- Parameters:
reaction
- all reactants of this reaction are returned- Returns:
- IAtomContainerSet containing all reactants of the reaction provided as an argument
-
getAllAgents
Returns all agents of anIReaction
.- Parameters:
reaction
- all agents of this reaction are returned- Returns:
- IAtomContainerSet containing all agents of the reaction provided as an argument
-
reverse
Returns a newIReaction
which is the reverse of the given reaction.- Parameters:
reaction
- the reaction being considered- Returns:
- the reverse reaction
-
getAllAtomContainers
Returns allIAtomContainers
of the given reaction.- Parameters:
reaction
- the reaction whoseIAtomContainers
are returned- Returns:
- list of
IAtomContainers
comprising the reaction
-
getAllIDs
-
getRelevantAtomContainer
-
getRelevantAtomContainer
-
setAtomProperties
-
getAllChemObjects
-
getMappedChemObject
Returns theIAtom
that is mapped.- Parameters:
reaction
- reaction that contains the mappingchemObject
- IChemObject which will be searched for the mapped IChemObject- Returns:
- mapped IChemObject
-
toMolecule
Converts a reaction to an 'inlined' reaction stored as a molecule.All reactants, agents, products are added to the molecule as disconnected components with atoms flagged as to their role
ReactionRole
and component group.The inlined reaction, stored in a molecule can be converted back to an explicit reaction with
toReaction(org.openscience.cdk.interfaces.IAtomContainer)
. Data stored on the individual components (e.g. titles is lost in the conversion).- Parameters:
rxn
- reaction to convert- Returns:
- inlined reaction stored in a molecule
- See Also:
-
toReaction
Converts an 'inlined' reaction stored in a molecule back to a reaction.- Parameters:
mol
- molecule to convert- Returns:
- reaction
- See Also:
-
findMappedBonds
Collect the set of bonds that mapped in both a reactant and a product. The method uses theCDKConstants.ATOM_ATOM_MAPPING
property of atoms.- Parameters:
reaction
- reaction- Returns:
- mapped bonds
-
perceiveAtomTypesAndConfigureAtoms
Convenience method to perceive atom types for allIAtoms
of all components of the providedIReaction
. This method uses theCDKAtomTypeMatcher
. If the matcher finds a matching atom type, theIAtom
will be configured to have the same properties as theIAtomType
. If no matching atom type is found, no configuration is performed.
This method overwrites existing values.- Parameters:
reaction
- the reaction whose atom types are to be perceived- Throws:
CDKException
- See Also:
-
perceiveAtomTypesAndConfigureUnsetProperties
public static void perceiveAtomTypesAndConfigureUnsetProperties(IReaction reaction) throws CDKException Convenience method to perceive atom types for allIAtoms
of all components of the providedIReaction
. This method uses theCDKAtomTypeMatcher
. If the matcher finds a matching atom type, theIAtom
will be configured to have the same properties as theIAtomType
. If no matching atom type is found, no configuration is performed.
This method only setsnull
values.- Parameters:
reaction
- the reaction whose atom types are to be perceived- Throws:
CDKException
- See Also:
-
clearAtomConfigurations
This method will reset all atom properties related to atom configuration to the valueCDKConstants.UNSET
.
This method reverses most of the effects ofperceiveAtomTypesAndConfigureAtoms(org.openscience.cdk.interfaces.IReaction)
and after a call to this method all atoms will be "unconfigured".
Note that this method is not a complete reversal ofperceiveAtomTypesAndConfigureAtoms(org.openscience.cdk.interfaces.IReaction)
since the atomic symbol of the atoms remain unchanged. Also, all flags that were set by the configuration method (such asCDKConstants.IS_HYDROGENBOND_ACCEPTOR
orCDKConstants.ISAROMATIC
) will be set to False.- Parameters:
reaction
- the reaction whose atoms confiuration properties are to be cleared- See Also:
-