public class ElementalAnalyser extends Object
API usage example:
ElementalAnalyser elemanal = new ElementalAnalyser();
// run plugin on target molecules
MolImporter mi = new MolImporter(input.smiles);
Molecule mol = null;
while ((mol = mi.read()) != null) {
// set target molecule
elemanal.setMolecule(mol);
double exactMass = elemanal.exactMass();
double mass = elemanal.mass();
int massPrecision = elemanal.massPrecision();
int atomCount1 = elemanal.atomCount(8); // oxygen atom count
int atomCount2 = elemanal.atomCount(8, 0); // non-isotope oxygen count
int atomCount3 = elemanal.atomCount(8, 16); // oxygen isotope count with massno=16
String formula = elemanal.formula();
String isotopeFormula = elemanal.isotopeFormula();
String composition = elemanal.composition(2); // precision=2
String isotopeComposition = elemanal.isotopeComposition(2); // precision=2
// now use the results...
}
| Constructor and Description |
|---|
ElementalAnalyser() |
| Modifier and Type | Method and Description |
|---|---|
int |
atomCount()
Calculates the number of atoms in the molecule.
|
int |
atomCount(int z)
Calculates the number of atoms of a given element in the molecule
(including its isotopes).
|
int |
atomCount(int z,
int m)
Calculates the number of atoms of a given element in the molecule.
|
String |
composition(int precision)
Gets the elemental analysis, the relative percent composition of a pure
chemical substance by element (w/w%).
|
String |
dotDisconnectedFormula()
Calculates the dot-disconnected molecular formula of a multifragment
molecule.
|
String |
dotDisconnectedIsotopeFormula()
Calculates the dot-disconnected isotope formula of a multifragment
molecule.
|
String |
dotDisconnectedIsotopeFormula(boolean symbolD)
Calculates the dot-disconnected isotope formula of a multifragment
molecule.
|
double |
exactMass()
Calculates the weight of the molecular ion measured in Mass Spectrometry
using the mass of the most frequent natural isotope of the atoms.
|
int |
exactMassPrecision()
Calculates the precision of the monoisitopic weight (number of significant decimal
digits).
|
String |
formula()
Calculates the molecular formula which is a string listing all atom types
an their occurence in the molecule.
|
String |
formula(int digits)
Calculates a fixed digit sortable molecular formula.
|
Smolecule |
getSmolecule()
Retrieves the input molecule
|
String |
isotopeComposition(int precision)
Gets the molecular composition (w/w%).
|
String |
isotopeComposition(int precision,
boolean symbolD)
Gets the molecular composition (w/w%).
|
String |
isotopeFormula()
Calculates the molecular formula (isotopes are separated).
|
String |
isotopeFormula(boolean symbolD)
Calculates the molecular formula (isotopes are separated).
|
double |
mass()
Calculates the molecular weight of the molecule.
|
int |
massPrecision()
Calculates the precision of the molecular weight (number of decimal
digits).
|
void |
setMolecule(MoleculeGraph mol)
Specifies a molecule to calculate with.
|
void |
setMolecule(Smolecule mol)
Deprecated.
as of Marvin 6.0, replaced by
setMolecule(MoleculeGraph mol). |
void |
setMolecule(String formula)
Specifies a molecule to calculate with.
|
public Smolecule getSmolecule()
public void setMolecule(String formula) throws IllegalArgumentException
formula - the molecular formula to calculate with (e.g. C3H10, C6H11N3.2(HCl))IllegalArgumentException - if the formula is invalidpublic void setMolecule(MoleculeGraph mol)
mol - the molecule to calculate with@Deprecated public void setMolecule(Smolecule mol)
setMolecule(MoleculeGraph mol).mol - the molecule to calculate withpublic int atomCount()
public int atomCount(int z)
z - atomic number of the atom (protons)public int atomCount(int z,
int m)
z - atomic number of the atom (protons)m - mass number of the atom (protons + neutrons)public double mass()
public int massPrecision()
public double exactMass()
public int exactMassPrecision()
public String formula()
public String formula(int digits)
digits - number of minimum digitspublic String isotopeFormula()
public String isotopeFormula(boolean symbolD)
symbolD - uses the D symbol for Deuterium and T for Tritium if
true, otherwise [2H] and [3H]public String dotDisconnectedFormula()
public String dotDisconnectedIsotopeFormula()
public String dotDisconnectedIsotopeFormula(boolean symbolD)
symbolD - uses the D symbol for Deuterium and T for Tritium if
true, otherwise [2H] and [3H]public String composition(int precision)
public String isotopeComposition(int precision)
precision - number of decimal digitspublic String isotopeComposition(int precision, boolean symbolD)
precision - number of decimal digitssymbolD - uses the D symbol for Deuterium and T for Tritium if
true, otherwise [2H] and [3H]