Package chemaxon.reaction
Class AtomIdentifier
java.lang.Object
chemaxon.reaction.AtomIdentifier
- All Implemented Interfaces:
Comparable<AtomIdentifier>
The identifier of an atom in the input of the reaction.
The input atom is contained by an array of molecules (reactants, or products in case of reverse mode) that are the input molecules of the reaction. In this array the
The identifier may represent atom, that does not exist on the input side of the reaction (e.g.: atoms added while processing the reaction). This can be checked using the method
On the other hand the identifier may represent atom that does not exist on the output side of the reaction. (e.g.: atoms removed while processing the reaction). This can be checked using the method
The
NOTE: The value of the reaction schema map is valid only for positive values.
NOTE: If a reaction schema contains explicit H, and matches an implicit H on the input, the H atom will be added to the input molecule, however as the H atom is added during the reaction, it will be still counted as an orphan atom.
The input atom is contained by an array of molecules (reactants, or products in case of reverse mode) that are the input molecules of the reaction. In this array the
AtomIdentifier
defines an atom by the:
- Index of the molecule, can be acquired by
getMoleculeIndex()
. The value must be non-negative for non-orphan atoms. - Index of the atom in the molecule, can be acquired by
getAtomIndex()
. The value must be non-negative for non-orphan atoms, but can be negative for implicit hydrogens that are explicitized during the reaction. This can be checked using the methodisExplicitizedHydrogen()
. In this case the value of the index is the negative value of the index of the atom that is attached to this hydrogen. If the index of the attached atom is 0, the atom index of the identifier isInteger.MIN_VALUE
MolAtom
representation of the atom can be acquired using the
method getAtom(Molecule[])
providing the output
molecule array of the reaction. The identifier may represent atom, that does not exist on the input side of the reaction (e.g.: atoms added while processing the reaction). This can be checked using the method
isOrphanAtom()
. If this is
true, the AtomIdentifier
exists only to provide the mapping for the
reaction schema, and the result of getAtom(Molecule[])
will always be null. On the other hand the identifier may represent atom that does not exist on the output side of the reaction. (e.g.: atoms removed while processing the reaction). This can be checked using the method
isVirginAtom(Molecule[])
. In this case the output
molecule array of the reaction must be provided. The
AtomIdentifier
can store the mapping of the atom for the reaction
schema. This can be acquired by using the method
getReactionSchemaMap()
. NOTE: The value of the reaction schema map is valid only for positive values.
NOTE: If a reaction schema contains explicit H, and matches an implicit H on the input, the H atom will be added to the input molecule, however as the H atom is added during the reaction, it will be still counted as an orphan atom.
- Since:
- 5.11
-
Constructor Summary
ConstructorDescriptionAtomIdentifier
(int moleculeIndex, int atomIndex) Initializes an atom identifier based on the input molecules of the reaction.AtomIdentifier
(int moleculeIndex, int atomIndex, int reactionSchemaMap) Initializes an atom identifier based on the input molecules of the reaction. -
Method Summary
Modifier and TypeMethodDescriptionint
compareTo
(AtomIdentifier other) boolean
Gets theMolAtom
representation of the identified atom based on the provided output molecules of the reactionint
Gets the index of the atom in the moleculeint
Gets the index of the molecule - in the input molecules of the reaction - containing the atomint
Gets the mapping of the target atom in the reaction schemaint
hashCode()
boolean
Gets whether the identifier represents an explicit H atom, that was implicit H atom in the input molecule, and was explicitized during the reaction, because it matched an explicit H atom in the reaction schema.boolean
Gets whether the identifier represents an orphan atom.boolean
isVirginAtom
(Molecule[] outputMolecules) Gets whether the identifier represents a virgin atom.void
setReactionSchemaMap
(int mapIndex) Sets the map of the identified atom (the mapping in the reaction schema)toString()
-
Constructor Details
-
AtomIdentifier
public AtomIdentifier(int moleculeIndex, int atomIndex) Initializes an atom identifier based on the input molecules of the reaction.- Parameters:
moleculeIndex
- the index of the molecule containing the atom in the input molecules of the reaction. The value must be non-negative for non-orphan atoms.atomIndex
- the index of the atom in the molecule. The value must be non-negative for non-orphan atoms, but can be negative for implicit hydrogens that are explicitized during the reaction. In this case The value of the index must be the negative index atom that is attached to this hydrogen. If the index of the attached atom is 0, the atom index of the identifier must beInteger.MIN_VALUE
-
AtomIdentifier
public AtomIdentifier(int moleculeIndex, int atomIndex, int reactionSchemaMap) Initializes an atom identifier based on the input molecules of the reaction.- Parameters:
moleculeIndex
- the index of the molecule containing the atom in the input molecules of the reaction. The value must be non-negative for non-orphan atoms.atomIndex
- the index of the atom in the molecule. The value must be non-negative for non-orphan atoms, but can be negative for implicit hydrogens that are explicitized during the reaction. In this case The value of the index must be the negative index atom that is attached to this hydrogen. If the index of the attached atom is 0, the atom index of the identifier must beInteger.MIN_VALUE
reactionSchemaMap
- the mapping in the reaction schema
-
-
Method Details
-
setReactionSchemaMap
public void setReactionSchemaMap(int mapIndex) Sets the map of the identified atom (the mapping in the reaction schema)- Parameters:
mapIndex
- the mapping in the reaction schema
-
getMoleculeIndex
public int getMoleculeIndex()Gets the index of the molecule - in the input molecules of the reaction - containing the atom- Returns:
- the index of the molecule - in the input molecules of the reaction - containing the atom
-
getAtomIndex
public int getAtomIndex()Gets the index of the atom in the molecule- Returns:
- the index of the atom in the molecule
-
getReactionSchemaMap
public int getReactionSchemaMap()Gets the mapping of the target atom in the reaction schema- Returns:
- the mapping the target atom in the reaction schema
-
toString
-
hashCode
public int hashCode() -
equals
-
getAtom
Gets theMolAtom
representation of the identified atom based on the provided output molecules of the reaction- Parameters:
outputMolecules
- the output molecules of the reaction- Returns:
- the
MolAtom
representation of the target
-
compareTo
- Specified by:
compareTo
in interfaceComparable<AtomIdentifier>
-
isOrphanAtom
public boolean isOrphanAtom()Gets whether the identifier represents an orphan atom. (Atom that exists only on the output side of the reaction)- Returns:
- whether the identifier represents an orphan atom. (Atom that exists only on the output side of the reaction)
-
isVirginAtom
Gets whether the identifier represents a virgin atom. (Atom that exists only on the input side of the reaction)- Parameters:
outputMolecules
- the output molecules of the reaction- Returns:
- whether the identifier represents a virgin atom. (Atom that exists only on the input side of the reaction)
-
isExplicitizedHydrogen
public boolean isExplicitizedHydrogen()Gets whether the identifier represents an explicit H atom, that was implicit H atom in the input molecule, and was explicitized during the reaction, because it matched an explicit H atom in the reaction schema.- Returns:
- whether the identifier represents an explicitized H atom
-