|
||||||||||
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
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 ...
Field Summary |
Fields inherited from class chemaxon.marvin.plugin.CalculatorPlugin |
ATOM, BLUE, CALCRGB_OFF, CHART, HYDROGEN_VALENCE_ERROR_MSG, MOLECULE, NAN, RED, SUBRESULT |
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. |
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()
Returns the molecule formula composition. |
double |
getExactMass()
Returns the molecule exact mass. |
java.lang.String |
getFormula()
Returns the molecule formula. |
java.lang.String |
getIsotopeComposition()
Returns the molecule isotope composition. |
java.lang.String |
getIsotopeFormula()
Returns the molecule isotope formula. |
double |
getMass()
Returns the molecule mass. |
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 . |
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. |
protected 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 CalculatorPlugin
params
- 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 CalculatorPlugin
mol
- is the input molecule
PluginException
- with error message for the user if the molecule is refusedprotected void setInputMolecule(Molecule mol) throws PluginException
setInputMolecule
in class CalculatorPlugin
mol
- 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 getComposition()
public java.lang.String getIsotopeComposition()
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 CalculatorPlugin
type
- 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 CalculatorPlugin
type
- 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 CalculatorPlugin
type
- 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 CalculatorPlugin
type
- is the result type
getResultTypes()
public int getResultDomain(java.lang.Object type)
CalculatorPlugin.ATOM
or CalculatorPlugin.MOLECULE
.
getResultDomain
in class CalculatorPlugin
type
- is the result key
getResultTypes()
public java.lang.Object[] getResultTypes()
getResultTypes
in class CalculatorPlugin
public java.lang.String getTypeString(java.lang.Object type)
getTypeString
in class CalculatorPlugin
type
- is the type object
public boolean run() throws PluginException
run
in class CalculatorPlugin
PluginException
- on errorCalculatorPlugin.getErrorMessage()
protected void standardize(Molecule mol)
standardize
in class CalculatorPlugin
mol
- is the molecule to be standardized
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |