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:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic voidclearAtomConfigurations(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 IAtomContainerSetgetAllAgents(IReaction reaction) Returns all agents of anIReaction.static List<IAtomContainer>getAllAtomContainers(IReaction reaction) Returns allIAtomContainersof the given reaction.static List<IChemObject>getAllChemObjects(IReaction reaction) static IAtomContainerSetgetAllMolecules(IReaction reaction) Returns all components of anIReaction, that is, reactants, agents and products.static IAtomContainerSetgetAllProducts(IReaction reaction) Returns all products of anIReaction.static IAtomContainerSetgetAllReactants(IReaction reaction) Returns all reactants of anIReaction.static intgetAtomCount(IReaction reaction) Returns the total number of atoms for all components of the givenreaction.static intgetBondCount(IReaction reaction) Returns the total number of atoms for all components of the givenreaction.static IChemObjectgetMappedChemObject(IReaction reaction, IChemObject chemObject) Returns theIAtomthat is mapped.static IAtomContainergetRelevantAtomContainer(IReaction reaction, IAtom atom) static IAtomContainergetRelevantAtomContainer(IReaction reaction, IBond bond) static voidperceiveAtomTypesAndConfigureAtoms(IReaction reaction) static voidstatic voidremoveAtomAndConnectedElectronContainers(IReaction reaction, IAtom atom) Removes the providedatomand its connected electron containers from the reaction.static voidremoveElectronContainer(IReaction reaction, IElectronContainer electrons) Removes the providedelectronsfrom the reaction.static IReactionReturns a newIReactionwhich is the reverse of the given reaction.static voidsetAtomProperties(IReaction reaction, Object propKey, Object propVal) static IAtomContainertoMolecule(IReaction rxn) Converts a reaction to an 'inlined' reaction stored as a molecule.static IReactiontoReaction(IAtomContainer mol) Converts an 'inlined' reaction stored in a molecule back to a reaction.
-
Constructor Details
-
ReactionManipulator
public ReactionManipulator()
-
-
Method Details
-
getAtomCount
Returns the total number of atoms for all components of the givenreaction.- Parameters:
reaction- the number of atoms is summed up for all components of this reaction- Returns:
- total number of atoms for all
IAtomContainerthat are part of this reaction
-
getBondCount
Returns the total number of atoms for all components of the givenreaction.- Parameters:
reaction- the number of atoms is summed up for all components of this reaction- Returns:
- total number of atoms for all
IAtomContainerthat are part of this reaction
-
removeAtomAndConnectedElectronContainers
Removes the providedatomand its connected electron containers from the reaction.- Parameters:
reaction- reaction the atom is removed fromatom- atom that is removed
-
removeElectronContainer
Removes the providedelectronsfrom the reaction.- Parameters:
reaction- reaction the electron container is removed fromelectrons- electron container that is removed
-
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 newIReactionwhich is the reverse of the given reaction. TheIAtomContainers of the reversed reaction that is returned are the same that are part of thereactionprovided as an argument.- Parameters:
reaction- the reaction being considered- Returns:
- the reverse reaction
-
getAllAtomContainers
Returns allIAtomContainersof the given reaction.- Parameters:
reaction- the reaction whoseIAtomContainersare returned- Returns:
- list of
IAtomContainerscomprising the reaction
-
getAllIDs
-
getRelevantAtomContainer
-
getRelevantAtomContainer
-
setAtomProperties
-
getAllChemObjects
-
getMappedChemObject
Returns theIAtomthat 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
ReactionRoleand 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_MAPPINGproperty of atoms.- Parameters:
reaction- reaction- Returns:
- mapped bonds
-
perceiveAtomTypesAndConfigureAtoms
Convenience method to perceive atom types for allIAtomsof all components of the providedIReaction. This method uses theCDKAtomTypeMatcher. If the matcher finds a matching atom type, theIAtomwill 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- thrown if an error is encountered when finding matching atom types- See Also:
-
perceiveAtomTypesAndConfigureUnsetProperties
public static void perceiveAtomTypesAndConfigureUnsetProperties(IReaction reaction) throws CDKException Convenience method to perceive atom types for allIAtomsof all components of the providedIReaction. This method uses theCDKAtomTypeMatcher. If the matcher finds a matching atom type, theIAtomwill be configured to have the same properties as theIAtomType. If no matching atom type is found, no configuration is performed.
This method only setsnullvalues.- Parameters:
reaction- the reaction whose atom types are to be perceived- Throws:
CDKException- thrown if an error is encountered when finding matching atom types- 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 asIChemObject.HYDROGEN_BOND_ACCEPTORorIChemObject.AROMATIC) will be set to False.- Parameters:
reaction- the reaction whose atoms confiuration properties are to be cleared- See Also:
-