public class MajorMicrospeciesPlugin extends CalculatorPlugin
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.
CalculatorPlugin.HydrogenData
ATOM, BLUE, CALCRGB_OFF, COVALENT_HYDRATION_ERROR_REMARK, CRITICAL_ERROR_MSG, EPSILON, explicitHydrogens, INCORRECT_AROMATIC_NITROGEN_REMARK, INSTABLE_TAUTOMERIC_FORM_REMARK, KEEP_HYDROGENS, keepHydrogens, licenseEnvironment, MOLECULE, MOLECULES, NAN, PLUGIN_CLASS_KEY, PLUGIN_DIR, RED, TRUE
Constructor and Description |
---|
MajorMicrospeciesPlugin()
Constructor.
|
Modifier and Type | Method and Description |
---|---|
void |
checkMolecule(Molecule mol)
Checks the input molecule.
|
protected Molecule |
createModifiedInputMolecule(Molecule mol)
Returns the major tautomeric form of the molecule.
|
protected Molecule |
getDisplayMolecule()
Returns the molecule object to be used for GUI display.
|
String |
getErrorMessage()
Returns the calculation error information message
or the empty string if there is no error.
|
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.
|
String |
getProductName()
Returns the product identifier of the plugin as given by
LicenseManager . |
Object |
getResult(Object type,
int index)
Returns the microsepcies if pH is different from
Double.NaN , otherwise returns the input molecule itself. |
String |
getResultAsString(Object type,
int index,
Object result)
Returns the specified result molecule in SMILES format.
|
int |
getResultCount(Object type)
Returns the number of result items:
1 . |
int |
getResultDomain(Object type)
Returns the calculation domain
CalculatorPlugin.MOLECULE . |
Molecule |
getResultMolecule()
Returns the major microspecies for display.
|
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 |
run()
Stores the input molecule with ungrouped sgroups.
|
protected void |
setInputMolecule(Molecule mol)
Sets the input molecule.
|
void |
setKeepExplicitHydrogens(boolean keepExplicitHydrogens)
Sets if result molecule keeps explicit hydrogens or not
|
Molecule |
setMolecule(Molecule mol,
boolean st,
boolean om)
Sets the input molecule after an optional standardization and/or modification.
|
void |
setParameters(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 |
setTakeMajorTatomericForm(boolean takeMajorTautomericForm)
Sets to use major tautomeric form in calculation.
|
void |
standardize(Molecule mol)
Standardizes the molecule.
|
arrangeHydrogenIncerments, canRepeat, checkLicense, checkType, containsCoordinateBond, containsMulticenterSgroup, containsPseudoAtom, containsSRUSgroup, create, createStandardizedMolecule, createStandardizedMolecule, dehydrogenize, format, format, format, format, getAtomCount, getAtomIndex, getAtomIndexMap, getCalcMolecule, getDocument, getDoublePrecision, getExplicitHydrogenData, getInputMolDim, getMainMolecule, getOriginalMolecule, getPluginResource, getQueryMoleculeErrorMessage, getRemark, getResult, getResult, getResult, getResultAsRGB, getResultAsRGB, getResultAsString, getResultCount, getResultDomain, getResultMessage, getResultMolecules, getResultsAsRGB, getResultsAsRGB, getResultsAsString, getResultsAsString, getResultSource, getTypeString, getWarningMessage, handlesMultiFragmentMolecules, isInputMoleculeAromatized, isLicensed, isMsCalc, isMultiThreadedRunEnabled, isNegligibleResult, isOK, isRgrouped, loadClass, readAttribute, removeWhitespace, restoreExplicitHydrogens, setAtomIndexMap, setDoublePrecision, setDoublePrecision, setDoublePrecision, setKeepHydrogens, setLicenseEnvironment, setMolecule, setMolecule, setMolecule, setProgressMonitor, standardizeIonicGroups, standardizeNeutralGroups
public MajorMicrospeciesPlugin()
public Molecule setMolecule(Molecule mol, boolean st, boolean om) throws PluginException
CalculatorPlugin
setMolecule
in class CalculatorPlugin
mol
- is the input moleculest
- is true if standardization is requiredom
- is true if original input molecule is to be used for atom indexing
false if modified molecule is to be used for atom indexingPluginException
- on errorCalculatorPlugin.setInputMolecule(Molecule)
,
CalculatorPlugin.createStandardizedMolecule(Molecule)
,
CalculatorPlugin.createModifiedInputMolecule(Molecule)
public String getProductName()
LicenseManager
.getProductName
in class CalculatorPlugin
LicenseManager.PROTONATION_PLUGIN_GROUP
public void setParameters(Properties params) throws PluginException
setParameters
in class CalculatorPlugin
params
- is the parameter tablePluginException
- on errorpublic void setpH(double pH)
Double.NaN
then the input molecule is taken as it is.pH
- is the pH valuepublic double getpH()
Double.NaN
if no microspecies calculation required.getpH
in class CalculatorPlugin
Double.NaN
if no microspecies calculationprotected void setInputMolecule(Molecule mol) throws PluginException
setInputMolecule
in class CalculatorPlugin
mol
- is the input moleculePluginException
- on errorpublic void setTakeMajorTatomericForm(boolean takeMajorTautomericForm)
false
.takeMajorTautomericForm
- the calculation will be performed on the major
tutomeric form of the input molecule if set (true
)protected final Molecule createModifiedInputMolecule(Molecule mol) throws PluginException
createModifiedInputMolecule
in class CalculatorPlugin
mol
- is the input moleculePluginException
- on errorpublic boolean run() throws PluginException
run
in class CalculatorPlugin
PluginException
- on errorCalculatorPlugin.getErrorMessage()
public Molecule getMajorMicrospecies() throws PluginException
setpH(double)
.PluginException
- if run()
has not been called beforehandpublic int getMicrospeciesCount() throws PluginException
PluginException
- on errorpublic Molecule getMicrospecies(int index) throws PluginException
index
- is the microspecies indexPluginException
- on errorpublic Molecule getSortedMicrospecies(int index) throws PluginException
index
- is the microspecies indexPluginException
- on errorpublic double getSortedMsDistribution(int index) throws PluginException
index
- is the microspecies indexPluginException
- on errorpublic Object[] getResultTypes()
getResultTypes
in class CalculatorPlugin
public int getResultDomain(Object type)
CalculatorPlugin.MOLECULE
.getResultDomain
in class CalculatorPlugin
type
- is the result typeCalculatorPlugin.MOLECULE
getResultTypes()
public int getResultCount(Object type)
1
.getResultCount
in class CalculatorPlugin
type
- is the result typegetResultTypes()
public Object getResult(Object type, int index) throws PluginException
Double.NaN
, otherwise returns the input molecule itself.getResult
in class CalculatorPlugin
type
- is the result type ("major-ms", "ms", "ms-count" or "ms-distr")index
- is the microspecies indexPluginException
- if the result cannot be returnedgetResultTypes()
public String getResultAsString(Object type, int index, Object result) throws PluginException
getResultAsString
in class CalculatorPlugin
type
- is the result typeindex
- is the result indexresult
- is the result item (molecule)PluginException
- if an invalid result item is givenprotected Molecule getDisplayMolecule() throws PluginException
getMajorMicrospecies()
.getDisplayMolecule
in class CalculatorPlugin
PluginException
- on errorpublic Molecule getResultMolecule() throws PluginException
getResultMolecule
in class CalculatorPlugin
PluginException
- on errorpublic String getErrorMessage()
getErrorMessage
in class CalculatorPlugin
public String getIonizerErrorMessage()
public void checkMolecule(Molecule mol) throws PluginException
checkMolecule
in class CalculatorPlugin
mol
- is the input moleculePluginException
- with error message for the user if the molecule is refusedpublic void standardize(Molecule mol)
standardize
in class CalculatorPlugin
mol
- is the molecule to be standardizedpublic void setKeepExplicitHydrogens(boolean keepExplicitHydrogens)
keepExplicitHydrogens
- if the result should keep explicit hydrogens or not