@PublicAPI public class MolHandler extends chemaxon.util.MolHandlerBase
Modifier and Type | Field and Description |
---|---|
protected boolean |
molAlignerSet |
CLASS_NOT_FOUND_ERROR, DATABASE_SEARCH_ERROR, exception, ILLEGAL_ACCESS_ERROR, INSTANTIATION_ERROR, IO_ERROR, MAX_SEARCH_FREQUENCY_EXCEEDED_ERROR, MOL_FORMAT_ERROR, NO_ERROR, SQL_ERROR, UNIDENTIFIED_ERROR
Constructor and Description |
---|
MolHandler()
Creates an uninitialized MolHandler object.
|
MolHandler(byte[] molecule)
Creates a MolHandler object from a byte array.
|
MolHandler(byte[] molecule,
boolean queryMode)
Creates a MolHandler object from a byte array.
|
MolHandler(Molecule mol)
Creates a MolHandler object from a Molecule.
|
MolHandler(java.lang.String molecule)
Creates a MolHandler object from a String.
|
MolHandler(java.lang.String molecule,
boolean queryMode)
Creates a MolHandler object from a String.
|
Modifier and Type | Method and Description |
---|---|
void |
addHydrogens()
Adds explicit H atoms instead of the current implicit ones.
|
void |
addHydrogensToAromaticHeteroAtoms()
Adds the implicit Hydrogen atoms to heteroatoms
in aromatic rings.
|
double |
align(Molecule mol,
int[] indexes)
Alignes (rotates) a specified molecule realtive to the contained molecule
according to the specified atom pairs.
|
void |
aromatize()
Converts the bonds in an aromatic system entered using
single and double bonds to aromatic bonds.
|
void |
aromatize(int method)
Converts the bonds in an aromatic system entered using single and
double bonds to aromatic bonds.
|
java.lang.String |
calcMolFormula()
Calculates the molecular formula of the molecule.
|
float |
calcMolWeight()
Calculates the molecular weight of the molecule.
|
double |
calcMolWeightInDouble()
Calculates the molecular weight of the molecule.
|
void |
clean(boolean always,
java.lang.String options)
Calculates 2D coordinates.
|
boolean |
containsHydrogens()
True if the molecule contains explicit Hydrogen atoms,
false otherwise.
|
byte[] |
generateFingerprintInBytes(int numberOfInts,
int numberOfOnes,
int numberOfBonds)
Generates chemical hashed fingerprint for the molecule and returns it in
byte units. |
int[] |
generateFingerprintInInts(int numberOfInts,
int numberOfOnes,
int numberOfBonds)
Generates chemical hashed fingerprint for the molecule and returns it in
int units. |
int |
getAtomCount()
Retrieves the number of atoms in the Molecule
stored in the MolHandler object.
|
int |
getHeavyAtomCount()
Retrieves the number of non-hydrogen atoms in the Molecule
stored in the MolHandler object.
|
int |
getImplicitHCount()
Counts the number of implicit hydrogens on the molecule
|
boolean |
getQueryMode()
Gets query mode.
|
static boolean |
isPlainH(MolAtom atom)
Decides if atom is a plain H atom.
|
static void |
main(java.lang.String[] args) |
void |
removeHydrogens()
Removes all hydrogen atoms.
|
void |
removeHydrogensFromCarbons()
Removes Hydrogen atoms attached to Carbon atoms.
|
void |
setMolecule(byte[] molecule)
Initializes a MolHandler object from a byte array.
|
void |
setMolecule(Molecule molecule)
Initializes a MolHandler object from a Molecule.
|
void |
setMolecule(java.lang.String molecule)
Sets the molecule.
|
byte[] |
toBinFormat(java.lang.String format)
Converts the molecule to the specified binary format.
|
java.lang.String |
toFormat(java.lang.String format)
Converts the molecule to the specified text format.
|
checkError, checkException, getError, getErrorMessage, getException, getStackTrace
public MolHandler()
public MolHandler(Molecule mol)
mol
- a clone of this parameter is stored in the MolHandler objectpublic MolHandler(java.lang.String molecule) throws MolFormatException
molecule
- the String must contain a molecule in
MDL's Molfile or
Compressed Molfile
or Smiles format.MolFormatException
- if the importer encounters a problempublic MolHandler(java.lang.String molecule, boolean queryMode) throws MolFormatException
molecule
- the String must contain a molecule in
MDL's Molfile or
Compressed Molfile
or Smiles format.queryMode
- if set to true
SMILES strings are imported as
SMARTS. Default is false
.MolFormatException
- if the importer encounters a problempublic MolHandler(byte[] molecule) throws MolFormatException
molecule
- the byte array must contain a molecule in
MDL's Molfile or
Compressed Molfile
or Smiles format.MolFormatException
- if the importer encounters a problempublic MolHandler(byte[] molecule, boolean queryMode) throws MolFormatException
molecule
- the byte array must contain a molecule in
MDL's Molfile or
Compressed Molfile
or Smiles formatqueryMode
- if set to true
SMILES strings are imported as
SMARTS. Default is false
.MolFormatException
- if the importer encounters a problem
since 2.2public void setMolecule(Molecule molecule)
molecule
- a clone of this parameter is stored in the MolHandler objectpublic void setMolecule(java.lang.String molecule) throws MolFormatException
setMolecule
in class chemaxon.util.MolHandlerBase
molecule
- the molecule to load into this molhandlerMolFormatException
- if the importer encounters a problempublic void setMolecule(byte[] molecule) throws MolFormatException
molecule
- the byte array must contain a molecule in
MDL's Molfile or
Compressed Molfile
or Smiles format.MolFormatException
- if the importer encounters a problempublic int getAtomCount()
public int getHeavyAtomCount()
public void addHydrogens()
public void addHydrogensToAromaticHeteroAtoms()
public void removeHydrogens()
public void removeHydrogensFromCarbons()
public boolean containsHydrogens()
public void aromatize()
public void aromatize(int method)
method
- specifies the algorithm for aromatization. Possible
values:
MoleculeGraph.AROM_GENERAL
- Chemaxon aromatization MoleculeGraph.AROM_BASIC
- Daylight aromatization (modified Huckel rule)MoleculeGraph.AROM_GENERAL
,
MoleculeGraph.AROM_BASIC
,
Aromata
public float calcMolWeight()
public double calcMolWeightInDouble()
double
value.public java.lang.String calcMolFormula()
public void clean(boolean always, java.lang.String options)
O1
option of cleaning.always
- if false
then
cleaning will only be performed if the
present coordinates are different from zero.options
- specifies the options used for 2D
calculation. (E.g.: "O1e")MoleculeGraph.clean(int,java.lang.String)
public java.lang.String toFormat(java.lang.String format)
format
- "mol", "csmol", "smiles", ...public byte[] toBinFormat(java.lang.String format)
format
- "png", "jpeg", "ppm", ...public int[] generateFingerprintInInts(int numberOfInts, int numberOfOnes, int numberOfBonds)
int
units.
numberOfInts
- the length of the binary fingerprint in int
(32 bit) units.numberOfOnes
- the number of bits to switch on
for each pattern.numberOfBonds
- the maximum length of edges in
patterns used for generating the fingerprint.generateFingerprintInBytes(int, int, int)
public byte[] generateFingerprintInBytes(int numberOfInts, int numberOfOnes, int numberOfBonds)
byte
units.
numberOfInts
- the length of the binary fingerprint in int
(32 bit) units.numberOfOnes
- the number of bits to switch on
for each pattern.numberOfBonds
- the maximum length of edges in
patterns used for generating the fingerprint.generateFingerprintInInts(int, int, int)
public int getImplicitHCount()
public double align(Molecule mol, int[] indexes) throws java.lang.IllegalArgumentException
mol
- the molecule to be alignedindexes
- the atom indexes of the pattern in the order of the
atoms of the molecule to be aligned. Negative values are ignored.
The size of this array should be at least the number of atoms in the pattern
molecule (in case of RgMolecules, the number of non R-group atoms of
the root structure).
If the size of the array is grater, the excess elements are ignored.java.lang.IllegalArgumentException
- if encounteredpublic boolean getQueryMode()
public static boolean isPlainH(MolAtom atom)
atom
- MolAtom to decide.public static void main(java.lang.String[] args) throws java.io.IOException
java.io.IOException