chemaxon.marvin.calculations
Class MajorMicrospeciesPlugin

java.lang.Object
  extended by chemaxon.marvin.plugin.CalculatorPlugin
      extended by chemaxon.marvin.calculations.MajorMicrospeciesPlugin
All Implemented Interfaces:
chemaxon.license.Licensable

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();
    mi.close();

    // 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"));
 

For concurrent plugin example applications using ChemAxon's concurrent framework, refer to the Concurrent plugin examples.

Version:
5.0 10/24/2007
Author:
Nora Mate

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
MajorMicrospeciesPlugin()
          Constructor.
 
Method Summary
 void checkMolecule(Molecule mol)
          Checks the input molecule.
protected  Molecule getDisplayMolecule()
          Returns the molecule object to be used for GUI display.
 java.lang.String getErrorMessage()
          Returns the calculation error information message or the empty string if there is no error.
 java.lang.String getIonizerErrorMessage()
          Returns the calculation error information message or the empty string if there is no error.
 Molecule getMajorMicrospecies()
          Returns the major microspecies at the pH set in setpH(double).
 Molecule getMicrospecies(int index)
          Returns the microspecies molecule.
 int getMicrospeciesCount()
          Returns the number of microspecies.
 double getpH()
          Returns the pH where the major microspecies should be taken.
 java.lang.Object getResult(java.lang.Object type, int index)
          Returns the 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 result 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.
 Molecule getResultMolecule()
          Returns the major microspecies for display.
 java.lang.Object[] getResultTypes()
          Returns the result types (possible types: "majority-ms").
 Molecule getSortedMicrospecies(int index)
          Returns the microspecies molecule, sorted by descreasing distribution at the given pH.
 double getSortedMsDistribution(int index)
          Returns the microspecies distribution, sorted by descreasing distribution at the given pH.
 boolean isLicensed()
          Returns true if the plugin is licensed.
 boolean run()
          Stores the input molecule with ungrouped sgroups.
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: major microspecies on given pH is taken as input molecule if set to Double.NaN then the input molecule is taken as it is.
 void standardize(Molecule mol)
          Standardizes the molecule.
 
Methods inherited from class chemaxon.marvin.plugin.CalculatorPlugin
checkType, containsCoordinateBond, containsMulticenterSgroup, containsPseudoAtom, containsSRUSgroup, create, createModifiedInputMolecule, createStandardizedMolecule, createStandardizedMolecule, dehydrogenize, format, format, format, format, getAtomCount, getAtomIndex, getCalcMolecule, getDocument, getDoublePrecision, getInputMolDim, getMainMolecule, getPluginResource, getRemark, getResult, getResult, getResult, getResultAsRGB, getResultAsRGB, getResultAsString, getResultCount, getResultDomain, getResultMessage, getResultMolecules, getResultsAsRGB, getResultsAsRGB, getResultsAsString, getResultsAsString, getResultSource, getTypeString, getWarningMessage, handlesMultiFragmentMolecules, isInputMoleculeAromatized, isMsCalc, isMultiThreadedRunEnabled, isNegligibleResult, isOK, isRgrouped, loadClass, readAttribute, removeWhitespace, setDoublePrecision, setDoublePrecision, setDoublePrecision, setLicenseEnvironment, setMolecule, setMolecule, setMolecule, setProgressMonitor, standardizeIonicGroups, standardizeNeutralGroups
 
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

isLicensed

public boolean isLicensed()
Description copied from class: CalculatorPlugin
Returns true if the plugin is licensed. Implement this only if you want to sell your plugin and protect it with a license key. The default implementation always returns true which means that the plugin is free: no license key is required. This method returns only information about the licensing, license checking has to be implemented separately.

Specified by:
isLicensed in interface chemaxon.license.Licensable
Overrides:
isLicensed in class CalculatorPlugin
Returns:
true if the plugin is licensed

setParameters

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

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

setpH

public void setpH(double pH)
Sets the pH: major 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 major microspecies should be taken. Returns Double.NaN if no microspecies calculation required.

Overrides:
getpH in class CalculatorPlugin
Returns:
the pH where the major microspecies should be taken or Double.NaN if no microspecies calculation

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
Stores the input molecule with ungrouped sgroups.

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()

getMajorMicrospecies

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

Returns:
the major microspecies
Throws:
PluginException - if run() has not been called beforehand

getMicrospeciesCount

public int getMicrospeciesCount()
                         throws PluginException
Returns the number of microspecies.

Returns:
the number of microspecies
Throws:
PluginException - on error

getMicrospecies

public Molecule getMicrospecies(int index)
                         throws PluginException
Returns the microspecies molecule.

Parameters:
index - is the microspecies index
Returns:
the microspecies molecule
Throws:
PluginException - on error

getSortedMicrospecies

public Molecule getSortedMicrospecies(int index)
                               throws PluginException
Returns the microspecies molecule, sorted by descreasing distribution at the given pH.

Parameters:
index - is the microspecies index
Returns:
the microspecies molecule
Throws:
PluginException - on error

getSortedMsDistribution

public double getSortedMsDistribution(int index)
                               throws PluginException
Returns the microspecies distribution, sorted by descreasing distribution at the given pH.

Parameters:
index - is the microspecies index
Returns:
the microspecies distribution
Throws:
PluginException - on error

getResultTypes

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

Overrides:
getResultTypes in class CalculatorPlugin
Returns:
the result types

getResultDomain

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

Overrides:
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.

Overrides:
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 microsepcies if pH is different from Double.NaN, otherwise returns the input molecule itself.

Overrides:
getResult in class CalculatorPlugin
Parameters:
type - is the result type ("major-ms", "ms", "ms-count" or "ms-distr")
index - is the microspecies index
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 result molecule in SMILES format.

Overrides:
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

getDisplayMolecule

protected Molecule getDisplayMolecule()
                               throws PluginException
Returns the molecule object to be used for GUI display. This is the major microspecies returned by getMajorMicrospecies().

Overrides:
getDisplayMolecule in class CalculatorPlugin
Returns:
the molecule object to be used for GUI display
Throws:
PluginException - on error

getResultMolecule

public Molecule getResultMolecule()
                           throws PluginException
Returns the major microspecies for display.

Overrides:
getResultMolecule in class CalculatorPlugin
Returns:
the major microspecies
Throws:
PluginException - on error
Since:
Marvin 4.0

getErrorMessage

public java.lang.String getErrorMessage()
Returns the calculation error information message or the empty string if there is no error.

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

getIonizerErrorMessage

public java.lang.String getIonizerErrorMessage()
Returns the calculation error information message or the empty string if there is no error.

Returns:
the calculation error information message

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

standardize

public 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