Class Reaction
- java.lang.Object
-
- com.actelion.research.chem.reaction.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
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addCatalyst(StereoMolecule catalyst)
void
addCatalyst(StereoMolecule catalyst, int position)
void
addProduct(StereoMolecule product)
void
addProduct(StereoMolecule product, int position)
void
addReactant(StereoMolecule reactant)
void
addReactant(StereoMolecule reactant, int position)
void
clear()
double
getAverageBondLength()
StereoMolecule
getCatalyst(int no)
int
getCatalysts()
DrawingObjectList
getDrawingObjects()
int
getHighestMapNo()
Reaction
getMergedCopy()
Merges all reactants into one molecule and all products into another ad creates a new Reaction object from those.StereoMolecule
getMolecule(int no)
int
getMolecules()
java.lang.String
getName()
StereoMolecule
getProduct(int no)
int
getProducts()
StereoMolecule
getReactant(int no)
int
getReactants()
int
getReactionCenterAtoms(int moleculeNo, boolean[] isReactionCenterMapNo, boolean[] isReactionCenterAtom, int[] reactionCenterAtom)
Fills an array mapping on the atoms for the given molecule of this reaction.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.boolean
isEmpty()
boolean
isFragment()
The naming of this method is in analogy to the corresponding method of the Molecule class.boolean
isPerfectlyMapped()
Checks, whether all non-hydrogen atoms are mapped and whether every reactant atom has exactly one assigned product atom.boolean
isReactionLayoutRequired()
void
removeAtomMapping(boolean keepManualMapping)
void
removeCatalysts()
void
removeDrawingObjects()
void
setDrawingObjects(DrawingObjectList l)
void
setFragment(boolean f)
Sets all reactants and products of this reaction to the given fragment state, i.e.void
setName(java.lang.String name)
void
validateMapping()
Removes mapping numbers that are only used on one side of the reaction.
-
-
-
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
-
getReactant
public StereoMolecule getReactant(int no)
-
getReactants
public int getReactants()
-
getProduct
public StereoMolecule getProduct(int no)
-
getProducts
public int getProducts()
-
getCatalyst
public StereoMolecule getCatalyst(int no)
-
getCatalysts
public int getCatalysts()
-
getMolecules
public int getMolecules()
- Returns:
- count of reactants and products
-
getMolecule
public StereoMolecule getMolecule(int no)
-
addReactant
public void addReactant(StereoMolecule reactant)
-
addReactant
public void addReactant(StereoMolecule reactant, int position)
-
addProduct
public void addProduct(StereoMolecule product)
-
addProduct
public void addProduct(StereoMolecule product, int position)
-
addCatalyst
public void addCatalyst(StereoMolecule catalyst)
-
addCatalyst
public void addCatalyst(StereoMolecule catalyst, int position)
-
getName
public java.lang.String getName()
-
setName
public void setName(java.lang.String name)
-
getDrawingObjects
public DrawingObjectList getDrawingObjects()
-
setDrawingObjects
public void setDrawingObjects(DrawingObjectList l)
-
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 indexisReactionCenterMapNo
- 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 countreactionCenterAtom
- 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
-
-