|
|||||||||
| 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.pKaPlugin
public class pKaPlugin
Plugin class for macro/micro pKa calculation.
API usage example:
// instantiate plugin
pKaPlugin plugin = new pKaPlugin();
// set parameters
plugin.setMaxIons(6);
plugin.setBasicpKaLowerLimit(-5.0);
plugin.setAcidicpKaUpperLimit(25.0);
plugin.setpHLower(3.0); // for ms distr
plugin.setpHUpper(6.0); // for ms distr
plugin.setpHStep(1.0); // for ms distr
MolImporter importer = new MolImporter("mols.sdf");
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[] acidicpKa = new double[3];
int[] acidicIndexes = new int[3];
plugin.getMacropKaValues(pKaPlugin.ACIDIC, acidicpKa, acidicIndexes);
// get the 3 strongest BASIC pKa values
double[] basicpKa = new double[3];
int[] basicIndexes = new int[3];
plugin.getMacropKaValues(pKaPlugin.BASIC, basicpKa, basicIndexes);
// get 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);
}
// get microspecies distributions
double[] pHs = plugin.getpHs(); // pH values
int mscount = plugin.getMsCount();
for (int i=0; i < mscount; ++i) {
Molecule ms = plugin.getMsMolecule(i);
double[] distr = plugin.getMsDistribution(i); // distr values for pHs
}
}
importer.close();
Another example showing microspecies distributions at a single pH value:
// instantiate plugin
pKaPlugin plugin = new pKaPlugin();
// set pH
plugin.setpH(3.0);
MolImporter importer = new MolImporter("mols.sdf");
Molecule mol = null;
while ((mol = importer.read()) != null) {
// set molecule and run calculation
plugin.setMolecule(mol);
plugin.run();
// get microspecies data (molecule and distribution)
int count = plugin.getMsCount();
for (int i=0; i < count; ++i) {
Molecule ms = plugin.getMsMolecule(i);
double distr = plugin.getSingleMsDistribution(i);
}
}
importer.close();
Another example showing macro pKa calculation:
// instantiate plugin
pKaPlugin plugin = new pKaPlugin();
MolImporter importer = new MolImporter("mols.sdf");
Molecule mol = null;
while ((mol = importer.read()) != null) {
// set molecule and run calculation
plugin.setMolecule(mol);
plugin.run();
// get the acidic and basic macro pKa values
double[] acidicpKaValues = plugin.getMacropKaValues(pKaPlugin.ACIDIC);
double[] basicpKaValues = plugin.getMacropKaValues(pKaPlugin.BASIC);
}
importer.close();
For concurrent plugin example applications using ChemAxon's concurrent framework, refer to the Concurrent plugin examples.
| Field Summary | |
|---|---|
static int |
ACIDIC
Constant denoting acidic pKa. |
static int |
BASIC
Constant denoting basic pKa. |
static int |
DEF_MAXIONS
The default value of the number of ionizable atoms to consider. |
static double |
DEF_TEMPERATURE
The default temperature in Kelvins. |
static int |
DYNAMICpKaPREFIX
pKa's prefix (acidic/basic) does depend on the submitted micro state |
static int |
MODEL_LARGE
Calculation model: large (always precise, can take more time). |
static int |
MODEL_SMALL
Calculation model: small (precise up to the specified number of ionizable atoms). |
static int |
STATICpKaPREFIX
pKa's prefix (acidic/basic) does not depend on the submitted micro state (default) |
static java.lang.String |
TYPE_DISTR
Type constant for microspecies distribution. |
| 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, MOLECULES, NAN, PLUGIN_CLASS_KEY, PLUGIN_DIR, RED |
| Constructor Summary | |
|---|---|
pKaPlugin()
Constructor. |
|
| Method Summary | |
|---|---|
void |
checkMolecule(Molecule mol)
Checks the input molecule. |
protected Molecule |
createModifiedInputMolecule(Molecule mol)
Returns the canonical tautomeric form of the molecule. |
static java.lang.String[] |
getCorrectionLibraryIds()
Returns the id's of available pKa correction libraries. |
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) or
hydrogen valence error. |
double[] |
getMacropKaValues(int pkatype)
Calculates the acidic pKa values in ascending order or the basic pKa values in descending order. |
void |
getMacropKaValues(int pkatype,
double[] values,
int[] indexes)
Calculates the least acidic pKa values in ascending order or the biggest basic pKa values in descending order. |
int |
getMacroSpeciesCharge(int msIndex)
Returns the formal charges of a given macrospecies. |
int |
getMsCount()
Returns the number of microspecies. |
double[] |
getMsDistribution(int msIndex)
Returns the microspecies distribution array. |
double[][] |
getMsDistributions()
Returns the microspecies distribution arrays for all microspecies: the i-th element is the disrtibution array of the i-th microspecies. |
Molecule |
getMsMolecule(int msIndex)
Returns the microspecies molecule. |
double[] |
getpHs()
Returns the pH array. |
double |
getpKa(int index)
Returns the most significant pKa value for the given atom index. |
double |
getpKa(int index,
int type)
Deprecated. Use getpKaValues(int, int) |
int |
getpKaPrefixType()
Returns the pKa prefix type. |
int |
getpKaType(int index)
Returns the pKa type: ACIDIC, BASIC or 0
if there is no pKa value for the given atom. |
double[] |
getpKaValues(int index,
int type)
Returns the pKa values for the given atom index and pKa type. |
java.lang.String |
getProductName()
Returns the product identifier of the plugin as given by LicenseManager. |
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. |
Molecule |
getResultMolecule()
Returns the result molecule for display. |
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, msdistr). |
double |
getSingleMsDistribution(int msIndex)
Returns the microspecies distribution at the specified pH value set in setpH(double). |
void |
getSortedValues(int pkatype,
double[] values,
int[] indexes)
Deprecated. Use getMacropKaValues(int,double[],int[]) instead |
java.lang.String |
getWarningMessage()
Returns the calculation warning information message. |
protected boolean |
isMsCalc()
Returns true if microspecies calculation. |
protected boolean |
isNegligible(double[] distr)
|
boolean |
isNegligibleResult(java.lang.Object type,
int index,
java.lang.Object result)
Returns whether the result can be ignored. |
boolean |
isOverflowCalculation()
Returns true if overflow calculation:
maximum number of ionizable atoms exceeded and protein ionization invoked. |
boolean |
run()
Runs the macro pKa calculation. |
void |
setAcidicpKaUpperLimit(double maxA)
Sets the maximum acidic pKa (default: 20). |
void |
setBasicpKaLowerLimit(double minB)
Sets the minimum basic pKa (default: -10). |
void |
setCalcAlways(boolean calcAlways)
Deprecated. replaced by setModel(int) |
void |
setConsiderTautomerization(boolean considerTautomerization)
Sets to consider tautomerization. |
void |
setCorrectionLibrary(java.lang.String correctionLibraryId)
Sets the correction library. |
protected void |
setInputMolecule(Molecule mol)
Sets the input molecule. |
void |
setMaxIons(int n)
In case of MODEL_SMALL model, it
sets the maximum number of ionizable atoms to be considered
and uses simple calculation method to compute pKa values. |
void |
setMicropKaCalc(boolean micro)
Sets micro pKa calculation. |
void |
setModel(int model)
Sets the calculation model. |
void |
setMsCalc(boolean mscalc)
Sets calculation of microspecies distributions. |
void |
setParameters(java.util.Properties params)
Sets the input parameters for the plugin. |
void |
setpH(double pH)
Sets the pH value for the calculation of microspecies distributions. |
void |
setpHLower(double lower)
Sets pH lower limit for the calculation of microspecies distributions. |
void |
setpHStep(double step)
Sets pH step for the calculation of microspecies distributions. |
void |
setpHUpper(double upper)
Sets pH upper limit for the calculation of microspecies distributions. |
void |
setpKaPrefixType(int pKaPtype)
Sets pKa prefix type (default: STATICpKaPREFIX)
STATIC pKa prefix: pKa's prefix does not depend on the submitted micro state
DYNAMIC pKa prefix: pKa's prefix does depend on the submitted micro state
|
void |
setProgressMonitor(chemaxon.common.util.MProgressMonitor pmon)
Sets a progress observer to be used in run() to display progress status. |
void |
setTakeMajorTatomericForm(boolean takeMajorTautomericForm)
Deprecated. Use setConsiderTautomerization(boolean) |
void |
setTemperature(double temperature)
Sets the temperature (default: 298 Kelvin). |
void |
standardize(Molecule mol)
Standardizes the molecule. |
void |
useCorrectionLibrary(boolean use)
Deprecated. Use setCorrectionLibrary(String) |
| 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 java.lang.String TYPE_DISTR
public static final int STATICpKaPREFIX
public static final int DYNAMICpKaPREFIX
public static final int DEF_MAXIONS
public static final double DEF_TEMPERATURE
public static final int MODEL_SMALL
public static final int MODEL_LARGE
| Constructor Detail |
|---|
public pKaPlugin()
| Method Detail |
|---|
public java.lang.String getProductName()
LicenseManager.
getProductName in class CalculatorPluginLicenseManager.PROTONATION_PLUGIN_GROUPpublic void setProgressMonitor(chemaxon.common.util.MProgressMonitor pmon)
run() to display progress status.
Short calculations may ignore the observer object.
The default implementation does nothing.
setProgressMonitor in class CalculatorPluginpmon - is the progress monitor, may be null
public void setParameters(java.util.Properties params)
throws PluginException
0-8 or inf (default: 2)
(number of displayed fractional digits, inf for unrounded value)
298)
8)
8 by default), equivalent to calcAlways=false
(cxcalc and API default)
calcAlways=true
(GUI default)
mode is "macro" then we have additional parameters
for microspecies distribution:
setParameters in class CalculatorPluginparams - is the parameter table
PluginException - on errorpublic void useCorrectionLibrary(boolean use)
setCorrectionLibrary(String)
false)
use - if true, then the calculation will use the correction librarypublic void setCorrectionLibrary(java.lang.String correctionLibraryId)
correctionLibraryId - is the correction library identifierpublic static java.lang.String[] getCorrectionLibraryIds()
public void setMicropKaCalc(boolean micro)
false (macro pKa calculation).
micro - is true if micro pKa calculation is required.public void setCalcAlways(boolean calcAlways)
setModel(int)
true, pKa values are
calculated with a different, more time-consuming method in this case.
Note, that microspecies are not determined in this case.
Default: false.
calcAlways - is true if calculation should be performed
if the maximum number of ionizable atoms is exceededsetMaxIons(int),
setModel(int)public void setModel(int model)
model - is the calculation model:
MODEL_SMALL:
optimized for a small number of ionizable atoms (default)
MODEL_LARGE:
optimized for a large number of ionizable atoms
setMaxIons(int)public void setMaxIons(int n)
MODEL_SMALL model, it
sets the maximum number of ionizable atoms to be considered
and uses simple calculation method to compute pKa values.
In case of MODEL_LARGE model, it
switches the simple calculation method to a more complicated one
when the number of ionizable atoms exceeds this limit.
The default value is 8.
n - is the maximum number of ionizable atoms to be consideredsetModel(int)public void setBasicpKaLowerLimit(double minB)
-10).
minB - is the minimum basic pKapublic void setAcidicpKaUpperLimit(double maxA)
20).
maxA - is the maximum acidic pKapublic void setTemperature(double temperature)
298 Kelvin).
temperature - is the temperature (Kelvin)public void setpHLower(double lower)
0.0.
lower - is the pH lower limitpublic void setpHUpper(double upper)
14.0.
upper - is the pH upper limitpublic void setpHStep(double step)
1.0.
step - is the pH steppublic void setpH(double pH)
pH - is the pH valuepublic void setMsCalc(boolean mscalc)
[0.0, 14.0]
pH interval with pH step size 1.0.
mscalc - is true if calculation of microspecies distributions is requiredsetpHLower(double lower),
setpHUpper(double upper),
setpHStep(double step),
setpH(double pH)protected boolean isMsCalc()
true if microspecies calculation.
isMsCalc in class CalculatorPlugintrue if microspecies calculationpublic void setpKaPrefixType(int pKaPtype)
STATICpKaPREFIX)
pKaPtype - may have two values: STATICpKaPREFIX or
DYNAMICpKaPREFIXpublic int getpKaPrefixType()
STATICpKaPREFIX: pKa's prefix does not depend on the submitted micro state
DYNAMICpKaPREFIX: pKa's prefix does depend on the submitted micro state
public void setConsiderTautomerization(boolean considerTautomerization)
false.
considerTautomerization - the calculation will consider tautomerization and resonance if set (true)public void setTakeMajorTatomericForm(boolean takeMajorTautomericForm)
setConsiderTautomerization(boolean)
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 CalculatorPluginmol - is the input molecule
PluginException - on error
public void checkMolecule(Molecule mol)
throws PluginException
checkMolecule in class CalculatorPluginmol - is the input molecule
PluginException - with error message for the user if the molecule is refused
protected void setInputMolecule(Molecule mol)
throws PluginException
setInputMolecule in class CalculatorPluginmol - is the input molecule
PluginException - on error
public boolean run()
throws PluginException
run in class CalculatorPluginPluginException - on errorCalculatorPlugin.getErrorMessage()public int getMsCount()
public Molecule getMsMolecule(int msIndex)
msIndex - is the microspecies index
public double getSingleMsDistribution(int msIndex)
setpH(double).
msIndex - is the microspecies index
public double[] getpHs()
public double[] getMsDistribution(int msIndex)
msIndex - is the microspecies index
public double[][] getMsDistributions()
public double getpKa(int index)
STATICpKaPREFIX prefix type is set. The pKa
calculation has to be run beforehand by calling run().
index - is the atom index
Double.NaN if there is
no pKa value for the given atom index and pKa typesetpKaPrefixType(int),
getpKaValues(int, int)
public double getpKa(int index,
int type)
getpKaValues(int, int)
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 typesetpKaPrefixType(int),
getpKaValues(int, int)
public double[] getpKaValues(int index,
int type)
run().
index - is the atom indextype - is the pka type: ACIDIC or BASIC
null if there is
no pKa value for the given atom index and pKa typesetpKaPrefixType(int)public int getpKaType(int index)
ACIDIC, BASIC or 0
if there is no pKa value for the given atom.
index - is the atom index
ACIDIC, BASIC or 0.public int getMacroSpeciesCharge(int msIndex)
msIndex - is the macrospecies index
isOverflowCalculation()public boolean isOverflowCalculation()
true if overflow calculation:
maximum number of ionizable atoms exceeded and protein ionization invoked.
true if overflow calculationpublic java.lang.String getErrorMessage()
run()
returned false (calculation error): the number of ionizable atoms
exceeds the specified limit (given in the "ions" parameter) or
hydrogen valence error.
getErrorMessage in class CalculatorPluginpublic java.lang.String getWarningMessage()
getWarningMessage in class CalculatorPluginpublic java.lang.Object[] getResultTypes()
getResultTypes in class CalculatorPluginpublic int getResultDomain(java.lang.Object type)
CalculatorPlugin.ATOM or
CalculatorPlugin.MOLECULE.
pKa always returns CalculatorPlugin.ATOM.
getResultDomain in class CalculatorPlugintype - is the result type
CalculatorPlugin.ATOMgetResultTypes()public int getResultCount(java.lang.Object type)
getResultCount in class CalculatorPlugintype - is the result type
getResultTypes()
public java.lang.Object getResult(java.lang.Object type,
int index)
throws PluginException
getResult in class CalculatorPlugintype - 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 CalculatorPlugintype - 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[] indexes)
throws PluginException
getMacropKaValues(int,double[],int[]) instead
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
descending 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 lengthindexes - 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 calculation
public void getMacropKaValues(int pkatype,
double[] values,
int[] indexes)
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
descending 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 lengthindexes - 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 calculation
public double[] getMacropKaValues(int pkatype)
throws PluginException
run().
pkatype - is the pKa type (ACIDIC or BASIC)
null if there are no ionizable atoms in the molecule
PluginException - if an error occurs during the calculation
public 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 CalculatorPlugintype - is the result typeindex - is the result indexresult - is the result item
PluginException - if an invalid result item is given
public java.lang.String getResultsAsString(java.lang.Object type,
int index,
java.lang.Object result)
throws PluginException
getResultsAsString in class CalculatorPlugintype - is the result typeindex - is the result indexresult - is the result item
PluginException - if an invalid result item is given
public int getResultAsRGB(java.lang.Object type,
int index,
java.lang.Object result)
throws PluginException
getResultAsRGB in class CalculatorPlugintype - is the result typeindex - is the result indexresult - is the result item
PluginException - if an invalid result item is given
public long getResultsAsRGB(java.lang.Object type,
int index,
java.lang.Object result)
throws PluginException
getResultsAsRGB in class CalculatorPlugintype - is the result typeindex - is the result indexresult - is the result item
PluginException - if an invalid result item is given
public boolean isNegligibleResult(java.lang.Object type,
int index,
java.lang.Object result)
throws PluginException
true for microspecies distributions below CalculatorPlugin.EPSILON.
Returns false for all other results.
isNegligibleResult in class CalculatorPlugintype - is the result typeindex - is the result indexresult - is the result object
CalculatorPlugin.EPSILON
PluginExceptionprotected boolean isNegligible(double[] distr)
public Molecule getResultMolecule()
throws PluginException
MolAtom.getExtraLabel()).
Molecular results are stored in molecule properties
with keys being the result types
(Molecule.getProperty(String)).
getResultMolecule in class CalculatorPluginPluginException - on errorpublic void standardize(Molecule mol)
standardize in class CalculatorPluginmol - is the molecule to be standardized
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||