@PublicAPI public class HBDAPlugin extends MajorMicrospeciesAccessorPlugin
API usage example:
// create plugin HBDAPlugin plugin = new HBDAPlugin(); // set plugin parameters plugin.setDoublePrecision(2); plugin.setpHLower(2.0); plugin.setpHUpper(12.0); plugin.setpHStep(2.0); // optional: take major microspecies at pH=7.4 // skip this if you want to calculate HBDA for the input molecule as it is plugin.setpH(7.4); // read target molecule MolImporter mi = new MolImporter("target.mol"); Molecule mol = mi.read(); mi.close(); // set target molecule plugin.setMolecule(mol); // run the calculation plugin.run(); // get results // average acceptor/donor counts by microspecies distributions at given pH-s double[] pHs = plugin.getpHs(); double[] msacc = plugin.getMsAcceptorCounts(); double[] msdon = plugin.getMsDonorCounts(); System.out.println("pH\tmsacc\tmsdon"); for (int i = 0; i < pHs.length; ++i) { System.out.println("" + plugin.format(pHs[i]) + "\t" + plugin.format(msacc[i]) + "\t" + plugin.format(msdon[i])); } // molecular data // with multiplicity int molecularAcceptorCount = plugin.getAcceptorCount(); int molecularDonorCount = plugin.getDonorCount(); // without multiplicity int molecularAcceptorAtomCount = plugin.getAcceptorAtomCount(); int molecularDonorAtomCount = plugin.getDonorAtomCount(); System.out.println(); System.out.println("Acceptor count with multiplicity: " + molecularAcceptorCount); System.out.println("Donor count with multiplicity: " + molecularDonorCount); System.out.println("Acceptor count without multiplicity: " + molecularAcceptorAtomCount); System.out.println("Donor count without multiplicity: " + molecularDonorAtomCount); // atomic data System.out.println(); System.out.println("Atom\tAcceptor count\tDonor count"); int count = mol.getAtomCount(); for (int i = 0; i < count; ++i) { // atomic acceptor/donor count with multiplicity int atomicAcceptorCount = plugin.getAcceptorCount(i); int atomicDonorCount = plugin.getDonorCount(i); if (atomicAcceptorCount != -1) { // -1 means H atom System.out.println("" + (i + 1) + "\t" + atomicAcceptorCount + "\t" + atomicDonorCount); } }
For concurrent plugin example applications using ChemAxon's concurrent framework, refer to the Concurrent plugin examples.
CalculatorPlugin.HydrogenData
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
ACCEPTOR_SIGN
Acceptor sign displayed in GUI.
|
static java.lang.String |
DONOR_SIGN
Donor sign displayed in GUI.
|
static double |
EPSILON |
ionizer
ATOM, BLUE, CALCRGB_OFF, COVALENT_HYDRATION_ERROR_REMARK, CRITICAL_ERROR_MSG, 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 |
---|
HBDAPlugin()
Constructor.
|
Modifier and Type | Method and Description |
---|---|
void |
checkMolecule(Molecule mol)
Checks the input molecule.
|
int |
getAcceptorAtomCount()
Returns the overall acceptor atom count (without multiplicity) in the molecule.
|
int |
getAcceptorCount()
Deprecated.
Use
getAcceptorSiteCount() instead. |
int |
getAcceptorCount(int index)
Deprecated.
Use
getAcceptorSiteCount() instead! |
int |
getAcceptorSiteCount()
Returns the overall acceptor count (with multiplicity) in the molecule.
|
int |
getAcceptorSiteCount(int index)
Returns the atomic acceptor count corresponding to the specified atom index.
|
int |
getDonorAtomCount()
Returns the overall donor atom count (without multiplicity) in the molecule.
|
int |
getDonorCount()
Deprecated.
Use
getDonorSiteCount() instead! |
int |
getDonorCount(int index)
Deprecated.
Use
getDonorSiteCount(int) instead! |
int |
getDonorSiteCount()
Returns the overall donor count (with multiplicity) in the molecule.
|
int |
getDonorSiteCount(int index)
Returns the atomic donor count corresponding to the specified atom index.
|
java.lang.String |
getErrorMessage()
Returns the calculation error information message if
run() returned false
(calculation error): hydrogen valence error. |
double[] |
getMsAcceptorCounts()
Returns the average acceptor counts over the microspecies distribution for different pH-s.
|
double[] |
getMsDonorCounts()
Returns the average donor counts over the microspecies distribution for different pH-s.
|
double[] |
getpHs()
Returns the pH array.
|
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 type and index.
|
int |
getResultAsRGB(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 |
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 type.
|
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 in GUI-specific String format:
A for acceptor,
D for donor. |
java.lang.Object[] |
getResultTypes()
Returns the result types.
|
java.lang.String |
getTypeString(java.lang.Object type)
Returns a string representation of the given type.
|
java.lang.String |
getWarningMessage()
Returns the calculation warning information message if no H-bond donor/acceptor atoms found,
returns the empty string otherwise.
|
boolean |
isLicensed()
Returns
true if the plugin is licensed. |
protected boolean |
isMsCalc()
Returns
true if microspecies calculation. |
boolean |
isNegligibleResult(java.lang.Object type,
int index,
java.lang.Object result)
Returns whether the result can be ignored.
|
boolean |
run()
Runs the charge calculation.
|
void |
setExcludeHalogens(boolean e)
Sets if halogens should be excluded from hydrogen bond acceptors.
|
void |
setExcludeSulfur(boolean e)
Sets if sulfur atom should be excluded from hydrogen bond acceptors.
|
protected void |
setGUIMode(boolean guimode)
Deprecated.
|
protected void |
setInputMolecule(Molecule mol)
Sets the input molecule.
|
void |
setMsCalc(boolean mscalc)
Sets microspecies calculation.
|
void |
setParameters(java.util.Properties params)
Sets the input parameters for the plugin.
|
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.
|
createModifiedInputMolecule, getIonizerErrorMessage, getpH, setpH, standardize
arrangeHydrogenIncerments, canRepeat, checkLicense, checkType, containsCoordinateBond, containsMulticenterSgroup, containsPseudoAtom, containsSRUSgroup, create, createStandardizedMolecule, createStandardizedMolecule, dehydrogenize, format, format, format, format, getAtomCount, getAtomIndex, getAtomIndexMap, getCalcMolecule, getDisplayMolecule, getDocument, getDoublePrecision, getExplicitHydrogenData, getInputMolDim, getMainMolecule, getOriginalMolecule, getPluginResource, getQueryMoleculeErrorMessage, getRemark, getResult, getResult, getResult, getResultAsRGB, getResultAsString, getResultCount, getResultDomain, getResultMessage, getResultMolecules, getResultsAsRGB, getResultsAsString, getResultSource, handlesMultiFragmentMolecules, isInputMoleculeAromatized, isMultiThreadedRunEnabled, isOK, isRgrouped, loadClass, readAttribute, removeWhitespace, restoreExplicitHydrogens, setAtomIndexMap, setDoublePrecision, setDoublePrecision, setDoublePrecision, setKeepHydrogens, setLicenseEnvironment, setMolecule, setMolecule, setMolecule, setMolecule, setProgressMonitor, standardizeIonicGroups, standardizeNeutralGroups
public static final double EPSILON
public static final java.lang.String ACCEPTOR_SIGN
public static final java.lang.String DONOR_SIGN
public boolean isLicensed()
true
if the plugin is licensed. The license checking is based on the
product name, returned by getProductName()
.isLicensed
in interface chemaxon.license.Licensable
isLicensed
in class MajorMicrospeciesAccessorPlugin
true
if the plugin is licensedpublic java.lang.String getProductName()
LicenseManager
.getProductName
in class CalculatorPlugin
LicenseManager.HBDA_PLUGIN
public void setParameters(java.util.Properties params) throws PluginException
setParameters
in class MajorMicrospeciesAccessorPlugin
params
- is the parameter tablePluginException
- on errorpublic 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)
0.5
.step
- is the pH steppublic void setMsCalc(boolean mscalc)
mscalc
- is true
if microspecies calculation requiredsetpHLower(double lower)
,
setpHUpper(double upper)
,
setpHStep(double step)
,
MajorMicrospeciesAccessorPlugin.setpH(double pH)
protected boolean isMsCalc()
true
if microspecies calculation.isMsCalc
in class CalculatorPlugin
true
if microspecies calculationpublic void checkMolecule(Molecule mol) throws PluginException
checkMolecule
in class MajorMicrospeciesAccessorPlugin
mol
- is the input moleculePluginException
- 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 moleculePluginException
- on errorpublic void setExcludeSulfur(boolean e)
true
e
- if true
then sulfur atom is not considered to be hydrogen bond
acceptor.public void setExcludeHalogens(boolean e)
true
e
- if true
then halogens are not considered to be hydrogen bond
acceptor.public boolean run() throws PluginException
run
in class CalculatorPlugin
PluginException
- on errorCalculatorPlugin.getErrorMessage()
public java.lang.String getErrorMessage()
run()
returned false
(calculation error): hydrogen valence error.getErrorMessage
in class MajorMicrospeciesAccessorPlugin
public java.lang.String getWarningMessage()
getWarningMessage
in class CalculatorPlugin
public double[] getpHs()
public double[] getMsAcceptorCounts()
getpHs()
and determined by the "lower", "upper" and
"step" plugin parameters.getpHs()
public double[] getMsDonorCounts()
getpHs()
and determined by the "lower", "upper" and "step"
plugin parameters.getpHs()
@Deprecated public int getAcceptorCount(int index)
getAcceptorSiteCount()
instead!public int getAcceptorSiteCount(int index)
index
- is the atom index-1
for H atoms@Deprecated public int getDonorCount(int index)
getDonorSiteCount(int)
instead!public int getDonorSiteCount(int index)
index
- is the atom index-1
for H atoms@Deprecated public int getAcceptorCount()
getAcceptorSiteCount()
instead.public int getAcceptorSiteCount()
@Deprecated public int getDonorCount()
getDonorSiteCount()
instead!public int getDonorSiteCount()
public int getAcceptorAtomCount()
public int getDonorAtomCount()
public java.lang.Object[] getResultTypes()
setParameters(Properties params)
.getResultTypes
in class CalculatorPlugin
@Deprecated protected void setGUIMode(boolean guimode)
guimode
- is true if GUI modepublic int getResultDomain(java.lang.Object type)
CalculatorPlugin.ATOM
or
CalculatorPlugin.MOLECULE
. HBDA returns CalculatorPlugin.ATOM
for types "acc"
and "don", CalculatorPlugin.MOLECULE
for types "accsitecount", "donsitecount",
"acceptorcount", "donorcount", and returns CalculatorPlugin.MOLECULE
for type "msacc"
and "msdon".getResultDomain
in class CalculatorPlugin
type
- is the result typegetResultTypes()
public int getResultCount(java.lang.Object type)
1
otherwise.getResultCount
in class CalculatorPlugin
type
- is the result typegetResultTypes()
public java.lang.Object getResult(java.lang.Object type, int index) throws PluginException
(pH, acceptor/donor count)
arrays for types "msacceptor" and "msdonor" as a
double[2][]
with the 0-th element being the pH
array and the 1-st
element being the acceptor/donor count
array. For types "acc" and "don" HBDA
returns the acceptor/donor count
corresponding to the specified atom index. For
types "accsitecount" and "donsitecount" HBDA returns the sum of the atomic values. cc * @see
#getResultTypes()getResult
in class CalculatorPlugin
type
- is the result type ("acc", "don", "msacc", "msdon", "accsitecount",
"donsitecount", "acceptorcount", "donorcount")index
- is the atom index for types "acc", "don", N/A for "msacc", "msdon",
"accsitecount", "donsitecount", "acceptorcount", "donorcount"PluginException
- if the result cannot be returnedCalculatorPlugin.getResultTypes()
public java.lang.String getResultAsString(java.lang.Object type, int index, java.lang.Object result) throws PluginException
getResultAsString
in class CalculatorPlugin
type
- is the result typeindex
- is the result indexresult
- is the result itemPluginException
- 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 itemPluginException
- 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 itemPluginException
- if an invalid result item is givenpublic java.lang.String getResultsAsString(java.lang.Object type, int index, java.lang.Object result) throws PluginException
A
for acceptor,
D
for donor.getResultsAsString
in class CalculatorPlugin
type
- is the result typeindex
- is the result indexresult
- is the result itemPluginException
- if an invalid result item is givenpublic java.lang.String getTypeString(java.lang.Object type)
getTypeString
in class CalculatorPlugin
type
- is the type objectpublic boolean isNegligibleResult(java.lang.Object type, int index, java.lang.Object result) throws PluginException
true
for microspecies
acceptor/donor count below EPSILON
. Returns false
for all other
results.isNegligibleResult
in class CalculatorPlugin
type
- is the result typeindex
- is the result indexresult
- is the result objectEPSILON
PluginException
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 CalculatorPlugin
PluginException
- on error