chemaxon.descriptors
Class ScalarDescriptor

java.lang.Object
  extended by chemaxon.descriptors.MolecularDescriptor
      extended by chemaxon.descriptors.ScalarDescriptor
All Implemented Interfaces:
chemaxon.license.Licensable, chemaxon.stat.Diffable, java.lang.Cloneable
Direct Known Subclasses:
HAcc, HDon, Heavy, LogD, LogP, Mass, TPSA

public class ScalarDescriptor
extends MolecularDescriptor
implements chemaxon.license.Licensable

Base class for all scalar descriptors. All scalar descriptors should be derived from this class.

Since:
JChem 2.2
Author:
Miklos Vargyas

Field Summary
protected  float descrValue
          descriptor value
 
Fields inherited from class chemaxon.descriptors.MolecularDescriptor
params
 
Constructor Summary
ScalarDescriptor()
          Creates a new, empty instance of ScalarDescriptor.
ScalarDescriptor(ScalarDescriptor sd)
          Copy constructor.
ScalarDescriptor(SDParameters params)
          Creates a new instance of ScalarDescriptor according to the parameters given.
ScalarDescriptor(java.lang.String params)
          Creates a new instance of ScalarDescriptor according to the parameters given.
 
Method Summary
 void clear()
          Clears the descritor: sets its value to zero value.
 java.lang.Object clone()
          Creates a new instance with identical internal state.
 void fromData(byte[] dbRepr)
          Builds a descriptor from an external data format, created by a previous call to toData().
 void fromFloatArray(float[] descr)
          Builds the descriptor from a float array of one element.
 void fromString(java.lang.String sd)
          Builds a descriptpr from its string representation created by toString().
 java.lang.String[] generate(Molecule m)
          Creates the ScalarDescriptor descriptor for the given Molecule.
 float[] getDefaultDissimilarityMetricThresholds()
          Gets the default dissimilarity threshold values for all dissimilarity metrics defined.
 float getDefaultThreshold(int metricIndex)
          Gets a metric dependent default threshold value.
 float getDissimilarity(java.lang.Object sd)
          Calculates the dissimilarity between two scalar descriptor using the default metrics In the present implementation it is always the absolute difference between them.
 float getDissimilarity(java.lang.Object sd, int metricIndex)
          Calculates the dissimilarity between two scalar descriptor using the specified metric.
 java.lang.String[] getDissimilarityMetrics()
          Gets the dissimilarity metric names
 float getLowerBound(java.lang.Object sd)
          Calculates the lower bound estimate of the dissimilarity from the given descriptor.
 java.lang.String getName()
          Gets the name of the ScalarDescriptor object.
 java.lang.String getParametersClassName()
          Gets the name of the parameters class corresponding to the descriptor.
 java.lang.String getShortName()
          Gets the short name of the descriptor.
 boolean isLicensed()
          Returns information about the licensing of the product.
 void set(float newValue)
          Set the value of the descriptor.
 void setLicenseEnvironment(java.lang.String env)
          Every license can have a modifier environment that's tipically an integration environment.
 void setParameters(MDParameters parameters)
          Sets parameters, allocates internal storage if needed and cleans the descriptor.
 void setParameters(java.lang.String parameters)
          Sets the parameters of an already created ScalarDescriptor object.
 byte[] toData()
          Converts a ScalarDescriptor object into an array of bytes.
 java.lang.String toDecimalString()
          Converts the descriptor value into a readable string.
 float[] toFloatArray()
          Creates the float array representation of the descriptor.
 java.lang.String toString()
          Converts the descriptor value into a readable string.
 
Methods inherited from class chemaxon.descriptors.MolecularDescriptor
getAtomSetColors, getAtomSetIndexes, getAtomSetNames, getDefaultMetricIndex, getDissimilarityMetricIndex, getMetricIndex, getMetricName, getMetricName, getNumberOfMetrics, getNumberOfWeights, getParameters, getThreshold, getThreshold, main, needsConfig, newInstance, newInstance, newInstanceFromXML, setScreeningConfiguration, toBinaryString
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

descrValue

protected float descrValue
descriptor value

Constructor Detail

ScalarDescriptor

public ScalarDescriptor()
Creates a new, empty instance of ScalarDescriptor.


ScalarDescriptor

public ScalarDescriptor(SDParameters params)
Creates a new instance of ScalarDescriptor according to the parameters given.

Parameters:
params - parameters settings

ScalarDescriptor

public ScalarDescriptor(java.lang.String params)
Creates a new instance of ScalarDescriptor according to the parameters given.

Parameters:
params - parameter string

ScalarDescriptor

public ScalarDescriptor(ScalarDescriptor sd)
Copy constructor. An identical copy of the descriptor passed is created. The old and the new instances share the same SDParameters object.

Parameters:
sd - a ScalarDescriptor to be copied
Method Detail

clone

public java.lang.Object clone()
Creates a new instance with identical internal state.

Specified by:
clone in class MolecularDescriptor
Returns:
the newly copied object

getName

public java.lang.String getName()
Gets the name of the ScalarDescriptor object. The name is not the same as the class name, but a nicer, readable and more meaningful for end-users.

Overrides:
getName in class MolecularDescriptor
Returns:
the nice external name for ScalarDescriptor class objects

getShortName

public java.lang.String getShortName()
Gets the short name of the descriptor.

Overrides:
getShortName in class MolecularDescriptor
Returns:
the short name used in text outputs (tables etc.)

getParametersClassName

public java.lang.String getParametersClassName()
Gets the name of the parameters class corresponding to the descriptor.

Overrides:
getParametersClassName in class MolecularDescriptor
Returns:
the name of the parameters class

setParameters

public void setParameters(MDParameters parameters)
Sets parameters, allocates internal storage if needed and cleans the descriptor.

Overrides:
setParameters in class MolecularDescriptor
Parameters:
parameters - fingerprint parameters

setParameters

public void setParameters(java.lang.String parameters)
                   throws chemaxon.descriptors.MDParametersException
Sets the parameters of an already created ScalarDescriptor object.

Specified by:
setParameters in class MolecularDescriptor
Parameters:
parameters - parameter settings for the descriptor
Throws:
chemaxon.descriptors.MDParametersException - any XML error

toData

public byte[] toData()
Converts a ScalarDescriptor object into an array of bytes. This format can be reffered to as an "external representation" since it servers as the data format for storing scalar descriptors in databases.
Use the fromData() method to build the scalar descriptor from this "external" representation.

Specified by:
toData in class MolecularDescriptor
Returns:
byte array representation of the descriptor object

fromData

public void fromData(byte[] dbRepr)
Builds a descriptor from an external data format, created by a previous call to toData().

Specified by:
fromData in class MolecularDescriptor
Parameters:
dbRepr - "external" representation of the ScalarDescriptor object

toFloatArray

public final float[] toFloatArray()
Creates the float array representation of the descriptor.

Specified by:
toFloatArray in class MolecularDescriptor
Returns:
a float array of one element

fromFloatArray

public void fromFloatArray(float[] descr)
                    throws java.lang.RuntimeException
Builds the descriptor from a float array of one element.

Specified by:
fromFloatArray in class MolecularDescriptor
Parameters:
descr - descriptor stored in a (one element) float array
Throws:
java.lang.RuntimeException

clear

public void clear()
Clears the descritor: sets its value to zero value.


toString

public final java.lang.String toString()
Converts the descriptor value into a readable string. This is the default external text format.

Specified by:
toString in class MolecularDescriptor
Returns:
string representation of the descriptor value

toDecimalString

public java.lang.String toDecimalString()
Converts the descriptor value into a readable string. This is the default external text format.

Specified by:
toDecimalString in class MolecularDescriptor
Returns:
string representation of the descriptor value

fromString

public final void fromString(java.lang.String sd)
                      throws java.text.ParseException
Builds a descriptpr from its string representation created by toString().

Specified by:
fromString in class MolecularDescriptor
Parameters:
sd - descriptor value as string
Throws:
java.text.ParseException

set

public void set(float newValue)
Set the value of the descriptor.

Parameters:
newValue - the value to be set

generate

public java.lang.String[] generate(Molecule m)
                            throws chemaxon.descriptors.MDGeneratorException
Creates the ScalarDescriptor descriptor for the given Molecule. Side-effect!!!!!! Standardizes the input molecule (as defined in MDParameters).

Overrides:
generate in class MolecularDescriptor
Returns:
property names set in the molecule passed during generation
Throws:
chemaxon.descriptors.MDGeneratorException - when failed to generate descriptor

getDissimilarityMetrics

public java.lang.String[] getDissimilarityMetrics()
Gets the dissimilarity metric names

Specified by:
getDissimilarityMetrics in class MolecularDescriptor
Returns:
the metrics array

getDefaultDissimilarityMetricThresholds

public float[] getDefaultDissimilarityMetricThresholds()
Gets the default dissimilarity threshold values for all dissimilarity metrics defined.

Specified by:
getDefaultDissimilarityMetricThresholds in class MolecularDescriptor
Returns:
array of dissimilarity threshold values

getDefaultThreshold

public float getDefaultThreshold(int metricIndex)
Gets a metric dependent default threshold value.

Overrides:
getDefaultThreshold in class MolecularDescriptor
Parameters:
metricIndex - index of a parametrized metric

getDissimilarity

public float getDissimilarity(java.lang.Object sd)
Calculates the dissimilarity between two scalar descriptor using the default metrics In the present implementation it is always the absolute difference between them.

Specified by:
getDissimilarity in interface chemaxon.stat.Diffable
Specified by:
getDissimilarity in class MolecularDescriptor
Parameters:
sd - a scalar descriptor value
Returns:
dissimilarity value

getDissimilarity

public float getDissimilarity(java.lang.Object sd,
                              int metricIndex)
Calculates the dissimilarity between two scalar descriptor using the specified metric.

Specified by:
getDissimilarity in class MolecularDescriptor
Parameters:
sd - a scalar descriptor
metricIndex - index of the metric to be used
Returns:
the dissimilarity ratio
See Also:
MDParameters, PFParameters

getLowerBound

public float getLowerBound(java.lang.Object sd)
Calculates the lower bound estimate of the dissimilarity from the given descriptor.

Specified by:
getLowerBound in interface chemaxon.stat.Diffable
Overrides:
getLowerBound in class MolecularDescriptor
Parameters:
sd - a descriptor value
Returns:
always returns 0

isLicensed

public boolean isLicensed()
Description copied from interface: chemaxon.license.Licensable
Returns information about the licensing of the product. Example implementation: return LicenseHandler.getInstance().isLicensed( LicenseHandler.MY_IDENTIFIER, licenseEnvironment );

Specified by:
isLicensed in interface chemaxon.license.Licensable
Returns:
true if the product is correctly licensed

setLicenseEnvironment

public void setLicenseEnvironment(java.lang.String env)
Description copied from interface: chemaxon.license.Licensable
Every license can have a modifier environment that's tipically an integration environment. All being Licensable should be prepared to store and show a set environment to the LicenseHandler. Example implementation:
 private String licenseEnvironment = "";
 public void setLicenseEnvironment(String env) {
     licenseEnvironment = env;
 }
 

Specified by:
setLicenseEnvironment in interface chemaxon.license.Licensable
Parameters:
env - environment String to be stored and passed to the LicenseHandler in the isLicensed method