|
||||||||||
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.MajorMicrospeciesPlugin
chemaxon.marvin.calculations.HBDAPlugin
Plugin class for H bond acceptor/donor calculation.
API usage example:
// create plugin HBDAPlugin plugin = new HBDAPlugin(); plugin.validate(<HBDA license>); // 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(); // 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
Field Summary 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
Fields inherited from class chemaxon.marvin.plugin.CalculatorPlugin ATOM, BLUE, CALCRGB_OFF, CHART, HYDROGEN_VALENCE_ERROR_MSG, MOLECULE, NAN, RED, SUBRESULT
Constructor Summary HBDAPlugin()
Constructor.
Method Summary void
checkMolecule(Molecule mol)
Checks the input molecule.int
getAcceptorAtomCount()
Returns the overall acceptor atom count (without multiplicity) in the molecule.int
getAcceptorCount()
Returns the overall acceptor count (with multiplicity) in the molecule.int
getAcceptorCount(int index)
Returns the atomic acceptor count corresponding to the specified atom index.protected java.awt.Color
getChartColor(java.lang.Object type)
Returns the chart colors to be displayed in msketch/mview GUI.int
getDonorAtomCount()
Returns the overall donor atom count (without multiplicity) in the molecule.int
getDonorCount()
Returns the overall donor count (with multiplicity) in the molecule.int
getDonorCount(int index)
Returns the atomic donor count corresponding to the specified atom index.java.lang.String
getErrorMessage()
Returns the calculation error information message ifrun()
returned false (calculation error): hydrogen valence error.protected java.lang.Object[]
getGUIResultTypes()
Returns the result types to be displayed in msketch/mview GUI.protected java.lang.String
getLicenseKey()
Returns the built-in license key for the given plugin class.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.java.lang.String
getOutputClassName()
Returns the output provider class name for the command line interface.double[]
getpHs()
Returns the pH array.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 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 domainCalculatorPlugin.ATOM
orCalculatorPlugin.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 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
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 asString[]
).protected boolean
isMsCalc()
Returnstrue
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.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.
Methods inherited from class chemaxon.marvin.calculations.MajorMicrospeciesPlugin getMainMolecule, getMajorMicrospecies, getMolText, getpH, getSuffix, isMajorMs, setpH, standardize
Methods inherited from class java.lang.Object clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Field Detail EPSILON
public static final double EPSILON
- See Also:
- Constant Field Values
ACCEPTOR_SIGN
public static final java.lang.String ACCEPTOR_SIGN
- Acceptor sign displayed in GUI.
- See Also:
- Constant Field Values
DONOR_SIGN
public static final java.lang.String DONOR_SIGN
- Donor sign displayed in GUI.
- See Also:
- Constant Field Values
Constructor Detail HBDAPlugin
public HBDAPlugin()
- Constructor. Creates the calculator object.
Method Detail getLicenseKey
protected final java.lang.String getLicenseKey()
- Returns the built-in license key for the given plugin class. This license key has to be checked against the license key read from the property file.
- Overrides:
getLicenseKey
in classCalculatorPlugin
- Returns:
- the built-in license key for the given plugin class
- See Also:
CalculatorPlugin.checkLicense()
setParameters
public void setParameters(java.util.Properties params) throws PluginException
- Sets the input parameters for the plugin. Charge parameters and value ranges:
- type:
- acc: atomic acceptors
- don: atomic donors
- accsitecount: molecular acceptor count with multiplicity
- donsitecount: molecular donor count with multiplicity
- acceptorcount: molecular acceptor atom count without multiplicity
- donorcount: molecular donor atom count without multiplicity
- msacc: average acceptor count over microspecies by pH
- msdon: average donor count over microspecies by pH
- precision: 0-8 or inf (number of displayed fractional digits, inf for unrounded value)
- lower: pH lower limit (default: 0.0)
- upper: pH upper limit (default: 14.0)
- count: pH step count between lower and upper limits (default: 0.5)
- Overrides:
setParameters
in classMajorMicrospeciesPlugin
- Parameters:
params
- is the parameter table- Throws:
PluginException
- on error
setpHLower
public void setpHLower(double lower)
- Sets pH lower limit for the calculation of microspecies distributions. Also activates the calculation of microspecies distributions. The default value is
0.0
.
- Parameters:
lower
- is the pH lower limit- Since:
- Marvin 3.5.1
setpHUpper
public void setpHUpper(double upper)
- Sets pH upper limit for the calculation of microspecies distributions. Also activates the calculation of microspecies distributions. The default value is
14.0
.
- Parameters:
upper
- is the pH upper limit- Since:
- Marvin 3.5.1
setpHStep
public void setpHStep(double step)
- Sets pH step for the calculation of microspecies distributions. Also activates the calculation of microspecies distributions. The default value is
0.5
.
- Parameters:
step
- is the pH step- Since:
- Marvin 3.5.1
setMsCalc
public void setMsCalc(boolean mscalc)
- Sets microspecies calculation.
- Parameters:
mscalc
- istrue
if microspecies calculation required- Since:
- Marvin 3.5.1
- See Also:
setpHLower(double lower)
,setpHUpper(double upper)
,setpHStep(double step)
,MajorMicrospeciesPlugin.setpH(double pH)
isMsCalc
protected boolean isMsCalc()
- Returns
true
if microspecies calculation.
- Overrides:
isMsCalc
in classCalculatorPlugin
- Returns:
true
if microspecies calculation
checkMolecule
public void checkMolecule(Molecule mol) throws PluginException
- Checks the input molecule. Throws exception if the molecule molecule contains R-groups.
- Overrides:
checkMolecule
in classMajorMicrospeciesPlugin
- Parameters:
mol
- is the input molecule- Throws:
PluginException
- with error message for the user if the molecule is refused
setInputMolecule
protected void setInputMolecule(Molecule mol) throws PluginException
- Sets the input molecule.
- Overrides:
setInputMolecule
in classMajorMicrospeciesPlugin
- Parameters:
mol
- is the input molecule- Throws:
PluginException
- on error
run
public boolean run() throws PluginException
- Runs the charge calculation.
- Overrides:
run
in classMajorMicrospeciesPlugin
- Returns:
- true if the calculation was successful, false on calculation error
- Throws:
PluginException
- on error
getErrorMessage
public java.lang.String getErrorMessage()
- Returns the calculation error information message if
run()
returned false (calculation error): hydrogen valence error.
- Overrides:
getErrorMessage
in classMajorMicrospeciesPlugin
- Returns:
- the calculation error information message
getpHs
public double[] getpHs()
- Returns the pH array.
- Returns:
- the pH array
getMsAcceptorCounts
public double[] getMsAcceptorCounts()
- Returns the average acceptor counts over the microspecies distribution for different pH-s. The pH array is returned by
getpHs()
and determined by the "lower", "upper" and "step" plugin parameters.
- Returns:
- the average acceptor counts over the microspecies distribution for pH-s returned by
getpHs()
getMsDonorCounts
public double[] getMsDonorCounts()
- Returns the average donor counts over the microspecies distribution for different pH-s. The pH array is returned by
getpHs()
and determined by the "lower", "upper" and "step" plugin parameters.
- Returns:
- the average donor counts over the microspecies distribution for pH-s returned by
getpHs()
getAcceptorCount
public int getAcceptorCount(int index)
- Returns the atomic acceptor count corresponding to the specified atom index.
- Parameters:
index
- is the atom index- Returns:
- the atomic acceptor count,
-1
for H atoms
getDonorCount
public int getDonorCount(int index)
- Returns the atomic donor count corresponding to the specified atom index.
- Parameters:
index
- is the atom index- Returns:
- the atomic donor count,
-1
for H atoms
getAcceptorCount
public int getAcceptorCount()
- Returns the overall acceptor count (with multiplicity) in the molecule.
- Returns:
- the overall acceptor count (with multiplicity) in the molecule
getDonorCount
public int getDonorCount()
- Returns the overall donor count (with multiplicity) in the molecule.
- Returns:
- the overall donor count (with multiplicity) in the molecule
getAcceptorAtomCount
public int getAcceptorAtomCount()
- Returns the overall acceptor atom count (without multiplicity) in the molecule.
- Returns:
- the overall acceptor atom count (without multiplicity) in the molecule
getDonorAtomCount
public int getDonorAtomCount()
- Returns the overall donor atom count (without multiplicity) in the molecule.
- Returns:
- the overall donor atom count (without multiplicity) in the molecule
getResultTypes
public java.lang.Object[] getResultTypes()
- Returns the result types. The possible types are described in
setParameters(Properties params)
.
- Overrides:
getResultTypes
in classMajorMicrospeciesPlugin
- Returns:
- the result types
getGUIResultTypes
protected java.lang.Object[] getGUIResultTypes()
- Returns the result types to be displayed in msketch/mview GUI. Returns
getResultTypes()
except that if both "acc" and "don" are contained then replaces them by "accdon".
- Overrides:
getGUIResultTypes
in classCalculatorPlugin
- Returns:
- the result types to be displayed in msketch/mview GUI
getChartColor
protected java.awt.Color getChartColor(java.lang.Object type)
- Returns the chart colors to be displayed in msketch/mview GUI. Returns
Color.red
for type "msacc" andColor.blue
for type "msdon".
- Overrides:
getChartColor
in classCalculatorPlugin
- Parameters:
type
- is the result type- Returns:
- the chart color for the given result type
getResultDomain
public int getResultDomain(java.lang.Object type)
- Returns the calculation domain
CalculatorPlugin.ATOM
orCalculatorPlugin.MOLECULE
. Can be combined withCalculatorPlugin.CHART
to denote chart-type data. HBDA returnsCalculatorPlugin.ATOM
for types "acc" and "don",CalculatorPlugin.MOLECULE
for types "accsitecount", "donsitecount", "acceptorcount", "donorcount", and returnsCalculatorPlugin.MOLECULE
combined withCalculatorPlugin.CHART
for type "msacc" and "msdon".
- Overrides:
getResultDomain
in classMajorMicrospeciesPlugin
- Parameters:
type
- is the result type- Returns:
- the domain as described above
- See Also:
getResultTypes()
getResultCount
public int getResultCount(java.lang.Object type)
- Returns the number of result items for the given result type. Returns the atom count for types "acc" and "don",
1
otherwise.
- Overrides:
getResultCount
in classMajorMicrospeciesPlugin
- 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 result item for the specified type and index. HBDA returns the
(pH, acceptor/donor count)
arrays for types "msacceptor" and "msdonor" as adouble[2][]
with the 0-th element being thepH
array and the 1-st element being theacceptor/donor count
array. For types "acc" and "don" HBDA returns theacceptor/donor count
corresponding to the specified atom index. For types "accsitecount" and "donsitecount" HBDA returns the sum of the atomic values.
- Overrides:
getResult
in classMajorMicrospeciesPlugin
- Parameters:
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"- 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 in String format.
- Overrides:
getResultAsString
in classMajorMicrospeciesPlugin
- Parameters:
type
- is the result typeindex
- is the result indexresult
- is the result item- Returns:
- the specified result in String format
- Throws:
PluginException
- if an invalid result item is given
getResultAsRGB
public int getResultAsRGB(java.lang.Object type, int index, java.lang.Object result) throws PluginException
- Returns the specified result color(s) as int format (alpha<<24 + red<<16 + green<<8 + blue). Returns "red" for acceptor "blue" for donor.
- Overrides:
getResultAsRGB
in classCalculatorPlugin
- Parameters:
type
- is the result typeindex
- is the result indexresult
- is the result item- Returns:
- the specified result in color as int
- Throws:
PluginException
- if an invalid result item is given
getResultsAsRGB
public long getResultsAsRGB(java.lang.Object type, int index, java.lang.Object result) throws PluginException
- Returns the specified result color(s) as int format (alpha<<24 + red<<16 + green<<8 + blue). Returns "red" for acceptor "blue" for donor.
- Overrides:
getResultsAsRGB
in classCalculatorPlugin
- Parameters:
type
- is the result typeindex
- is the result indexresult
- is the result item- Returns:
- the specified result in color as int
- Throws:
PluginException
- if an invalid result item is given
getResultsAsString
public java.lang.String getResultsAsString(java.lang.Object type, int index, java.lang.Object result) throws PluginException
- Returns the specified result in GUI-specific String format:
A
for acceptor,D
for donor.
- Overrides:
getResultsAsString
in classCalculatorPlugin
- Parameters:
type
- is the result typeindex
- is the result indexresult
- is the result item- Returns:
- the specified result in String format
- Throws:
PluginException
- if an invalid result item is given
getTypeString
public java.lang.String getTypeString(java.lang.Object type)
- Returns a string representation of the given type.
- Overrides:
getTypeString
in classCalculatorPlugin
- Parameters:
type
- is the type object- Returns:
- the type string
getReferenceMolecule
public Molecule getReferenceMolecule(java.lang.Object type, int index)
- Returns the molecule to be used as reference image for the given result type and index. Returns
null
.
- Overrides:
getReferenceMolecule
in classMajorMicrospeciesPlugin
- Parameters:
type
- is the result typeindex
- is the result index- Returns:
- null
isNegligibleResult
public boolean isNegligibleResult(java.lang.Object type, int index, java.lang.Object result) throws PluginException
- Returns whether the result can be ignored. Returns
true
for microspecies acceptor/donor count belowEPSILON
. Returnsfalse
for all other results.
- Overrides:
isNegligibleResult
in classCalculatorPlugin
- Parameters:
type
- is the result typeindex
- is the result indexresult
- is the result object- Returns:
- true for microspecies acceptor/donor count below
EPSILON
- Throws:
PluginException
getXLabels
public java.lang.String[] getXLabels()
- Returns the X label array (pH array as
String[]
).
- Overrides:
getXLabels
in classCalculatorPlugin
- Returns:
- the X label array
getXAxisLabel
public java.lang.String getXAxisLabel(java.lang.Object type)
- Returns the X axis label to be displayed in case of chart data.
- Overrides:
getXAxisLabel
in classCalculatorPlugin
- Parameters:
type
- is the result type
getOutputClassName
public java.lang.String getOutputClassName()
- Returns the output provider class name for the command line interface.
- Overrides:
getOutputClassName
in classMajorMicrospeciesPlugin
- Returns:
- the output provider class name
Overview Package Class Tree Deprecated Index Help PREV CLASS NEXT CLASS FRAMES NO FRAMES SUMMARY: NESTED | FIELD | CONSTR | METHOD DETAIL: FIELD | CONSTR | METHOD