chemaxon.marvin.calculations
Class logDPlugin

java.lang.Object
  extended by chemaxon.marvin.plugin.CalculatorPlugin
      extended by chemaxon.marvin.calculations.logDPlugin
All Implemented Interfaces:
chemaxon.license.Licensable

public class logDPlugin
extends CalculatorPlugin

Plugin class for logD calculation.

API usage example:

        // instantiate plugin
        logDPlugin plugin = new logDPlugin();

        // set parameters
        plugin.setCloridIonConcentration(0.2);
        plugin.setNaKIonConcentration(0.2);
      plugin.setpHLower(3.0);
      plugin.setpHUpper(6.0);
      plugin.setpHStep(1.0);

        MolImporter importer = new MolImporter("targets.sdf");
        Molecule mol = null;
        while ((mol = importer.read()) != null) {
            // set molecule and run calculation
            plugin.setMolecule(mol);
            plugin.run();
            
            double[] pHs = plugin.getpHs();
            double[] logDs = plugin.getlogDs();

            // get and print logD values
            for (int i=0; i < pHs.length; ++i) {

                double pH = pHs[i];
                double logD = logDs[i];

                System.out.println(pH+", "+logD);
            }
        }
        importer.close();
 

Another example showing logD calculation at a single pH value:

        // instantiate plugin
        logDPlugin plugin = new logDPlugin();

      // set pH
      plugin.setpH(3.0);

      // set the input molecule
      plugin.setMolecule(mol);

        // run the calculation
        plugin.run();

        // get result
        double logD = plugin.getlogD();

        // print result
        System.out.println("logD at pH 3.0: "+logD);
 

 

For concurrent plugin example applications using ChemAxon's concurrent framework, refer to the Concurrent plugin examples.

Version:
5.0 09/20/2007
Author:
Nora Mate, Zsolt Mohacsi

Field Summary
 
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, NAN, PLUGIN_CLASS_KEY, PLUGIN_DIR, RED
 
Constructor Summary
logDPlugin()
          Constructor.
 
Method Summary
 double calclogD(double pH)
          Returns the logD value at fixed pH.
 void checkMolecule(Molecule mol)
          Checks the input molecule.
 java.lang.String getErrorMessage()
          Returns the calculation error information message if run() returned false (calculation error): hydrogen valence error.
protected  Molecule getImageMolecule()
          Returns the molecule to be used for legend image.
 double getlogD()
          Returns the logD value for the pH specified in setpH(double).
 double[] getlogDs()
          Returns the logD array.
 double[] getpHs()
          Returns the pH array.
 double[] getReflogDs()
          Returns the reference logD array.
 double[] getRefpHs()
          Returns the reference pH array.
 java.lang.String getRemark()
          Returns the calculation remark: checks for erronous aromatic nitrogens, instable tautomeric forms and covalent hydration errors.
 java.lang.Object getResult(java.lang.Object type, int index)
          Returns the result item for the specified type and index.
 java.lang.Object getResult(java.lang.Object type, java.lang.String arg)
          Returns the result item for the specified pH.
 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.
 java.lang.Object[] getResultTypes()
          Returns the result types.
 boolean isLicensed()
          Returns true if the plugin is licensed.
 boolean run()
          Runs the logD calculation.
 void setCloridIonConcentration(double c)
          Sets the Cl- concentration (default: 0.1).
 void setConsiderTautomerization(boolean considerTautomerization)
          Sets to consider tautomerization in calculation.
protected  void setInputMolecule(Molecule mol)
          Sets the input molecule.
 void setNaKIonConcentration(double c)
          Sets the Na+, K+ concentration (default: 0.1).
 void setParameters(java.util.Properties params)
          Sets the input parameters for the plugin.
 void setpH(double pH)
          Sets a single pH value for the logD calculation.
 void setpHLower(double lower)
          Sets pH lower limit (default: 0.0).
 void setpHStep(double step)
          Sets pH step to be taken between the pH lower and upper limits (default: 1.0).
 void setpHUpper(double upper)
          Sets pH upper limit (default: 14.0).
 void standardize(Molecule mol)
          Standardizes the molecule.
 
Methods inherited from class chemaxon.marvin.plugin.CalculatorPlugin
checkType, containsCoordinateBond, containsMulticenterSgroup, containsPseudoAtom, containsSRUSgroup, create, createModifiedInputMolecule, createStandardizedMolecule, createStandardizedMolecule, dehydrogenize, format, format, format, format, getAtomCount, getAtomIndex, getCalcMolecule, getDisplayMolecule, getDocument, getDoublePrecision, getInputMolDim, getMainMolecule, getpH, getPluginResource, getResult, getResult, getResultAsRGB, getResultAsRGB, getResultAsString, getResultCount, getResultDomain, getResultMessage, getResultMolecule, getResultMolecules, getResultsAsRGB, getResultsAsRGB, getResultsAsString, getResultsAsString, getResultSource, getTypeString, getWarningMessage, handlesMultiFragmentMolecules, isInputMoleculeAromatized, isMsCalc, isMultiThreadedRunEnabled, isNegligibleResult, isOK, isRgrouped, loadClass, readAttribute, removeWhitespace, setDoublePrecision, setDoublePrecision, setDoublePrecision, setLicenseEnvironment, setMolecule, setMolecule, setMolecule, setProgressMonitor, standardizeIonicGroups, standardizeNeutralGroups
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

logDPlugin

public logDPlugin()
Constructor. Creates the charge calculator object.

Method Detail

isLicensed

public boolean isLicensed()
Description copied from class: CalculatorPlugin
Returns true if the plugin is licensed. Implement this only if you want to sell your plugin and protect it with a license key. The default implementation always returns true which means that the plugin is free: no license key is required. This method returns only information about the licensing, license checking has to be implemented separately.

Specified by:
isLicensed in interface chemaxon.license.Licensable
Overrides:
isLicensed in class CalculatorPlugin
Returns:
true if the plugin is licensed

setParameters

public void setParameters(java.util.Properties params)
                   throws PluginException
Sets the input parameters for the plugin. Charge parameters and value ranges:
  • precision: 0-8 or inf (number of displayed fractional digits, inf for unrounded value)
  • anion: Cl- ion concentration (default: 0.1)
  • kation: Na+ plus K+ ion concentration (default: 0.1)
  • pH: pH value - calculate logD at a single pH
  • lower: pH lower limit (default: 0.0)
  • upper: pH upper limit (default: 14.0)
  • count: pH step size between lower and upper limits (default: 0.5)
  • ref1-ref4: reference pH values
  • considertautomerization: consider tautomerization

Overrides:
setParameters in class CalculatorPlugin
Parameters:
params - is the parameter table
Throws:
PluginException - on error

setCloridIonConcentration

public void setCloridIonConcentration(double c)
Sets the Cl- concentration (default: 0.1).

Parameters:
c - is the concentration

setNaKIonConcentration

public void setNaKIonConcentration(double c)
Sets the Na+, K+ concentration (default: 0.1).

Parameters:
c - is the concentration

setpHLower

public void setpHLower(double lower)
Sets pH lower limit (default: 0.0).

Parameters:
lower - is the pH lower limit

setpHUpper

public void setpHUpper(double upper)
Sets pH upper limit (default: 14.0).

Parameters:
upper - is the pH upper limit

setpHStep

public void setpHStep(double step)
Sets pH step to be taken between the pH lower and upper limits (default: 1.0).

Parameters:
step - is the pH step

setpH

public void setpH(double pH)
Sets a single pH value for the logD calculation.

Parameters:
pH - is the pH value

setConsiderTautomerization

public void setConsiderTautomerization(boolean considerTautomerization)
Sets to consider tautomerization in calculation. Default: false.

Parameters:
considerTautomerization - if true the calculation will be performed considering tautomerization
Since:
Marvin 5.0

checkMolecule

public void checkMolecule(Molecule mol)
                   throws PluginException
Checks the input molecule. Throws exception if the molecule is RxnMolecule, if the molecule contains R-groups or if the molecule consists of more than one fragments.

Overrides:
checkMolecule in class CalculatorPlugin
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.

Specified by:
setInputMolecule in class CalculatorPlugin
Parameters:
mol - is the (standardized) input molecule
Throws:
PluginException - on error

run

public boolean run()
            throws PluginException
Runs the logD calculation.

Specified by:
run in class CalculatorPlugin
Returns:
true if the calculation was successful, false on calculation problems
Throws:
PluginException - on error
See Also:
CalculatorPlugin.getErrorMessage()

getErrorMessage

public java.lang.String getErrorMessage()
Returns the calculation error information message if run() returned false (calculation error): hydrogen valence error.

Overrides:
getErrorMessage in class CalculatorPlugin
Returns:
the calculation error information message

getRemark

public java.lang.String getRemark()
Returns the calculation remark: checks for erronous aromatic nitrogens, instable tautomeric forms and covalent hydration errors.

Overrides:
getRemark in class CalculatorPlugin
Returns:
the calculation remark

calclogD

public double calclogD(double pH)
                throws PluginException
Returns the logD value at fixed pH.

Parameters:
pH - is the pH value
Returns:
the logD value at the given pH
Throws:
PluginException - on error

getResultTypes

public java.lang.Object[] getResultTypes()
Returns the result types. Possible result types: "logD", "reflogD".

Overrides:
getResultTypes in class CalculatorPlugin
Returns:
the result types

getRefpHs

public double[] getRefpHs()
Returns the reference pH array.

Returns:
the reference pH array

getReflogDs

public double[] getReflogDs()
Returns the reference logD array.

Returns:
the reference logD array

getlogD

public double getlogD()
Returns the logD value for the pH specified in setpH(double).

Returns:
the logD value

getpHs

public double[] getpHs()
Returns the pH array.

Returns:
the pH array

getlogDs

public double[] getlogDs()
Returns the logD array.

Returns:
the logD array

getResultDomain

public int getResultDomain(java.lang.Object type)
Returns the calculation domain CalculatorPlugin.ATOM or CalculatorPlugin.MOLECULE. logD returns CalculatorPlugin.MOLECULE.

Overrides:
getResultDomain in class CalculatorPlugin
Parameters:
type - is the result type
Returns:
CalculatorPlugin.MOLECULE
See Also:
CalculatorPlugin.getResultTypes()

getResultCount

public int getResultCount(java.lang.Object type)
Returns the number of result items for the given result key. logD returns 1.

Overrides:
getResultCount in class CalculatorPlugin
Parameters:
type - is the result type
Returns:
the number of result items
See Also:
CalculatorPlugin.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. logD returns the main or reference (pH, logD) arrays as a double[2][] with the 0-th element being the pH array and the 1-st element being the logD array.

Overrides:
getResult in class CalculatorPlugin
Parameters:
type - is the result type: "logD" or "reflogD"
index - is the result index
Returns:
the result item for the specified type and index
Throws:
PluginException - if the result cannot be returned
See Also:
CalculatorPlugin.getResultTypes()

getResult

public java.lang.Object getResult(java.lang.Object type,
                                  java.lang.String arg)
                           throws PluginException
Returns the result item for the specified pH.

Overrides:
getResult in class CalculatorPlugin
Parameters:
type - is the result type (not used)
arg - is the pH as string
Returns:
the result item for the specified pH
Throws:
PluginException - if the result cannot be returned
See Also:
CalculatorPlugin.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. logD returns the rounded (pH, logD) value pairs in string format: the values are rounded using the 'precision' input parameter that determines the number of fractional digits displayed, pH and logD are separated by a tab character.

Overrides:
getResultAsString in class CalculatorPlugin
Parameters:
type - is the result type
index - is the result index
result - is the result item
Returns:
the specified result in String format
Throws:
PluginException - if an invalid result item is given

getImageMolecule

protected Molecule getImageMolecule()
                             throws PluginException
Returns the molecule to be used for legend image.

Returns:
the image molecule
Throws:
PluginException - on error

standardize

public void standardize(Molecule mol)
Standardizes the molecule. This is done by performing the transformations necessary to run the plugin (e.g. aromatize, dehydrogenize, bring nitro groups to common form). Apart from the default standardization (aromatize and nitro) removes explicit hydrogens. Does AROM_BASIC aromatization.

Overrides:
standardize in class CalculatorPlugin
Parameters:
mol - is the molecule to be standardized