|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectchemaxon.marvin.plugin.CalculatorPlugin
chemaxon.marvin.calculations.ElementalAnalyserPlugin
public class ElementalAnalyserPlugin
Calculates molecular formula, mass, MS mass and composition.
API usage example (as an alternative, you can also use
the ElementalAnalyser
class directly):
// read input molecule
MolImporter mi = new MolImporter("test.mol");
Molecule mol = mi.read();
mi.close();
// create plugin
ElementalAnalyserPlugin plugin = new ElementalAnalyserPlugin();
// set plugin parameters
Properties params = new Properties();
params.put("precision", "3");
plugin.setParameters(params);
// set target molecule
plugin.setMolecule(mol);
// run the calculation
plugin.run();
// get results
double exactMass = plugin.getExactMass();
double mass = plugin.getMass();
int atomCount1 = plugin.getAtomCount(8); // oxygen atom count
int atomCount2 = plugin.getAtomCount(8, 0); // non-isotope oxygen count
int atomCount3 = plugin.getAtomCount(8, 16); // oxygen isotope count with massno=16
String formula = plugin.getFormula();
String isotopeFormula = plugin.getIsotopeFormula();
String composition = plugin.getComposition();
String isotopeComposition = plugin.getIsotopeComposition();
// do something with the results ...
For concurrent plugin example applications using ChemAxon's concurrent framework, refer to the Concurrent plugin examples.
| Field Summary |
|---|
| Fields inherited from class chemaxon.marvin.plugin.CalculatorPlugin |
|---|
ATOM, BLUE, CALCRGB_OFF, COVALENT_HYDRATION_ERROR_REMARK, CRITICAL_ERROR_MSG, EPSILON, INCORRECT_AROMATIC_NITROGEN_REMARK, INSTABLE_TAUTOMERIC_FORM_REMARK, licenseEnvironment, MOLECULE, NAN, PLUGIN_CLASS_KEY, PLUGIN_DIR, RED |
| Constructor Summary | |
|---|---|
ElementalAnalyserPlugin()
|
|
| Method Summary | |
|---|---|
void |
checkMolecule(Molecule mol)
Checks the input molecule. |
int |
getAllAtomCount()
Returns the atom count (including implicit hydrogens). |
int |
getAtomCount(int z)
Returns the number of atoms with given atomic number (including its isotopes). |
int |
getAtomCount(int z,
int m)
Returns the number of atoms with given atomic number in the molecule isotope with the specified mass number. |
java.lang.String |
getComposition()
Calculates the elemental analysis, the relative percent composition of a pure chemical substance by element (w/w%). |
java.lang.String |
getDotDisconnectedFormula()
Calculates the dot-disconnected molecular formula of a multifragment molecule. |
java.lang.String |
getDotDisconnectedIsotopeFormula()
Calculates the dot-disconnected isotope formula of a multifragment molecule. |
java.lang.String |
getDotDisconnectedIsotopeFormula(boolean symbolD)
Calculates the dot-disconnected isotope formula of a multifragment molecule. |
double |
getExactMass()
Calculates the weight of the MS molecule ion using the mass of the most frequent natural isotope for element atoms. |
java.lang.String |
getFormula()
Calculates the molecular formula which is a string listing all atom types an their occurence in the molecule. |
java.lang.String |
getIsotopeComposition()
Returns the molecular composition (w/w%). |
java.lang.String |
getIsotopeComposition(boolean symbolD)
Returns the molecular composition (w/w%). |
java.lang.String |
getIsotopeFormula()
Calculates the molecular formula (isotopes are separated). |
java.lang.String |
getIsotopeFormula(boolean symbolD)
Calculates the molecular formula (isotopes are separated). |
double |
getMass()
Calculates the molecular weight of the molecule. |
java.lang.Object |
getResult(java.lang.Object type,
int index)
Returns the result item for the specified key and index. |
java.lang.Object |
getResult(java.lang.Object type,
java.lang.String arg)
Returns the atom count of a specific atom. |
java.lang.String |
getResultAsString(java.lang.Object type,
int index,
java.lang.Object result)
Returns the specified result in String format. |
int |
getResultCount(java.lang.Object type)
Returns the number of result items for the given result key. |
int |
getResultDomain(java.lang.Object type)
Returns the calculation domain CalculatorPlugin.ATOM or CalculatorPlugin.MOLECULE. |
Molecule |
getResultMolecule()
Returns the result molecule for display. |
java.lang.Object[] |
getResultTypes()
Returns the result types. |
java.lang.String |
getTypeString(java.lang.Object type)
Returns a string representation of the given type. |
boolean |
handlesMultiFragmentMolecules()
Returns true if the plugin handles multifragment molecules,
false otherwise. |
boolean |
run()
Runs the tool. |
protected void |
setInputMolecule(Molecule mol)
Sets the input molecule. |
void |
setParameters(java.util.Properties params)
Sets the input parameters for the plugin. |
void |
standardize(Molecule mol)
Prevents default standardization: does nothing. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public ElementalAnalyserPlugin()
| Method Detail |
|---|
public void setParameters(java.util.Properties params)
throws PluginException
setParameters in class CalculatorPluginparams - is the parameter table
PluginException - on errorpublic boolean handlesMultiFragmentMolecules()
true if the plugin handles multifragment molecules,
false otherwise. In the latter case the plugin takes the
fragment with more atoms if a multifragment molecule is given as input.
Returns true if parameter "single" is set to "false",
false otherwise (default: false).
handlesMultiFragmentMolecules in class CalculatorPlugin
public void checkMolecule(Molecule mol)
throws PluginException
RxnMolecule
or if the molecule contains R-groups.
checkMolecule in class CalculatorPluginmol - is the input molecule
PluginException - with error message for the user if the molecule is refused
protected void setInputMolecule(Molecule mol)
throws PluginException
setInputMolecule in class CalculatorPluginmol - is the input molecule
PluginException - on errorpublic double getMass()
public double getExactMass()
public java.lang.String getFormula()
public java.lang.String getIsotopeFormula()
public java.lang.String getIsotopeFormula(boolean symbolD)
symbolD - uses the D symbol for Deuterium and T for Tritium if
true, otherwise [2H] and [3H]
public java.lang.String getDotDisconnectedFormula()
public java.lang.String getDotDisconnectedIsotopeFormula()
public java.lang.String getDotDisconnectedIsotopeFormula(boolean symbolD)
symbolD - uses the D symbol for Deuterium and T for Tritium if
true, otherwise [2H] and [3H]
public java.lang.String getComposition()
public java.lang.String getIsotopeComposition()
public java.lang.String getIsotopeComposition(boolean symbolD)
symbolD - uses the D symbol for Deuterium and T for Tritium if
true, otherwise [2H] and [3H]
public int getAllAtomCount()
public int getAtomCount(int z)
z - is the atomic number
public int getAtomCount(int z,
int m)
0, then non-isotope
atoms with the given atomic number are counted.
z - is the atomic numberm - is the mass number
public java.lang.Object getResult(java.lang.Object type,
int index)
throws PluginException
getResult in class CalculatorPlugintype - is the result typeindex - is the result index
PluginException - if the result cannot be returnedCalculatorPlugin.getResultTypes()
public java.lang.Object getResult(java.lang.Object type,
java.lang.String arg)
throws PluginException
getResult in class CalculatorPlugintype - is the result type ("atomcount")arg - is the atomic number or the atomic number and the mass number
separated by "." (e.g. "7.14")
PluginException - if the result cannot be returnedCalculatorPlugin.getResultTypes()
public java.lang.String getResultAsString(java.lang.Object type,
int index,
java.lang.Object result)
throws PluginException
getResultAsString in class CalculatorPlugintype - is the result typeindex - is the result indexresult - is the result item
PluginException - if an invalid result item is givenpublic int getResultCount(java.lang.Object type)
getResultCount in class CalculatorPlugintype - is the result type
getResultTypes()public int getResultDomain(java.lang.Object type)
CalculatorPlugin.ATOM or CalculatorPlugin.MOLECULE.
getResultDomain in class CalculatorPlugintype - is the result key
getResultTypes()public java.lang.Object[] getResultTypes()
getResultTypes in class CalculatorPluginpublic java.lang.String getTypeString(java.lang.Object type)
getTypeString in class CalculatorPlugintype - is the type object
public boolean run()
throws PluginException
run in class CalculatorPluginPluginException - on errorCalculatorPlugin.getErrorMessage()
public Molecule getResultMolecule()
throws PluginException
MolAtom.getExtraLabel()).
Molecular results are stored in molecule properties
with keys being the result types
(Molecule.getProperty(String)).
getResultMolecule in class CalculatorPluginPluginException - on errorpublic void standardize(Molecule mol)
standardize in class CalculatorPluginmol - is the molecule to be standardized
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||