Class Reaction

  • All Implemented Interfaces:
    java.io.Serializable
    Direct Known Subclasses:
    DatabaseReaction

    public class Reaction
    extends java.lang.Object
    implements java.io.Serializable
    See Also:
    Serialized Form
    • Constructor Detail

      • Reaction

        public Reaction()
      • Reaction

        public Reaction​(java.lang.String name)
      • Reaction

        public Reaction​(Reaction rxn)
      • Reaction

        public Reaction​(StereoMolecule[] mol,
                        int reactantCount)
    • Method Detail

      • clear

        public void clear()
      • removeCatalysts

        public void removeCatalysts()
      • removeAtomMapping

        public void removeAtomMapping​(boolean keepManualMapping)
      • removeDrawingObjects

        public void removeDrawingObjects()
      • isEmpty

        public boolean isEmpty()
        Returns:
        true, if neither of reactants, products, or catalysts contain any atoms
      • setFragment

        public void setFragment​(boolean f)
        Sets all reactants and products of this reaction to the given fragment state, i.e. whether they are considered molecules with all valences satisfied with hydrogens or whether they are substructure fragments that can have query features.
        Parameters:
        f -
      • isFragment

        public boolean isFragment()
        The naming of this method is in analogy to the corresponding method of the Molecule class. Returns whether at least one of the reactants or products is marked as substructure fragment. Only if there are no molecules, then the reaction's explicit fragment status is returned.
        Returns:
        fragment status of molecules or reaction
      • getReactants

        public int getReactants()
      • getProducts

        public int getProducts()
      • getCatalysts

        public int getCatalysts()
      • getMolecules

        public int getMolecules()
        Returns:
        count of reactants and products
      • addReactant

        public void addReactant​(StereoMolecule reactant,
                                int position)
      • addProduct

        public void addProduct​(StereoMolecule product,
                               int position)
      • addCatalyst

        public void addCatalyst​(StereoMolecule catalyst,
                                int position)
      • getName

        public java.lang.String getName()
      • setName

        public void setName​(java.lang.String name)
      • getAverageBondLength

        public double getAverageBondLength()
      • isReactionLayoutRequired

        public boolean isReactionLayoutRequired()
        Returns:
        whether the molecule's atom coordinate bounds touch or overlap
      • isPerfectlyMapped

        public boolean isPerfectlyMapped()
        Checks, whether all non-hydrogen atoms are mapped and whether every reactant atom has exactly one assigned product atom.
        Returns:
      • getHighestMapNo

        public int getHighestMapNo()
      • validateMapping

        public void validateMapping()
                             throws java.lang.Exception
        Removes mapping numbers that are only used on one side of the reaction. Throws an exception if duplicate mapping numbers occur in reactants or products.
        Throws:
        java.lang.Exception
      • getReactionCenterMapNos

        public boolean[] getReactionCenterMapNos()
        This method determines the largest mapping number in use (maxMapNo), creates a boolean array[maxMapNo+1], and within this array flags every mapping number that refers to atoms, which change bonds in the course of the reaction. Mapped atoms that are connected to unpammed atoms are also considered being part of the reaction center. If the reaction is unmapped or has no reactants or products, then null is returned.
        Returns:
        null or boolean array indicating, which mapping numbers are referring to the reaction center
      • getReactionCenterAtoms

        public int getReactionCenterAtoms​(int moleculeNo,
                                          boolean[] isReactionCenterMapNo,
                                          boolean[] isReactionCenterAtom,
                                          int[] reactionCenterAtom)
        Fills an array mapping on the atoms for the given molecule of this reaction. Array bits are set if the respective atom has a mapping number flagged to be part of the reaction center, or if the atom has no mapping number but is connected to a mapped atom. The isReactionCenterAtom must be initialized with false before calling this method.
        Parameters:
        moleculeNo - reaction molecule index
        isReactionCenterMapNo - flagged list of all reaction center mapping numbers, typically from getReactionCenterMapNos()
        isReactionCenterAtom - null or empty array not smaller than the addressed molecule's total atom count
        reactionCenterAtom - null or array not smaller than the addressed molecule's total atom count
        Returns:
        number of discovered reaction center atoms
      • getMergedCopy

        public Reaction getMergedCopy()
        Merges all reactants into one molecule and all products into another ad creates a new Reaction object from those.
        Returns:
        new reaction from merged reactants and merged products