Class ReactionManipulator


  • public class ReactionManipulator
    extends Object
    Provides a variety of methods to manipulate and convert from/to IReaction.
    Author:
    uli-f
    See Also:
    ChemModelManipulator
    Source code:
    main
    Belongs to CDK module:
    standard
    • Constructor Detail

      • ReactionManipulator

        public ReactionManipulator()
    • Method Detail

      • getAtomCount

        public static int getAtomCount​(IReaction reaction)
        Returns the total number of atoms for all components of the given reaction.
        Parameters:
        reaction - the number of atoms is summed up for all components of this reaction
        Returns:
        total number of atoms for all IAtomContainer that are part of this reaction
      • getBondCount

        public static int getBondCount​(IReaction reaction)
        Returns the total number of atoms for all components of the given reaction.
        Parameters:
        reaction - the number of atoms is summed up for all components of this reaction
        Returns:
        total number of atoms for all IAtomContainer that are part of this reaction
      • removeAtomAndConnectedElectronContainers

        public static void removeAtomAndConnectedElectronContainers​(IReaction reaction,
                                                                    IAtom atom)
        Removes the provided atom and its connected electron containers from the reaction.
        Parameters:
        reaction - reaction the atom is removed from
        atom - atom that is removed
      • removeElectronContainer

        public static void removeElectronContainer​(IReaction reaction,
                                                   IElectronContainer electrons)
        Removes the provided electrons from the reaction.
        Parameters:
        reaction - reaction the electron container is removed from
        electrons - electron container that is removed
      • getAllMolecules

        public static IAtomContainerSet getAllMolecules​(IReaction reaction)
        Returns all components of an IReaction, 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

        public static IAtomContainerSet getAllProducts​(IReaction reaction)
        Returns all products of an IReaction.
        Parameters:
        reaction - all products of this reaction are returned
        Returns:
        IAtomContainerSet containing all products of the reaction provided as an argument
      • getAllReactants

        public static IAtomContainerSet getAllReactants​(IReaction reaction)
        Returns all reactants of an IReaction.
        Parameters:
        reaction - all reactants of this reaction are returned
        Returns:
        IAtomContainerSet containing all reactants of the reaction provided as an argument
      • getAllAgents

        public static IAtomContainerSet getAllAgents​(IReaction reaction)
        Returns all agents of an IReaction.
        Parameters:
        reaction - all agents of this reaction are returned
        Returns:
        IAtomContainerSet containing all agents of the reaction provided as an argument
      • reverse

        public static IReaction reverse​(IReaction reaction)
        Returns a new IReaction which is the reverse of the given reaction. The IAtomContainers of the reversed reaction that is returned are the same that are part of the reaction provided as an argument.
        Parameters:
        reaction - the reaction being considered
        Returns:
        the reverse reaction
      • getAllAtomContainers

        public static List<IAtomContainer> getAllAtomContainers​(IReaction reaction)
        Returns all IAtomContainers of the given reaction.
        Parameters:
        reaction - the reaction whose IAtomContainers are returned
        Returns:
        list of IAtomContainers comprising the reaction
      • setAtomProperties

        public static void setAtomProperties​(IReaction reaction,
                                             Object propKey,
                                             Object propVal)
      • getMappedChemObject

        public static IChemObject getMappedChemObject​(IReaction reaction,
                                                      IChemObject chemObject)
        Returns the IAtom that is mapped.
        Parameters:
        reaction - reaction that contains the mapping
        chemObject - IChemObject which will be searched for the mapped IChemObject
        Returns:
        mapped IChemObject
      • toReaction

        public static IReaction toReaction​(IAtomContainer mol)
        Converts an 'inlined' reaction stored in a molecule back to a reaction.
        Parameters:
        mol - molecule to convert
        Returns:
        reaction
        See Also:
        toMolecule(IReaction)
      • findMappedBonds

        public static Set<IBond> findMappedBonds​(IReaction reaction)
        Collect the set of bonds that mapped in both a reactant and a product. The method uses the CDKConstants.ATOM_ATOM_MAPPING property of atoms.
        Parameters:
        reaction - reaction
        Returns:
        mapped bonds
      • perceiveAtomTypesAndConfigureAtoms

        public static void perceiveAtomTypesAndConfigureAtoms​(IReaction reaction)
                                                       throws CDKException
        Convenience method to perceive atom types for all IAtoms of all components of the provided IReaction. This method uses the CDKAtomTypeMatcher. If the matcher finds a matching atom type, the IAtom will be configured to have the same properties as the IAtomType. 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:
        AtomTypeManipulator.configure(IAtom, IAtomType)
      • perceiveAtomTypesAndConfigureUnsetProperties

        public static void perceiveAtomTypesAndConfigureUnsetProperties​(IReaction reaction)
                                                                 throws CDKException
        Convenience method to perceive atom types for all IAtoms of all components of the provided IReaction. This method uses the CDKAtomTypeMatcher. If the matcher finds a matching atom type, the IAtom will be configured to have the same properties as the IAtomType. If no matching atom type is found, no configuration is performed.
        This method only sets null 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:
        AtomTypeManipulator.configureUnsetProperties(IAtom, IAtomType)