chemaxon.marvin.calculations
Class MajorMicrospeciesPlugin

java.lang.Object
  extended bychemaxon.marvin.plugin.CalculatorPlugin
      extended bychemaxon.marvin.calculations.MajorMicrospeciesPlugin
Direct Known Subclasses:
ChargePlugin, HBDAPlugin, HuckelAnalysisPlugin, PolarizabilityPlugin, TPSAPlugin

public class MajorMicrospeciesPlugin
extends CalculatorPlugin

Plugin class that calculates the major microspecies on a given pH.

API usage example:

    // read input molecule
    MolImporter mi = new MolImporter("test.mol");
    Molecule mol = mi.read();

    // create plugin
    MajorMicrospeciesPlugin plugin = new MajorMicrospeciesPlugin();

    // set pH
    plugin.setpH(7.4);

    // set target molecule
    plugin.setMolecule(mol);
	
    // run the calculation
    plugin.run();

    // get result
    Molecule msmol = plugin.getMajorMicrospecies();

    // print result
    System.out.println("Major microspecies at pH=7.4: "+msmol.toFormat("smiles"));
 


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
MajorMicrospeciesPlugin()
          Constructor.
 
Method Summary
 void checkMolecule(Molecule mol)
          Checks the input molecule.
 java.lang.String getErrorMessage()
          Returns the calculation error information message if run() returned false (calculation error): hydrogen valence error.
protected  Molecule getMainMolecule(Molecule mol)
          Returns the molecule form with largest distribution.
 Molecule getMajorMicrospecies()
          Returns the major microspecies at the pH set in setpH(double).
protected  java.lang.String getMolText()
          Returns the plugin molecule text to be displayed in the viewer.
 java.lang.String getOutputClassName()
          Returns the output provider class name for the command line interface.
 double getpH()
          Returns the pH where the majority microspecies should be taken.
 Molecule getReferenceMolecule(java.lang.Object type, int index)
          Returns the molecule to be used as reference image for the given result type and index.
 java.lang.Object getResult(java.lang.Object type, int index)
          Returns the majority microsepcies if pH is different from Double.NaN, otherwise returns the input molecule itself.
 java.lang.String getResultAsString(java.lang.Object type, int index, java.lang.Object result)
          Returns the specified rsule molecule in SMILES format.
 int getResultCount(java.lang.Object type)
          Returns the number of result items: 1.
 int getResultDomain(java.lang.Object type)
          Returns the calculation domain CalculatorPlugin.MOLECULE.
 java.lang.Object[] getResultTypes()
          Returns the result types (possible types: "majority-ms").
protected  java.lang.String getSuffix()
          Returns the plugin text suffix.
protected  boolean isMajorMs()
          Returns true if major microspecies required, ie, if pH is different from Double.NaN.
 boolean run()
          Does nothing, the input molecule is already standardized and set to the majority microsepcies.
protected  void setInputMolecule(Molecule mol)
          Sets the input molecule.
 void setParameters(java.util.Properties params)
          Sets the input parameters for the plugin.
 void setpH(double pH)
          Sets the pH: majority microspecies on given pH is taken as input molecule if set to Double.NaN then the input molecule is taken as it is.
protected  void standardize(Molecule mol)
          Standardizes the molecule.
 
Methods inherited from class chemaxon.marvin.plugin.CalculatorPlugin
check, checkLicense, checkLicenseKey, checkType, create, createImageMolecule, createStandardizedMolecule, dehydrogenize, format, format, format, format, getAtomCount, getAtomIndex, getChartColor, getDoublePrecision, getGUIResultTypes, getLicenseKey, getResult, getResult, getResult, getResultAsRGB, getResultAsRGB, getResultAsString, getResultCount, getResultDomain, getResultsAsRGB, getResultsAsRGB, getResultsAsString, getResultsAsString, getTypeString, getXAxisLabel, getXLabels, getYAxisLabel, handlesMultiFragmentMolecules, isLicensed, isMajorityMsCalculation, isMsCalc, isNegligibleResult, isRgrouped, removeWhitespace, saveLicense, setDoublePrecision, setDoublePrecision, setDoublePrecision, setLicense, setMolecule, setMolecule, setMolecule, standardizeGroups, validate
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MajorMicrospeciesPlugin

public MajorMicrospeciesPlugin()
Constructor. Creates the ionizer object.

Method Detail

setParameters

public void setParameters(java.util.Properties params)
                   throws PluginException
Sets the input parameters for the plugin. The parameters and value ranges:

Specified by:
setParameters in class CalculatorPlugin
Parameters:
params - is the parameter table
Throws:
PluginException - on error

setpH

public void setpH(double pH)
Sets the pH: majority microspecies on given pH is taken as input molecule if set to Double.NaN then the input molecule is taken as it is.

Parameters:
pH - is the pH value

getpH

public double getpH()
Returns the pH where the majority microspecies should be taken. Returns Double.NaN if no microspecies calculation required.

Returns:
the pH where the majority microspecies should be taken or Double.NaN if no microspecies calculation

getMainMolecule

protected Molecule getMainMolecule(Molecule mol)
Returns the molecule form with largest distribution. Returns a microspecies with largest distribution on a given pH if getpH() returns a value different from Double.NaN, otherwise returns the input molecule itself.

Overrides:
getMainMolecule in class CalculatorPlugin
Parameters:
mol - is the input molecule
Returns:
the molecule form with largest distribution

isMajorMs

protected boolean isMajorMs()
Returns true if major microspecies required, ie, if pH is different from Double.NaN.

Overrides:
isMajorMs in class CalculatorPlugin
Returns:
true if major microspecies required

getSuffix

protected java.lang.String getSuffix()
Returns the plugin text suffix. Returns " at pH " if pH is different from Double.NaN, returns the empty string otherwise.

Overrides:
getSuffix in class CalculatorPlugin
Returns:
the plugin text suffix

getMolText

protected java.lang.String getMolText()
Returns the plugin molecule text to be displayed in the viewer. Returns "pH = " if pH is different from Double.NaN, returns null otherwise.

Overrides:
getMolText in class CalculatorPlugin
Returns:
the plugin molecule text

checkMolecule

public void checkMolecule(Molecule mol)
                   throws PluginException
Checks the input molecule. Throws exception if the molecule molecule contains R-groups.

Overrides:
checkMolecule in class CalculatorPlugin
Parameters:
mol - is the input molecule
Throws:
PluginException - with error message for the user if the molecule is refused

setInputMolecule

protected void setInputMolecule(Molecule mol)
                         throws PluginException
Sets the input molecule.

Specified by:
setInputMolecule in class CalculatorPlugin
Parameters:
mol - is the input molecule
Throws:
PluginException - on error

run

public boolean run()
            throws PluginException
Does nothing, the input molecule is already standardized and set to the majority microsepcies.

Specified by:
run in class CalculatorPlugin
Returns:
true if the calculation was successful, false on calculation error
Throws:
PluginException - on error
See Also:
CalculatorPlugin.getErrorMessage()

getErrorMessage

public java.lang.String getErrorMessage()
Returns the calculation error information message if run() returned false (calculation error): hydrogen valence error.

Overrides:
getErrorMessage in class CalculatorPlugin
Returns:
the calculation error information message

getMajorMicrospecies

public Molecule getMajorMicrospecies()
Returns the major microspecies at the pH set in setpH(double).

Returns:
the major microspecies

getReferenceMolecule

public Molecule getReferenceMolecule(java.lang.Object type,
                                     int index)
Returns the molecule to be used as reference image for the given result type and index. Returns null.

Overrides:
getReferenceMolecule in class CalculatorPlugin
Parameters:
type - is the result type
index - is the result index
Returns:
null

getResultTypes

public java.lang.Object[] getResultTypes()
Returns the result types (possible types: "majority-ms").

Specified by:
getResultTypes in class CalculatorPlugin
Returns:
the result types

getResultDomain

public int getResultDomain(java.lang.Object type)
Returns the calculation domain CalculatorPlugin.MOLECULE.

Specified by:
getResultDomain in class CalculatorPlugin
Parameters:
type - is the result type
Returns:
CalculatorPlugin.MOLECULE
See Also:
getResultTypes()

getResultCount

public int getResultCount(java.lang.Object type)
Returns the number of result items: 1.

Specified by:
getResultCount in class CalculatorPlugin
Parameters:
type - is the result type
Returns:
the number of result items
See Also:
getResultTypes()

getResult

public java.lang.Object getResult(java.lang.Object type,
                                  int index)
                           throws PluginException
Returns the majority microsepcies if pH is different from Double.NaN, otherwise returns the input molecule itself.

Specified by:
getResult in class CalculatorPlugin
Parameters:
type - is the result type ("major-ms")
index - is no used
Returns:
the result item for the specified type and index
Throws:
PluginException - if the result cannot be returned
See Also:
getResultTypes()

getResultAsString

public java.lang.String getResultAsString(java.lang.Object type,
                                          int index,
                                          java.lang.Object result)
                                   throws PluginException
Returns the specified rsule molecule in SMILES format.

Specified by:
getResultAsString in class CalculatorPlugin
Parameters:
type - is the result type
index - is the result index
result - is the result item (molecule)
Returns:
the specified result in String format
Throws:
PluginException - if an invalid result item is given

getOutputClassName

public java.lang.String getOutputClassName()
Returns the output provider class name for the command line interface.

Overrides:
getOutputClassName in class CalculatorPlugin
Returns:
the output provider class name

standardize

protected void standardize(Molecule mol)
Standardizes the molecule. Adds dehydrogenization to default standardization in case when major microsepcies calculation required.

Overrides:
standardize in class CalculatorPlugin
Parameters:
mol - is the molecule to be standardized