Class AtomIdentifier

java.lang.Object
chemaxon.reaction.AtomIdentifier
All Implemented Interfaces:
Comparable<AtomIdentifier>

@PublicAPI public class AtomIdentifier extends Object implements 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 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 method isExplicitizedHydrogen(). 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 is Integer.MIN_VALUE
The 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

    Constructors
    Constructor
    Description
    AtomIdentifier(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 Type
    Method
    Description
    int
     
    boolean
     
    getAtom(Molecule[] outputMolecules)
    Gets the MolAtom representation of the identified atom based on the provided output molecules of the reaction
    int
    Gets the index of the atom in the molecule
    int
    Gets the index of the molecule - in the input molecules of the reaction - containing the atom
    int
    Gets the mapping of the target atom in the reaction schema
    int
     
    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)
     

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait
  • 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 be Integer.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 be Integer.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

      public String toString()
      Overrides:
      toString in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • equals

      public boolean equals(Object obj)
      Overrides:
      equals in class Object
    • getAtom

      public MolAtom getAtom(Molecule[] outputMolecules)
      Gets the MolAtom 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

      public int compareTo(AtomIdentifier other)
      Specified by:
      compareTo in interface Comparable<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

      public boolean isVirginAtom(Molecule[] outputMolecules)
      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