|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object chemaxon.marvin.plugin.CalculatorPlugin chemaxon.marvin.calculations.pKaPlugin
Plugin class for macro/micro pKa calculation.
Example API usage:
// instantiate and validate plugin pKaPlugin plugin = new pKaPlugin(); plugin.validate(<pKa license>); // set parameters Properties params = new Properties(); params.put("ions", "6"); params.put("min", "-10"); params.put("max", "20"); plugin.setParameters(params); MolImporter importer = new MolImporter( new BufferedInputStream( new FileInputStream("molecule.mol"))); Molecule mol = null; while ((mol = importer.read()) != null) { // set molecule and run calculation plugin.setMolecule(mol); plugin.run(); // get the 3 strongest ACIDIC pKa values double[] acidic_pka = new double[3]; int[] acidic_indices = new int[3]; plugin.getSortedValues(pKaPlugin.ACIDIC, acidic_pka, acidic_indices); // get the 3 strongest BASIC pKa values double[] basic_pka = new double[3]; int[] basic_indices = new int[3]; plugin.getSortedValues(pKaPlugin.BASIC, basic_pka, basic_indices); // get and print pKa values for each atom int count = mol.getAtomCount(); for (int i=0; i < count; ++i) { // get ACIDIC and BASIC pKa values double apka = plugin.getpKa(i, pKaPlugin.ACIDIC); double bpka = plugin.getpKa(i, pKaPlugin.BASIC); } } importer.close();
Field Summary | |
static int |
ACIDIC
Constant denoting acidic pKa. |
static int |
BASIC
Constant denoting basic pKa. |
static int |
BLUE
Constant storing the blue rgb value (the basic pKa result color). |
static int |
DEF_MAXIONS
The default value of the number of ionizable atoms to consider. |
static double |
EPSILON
The microspecies is ignored if its distribution is less than EPSILON for all pH values. |
static int |
RED
Constant storing the red rgb value (the acidic pKa result color). |
static java.lang.String |
TYPE_DISTR
Type constant for microspecies distribution. |
Fields inherited from class chemaxon.marvin.plugin.CalculatorPlugin |
ATOM, CHART, MOLECULE, NAN, SUBRESULT |
Constructor Summary | |
pKaPlugin()
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): the number of ionizable atoms
exceeds the specified limit (given in the "ions" parameter). |
protected java.lang.String |
getLicenseKey()
Returns the built-in license key for the given plugin class. |
int |
getMsCount()
Returns the number of microspecies. |
double[] |
getMsDistribution(int msIndex)
Returns the microspecies distribution array. |
Molecule |
getMsMolecule(int msIndex)
Returns the microspecies molecule. |
java.lang.String |
getOutputClassName()
Returns the output provider class name for the command line interface. |
double[] |
getpHs()
Returns the pH array. |
double |
getpKa(int index,
int type)
Returns the pKa value for the given atom index and pKa type. |
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 result item for the specified key and index. |
java.lang.Object |
getResult(java.lang.Object type,
java.lang.String arg)
Returns the result item for the specified type ("acidic" or "basic") and the specified strongness index ("1" means the strongest value, "2" means the second strongest value, etc.) given in the argument string. |
int |
getResultAsRGB(java.lang.Object type,
int index,
java.lang.Object result)
Returns the specified result color as int format (alpha<<24 + red<<16 + green<<8 + blue): RED for acidic pKa, BLUE for basic pKa. |
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 . |
long |
getResultsAsRGB(java.lang.Object type,
int index,
java.lang.Object result)
Returns the specified result color(s) as int format (alpha<<24 + red<<16 + green<<8 + blue). |
java.lang.String |
getResultsAsString(java.lang.Object type,
int index,
java.lang.Object result)
Returns the specified result with possible subresults (both pKa values instead of the most significant pKa) in String format. |
java.lang.Object[] |
getResultTypes()
Returns the result types (possible types: pKa, acidic, basic). |
void |
getSortedValues(int pkatype,
double[] values,
int[] indices)
Calculates the least acidic pKa values in ascending order or the biggest basic pKa values in descending order. |
java.lang.String |
getXAxisLabel(java.lang.Object type)
Returns the X axis label to be displayed in case of chart data. |
java.lang.String[] |
getXLabels()
Returns the X label array (pH array as String[]). |
java.lang.String |
getYAxisLabel(java.lang.Object type)
Returns the Y axis label to be displayed. |
boolean |
isNegligibleResult(java.lang.Object type,
int index,
java.lang.Object result)
Returns whether the result can be ignored. |
boolean |
run()
Runs the macro pKa calculation. |
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)
Standardizes the molecule. |
Methods inherited from class chemaxon.marvin.plugin.CalculatorPlugin |
check, checkLicense, checkLicenseKey, create, createStandardizedMolecule, dehydrogenize, format, format, format, format, getAtomCount, getAtomIndex, getDoublePrecision, getResult, getResult, getResultAsRGB, getResultAsString, getResultCount, getResultDomain, getResultsAsRGB, getResultsAsString, getTypeString, handlesMultiFragmentMolecules, isLicensed, isRgrouped, setDoublePrecision, setDoublePrecision, setLicense, setMolecule, setMolecule, standardizeNitro, validate |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static final int ACIDIC
public static final int BASIC
public static final int RED
public static final int BLUE
public static final java.lang.String TYPE_DISTR
public static final int DEF_MAXIONS
public static final double EPSILON
Constructor Detail |
public pKaPlugin()
Method Detail |
protected final java.lang.String getLicenseKey()
getLicenseKey
in class CalculatorPlugin
CalculatorPlugin.checkLicense()
public void setParameters(java.util.Properties params) throws PluginException
mode
is "macro" then we have additional parameters
for microspecies distribution:
setParameters
in class CalculatorPlugin
params
- is the parameter table
PluginException
- on errorpublic void checkMolecule(Molecule mol) throws PluginException
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 boolean run() throws PluginException
run
in class CalculatorPlugin
PluginException
- on errorCalculatorPlugin.getErrorMessage()
public int getMsCount()
public Molecule getMsMolecule(int msIndex)
msIndex
- is the microspecies index
public double[] getpHs()
public double[] getMsDistribution(int msIndex)
msIndex
- is the microspecies index
public double getpKa(int index, int type)
run()
.
index
- is the atom indextype
- is the pka type: ACIDIC
or BASIC
Double.NaN
if there is
no pKa value for the given atom index and pKa typepublic java.lang.String getErrorMessage()
run()
returned false (calculation error): the number of ionizable atoms
exceeds the specified limit (given in the "ions" parameter).
getErrorMessage
in class CalculatorPlugin
public java.lang.Object[] getResultTypes()
getResultTypes
in class CalculatorPlugin
public int getResultDomain(java.lang.Object type)
CalculatorPlugin.ATOM
or
CalculatorPlugin.MOLECULE
.
pKa always returns CalculatorPlugin.ATOM
.
getResultDomain
in class CalculatorPlugin
type
- is the result type
CalculatorPlugin.ATOM
getResultTypes()
public int getResultCount(java.lang.Object type)
getResultCount
in class CalculatorPlugin
type
- is the result type
getResultTypes()
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 returnedgetResultTypes()
public java.lang.Object getResult(java.lang.Object type, java.lang.String arg) throws PluginException
Double.NaN
for non-existent values
(e.g. when the type is "acidic" and the arg string is "2" but there is
only one acidic pKa value for the input molecule).
getResult
in class CalculatorPlugin
type
- is the result type ("acidic" or "basic")arg
- is the strongness order index
PluginException
- if the result cannot be returnedCalculatorPlugin.getResultTypes()
public void getSortedValues(int pkatype, double[] values, int[] indices) throws PluginException
run()
.
The length of the result value array determines the number of pKa values
to be computed. If the index array is non-null then it is assumed
to have the same length as the value array and will be filled with the
corresponding atom indices (0-based).
pkatype
- is the pKa type (ACIDIC
or BASIC
)values
- is the pKa value array to be filled with pKa values in
ascending strongness order (increasing for acidic pKa,
descending for basic pKa values), the last entries are
set to Double.NaN
if there are less
pKa values than the array lengthindices
- is the corresponding atom index array to be filled (may be null),
the index is set to -1
for non-existent values
(Double.NaN
)
PluginException
- if an error occurs during the calculationpublic java.lang.String getResultAsString(java.lang.Object type, int index, java.lang.Object result) throws PluginException
Double.NaN
then returns the empty string.
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 java.lang.String getResultsAsString(java.lang.Object type, int index, java.lang.Object result) throws PluginException
getResultsAsString
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 getResultAsRGB(java.lang.Object type, int index, java.lang.Object result) throws PluginException
getResultAsRGB
in class CalculatorPlugin
type
- is the result typeindex
- is the result indexresult
- is the result item
PluginException
- if an invalid result item is givenpublic long getResultsAsRGB(java.lang.Object type, int index, java.lang.Object result) throws PluginException
getResultsAsRGB
in class CalculatorPlugin
type
- is the result typeindex
- is the result indexresult
- is the result item
PluginException
- if an invalid result item is givenpublic Molecule getReferenceMolecule(java.lang.Object type, int index)
getReferenceMolecule
in class CalculatorPlugin
type
- is the result typeindex
- is the result index
public boolean isNegligibleResult(java.lang.Object type, int index, java.lang.Object result) throws PluginException
true
for microspecies distributions below EPSILON
.
Returns false
for all other results.
isNegligibleResult
in class CalculatorPlugin
type
- is the result typeindex
- is the result indexresult
- is the result object
EPSILON
PluginException
public java.lang.String[] getXLabels()
getXLabels
in class CalculatorPlugin
public java.lang.String getXAxisLabel(java.lang.Object type)
getXAxisLabel
in class CalculatorPlugin
type
- is the result typepublic java.lang.String getYAxisLabel(java.lang.Object type)
getYAxisLabel
in class CalculatorPlugin
type
- is the result typepublic java.lang.String getOutputClassName()
getOutputClassName
in class CalculatorPlugin
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 |