chemaxon.descriptors
Class ShapeDescriptor

java.lang.Object
  extended by chemaxon.descriptors.MolecularDescriptor
      extended by chemaxon.descriptors.ShapeDescriptor
All Implemented Interfaces:
chemaxon.license.Licensable, java.lang.Cloneable

public class ShapeDescriptor
extends MolecularDescriptor
implements chemaxon.license.Licensable

Shape descriptor implements a 3D alignment based similarity calculation. At descriptor generation a specific molecule representation is stored and additional data is calculated. The similarity calculation itself compares two of such representations using (flexible) 3D structural overlay.

Author:
adrian

Field Summary
 
Fields inherited from class chemaxon.descriptors.MolecularDescriptor
params
 
Constructor Summary
ShapeDescriptor()
           
ShapeDescriptor(ShapeDescriptor sh)
          Copy constructor.
ShapeDescriptor(ShapeParameters params)
          Creates a new instance of ShapeDescriptor according to the parameters given.
ShapeDescriptor(java.lang.String params)
          Creates a new instance of ShapeDescriptor according to the parameters given.s
 
Method Summary
 void clear()
          Clears the fingerprint, all values are set to zero.
 ShapeDescriptor clone()
          Creates a new instance with identical internal state.
 void fromData(byte[] dbRepr)
          Builds a MolecularDescriptor object from its external (database) representation.
 void fromFloatArray(float[] descr)
          Builds a molecular descriptor from its float array representation.
 void fromString(java.lang.String descr)
          Builds a molecular descriptor from its string representation.
 java.lang.String[] generate(Molecule m)
          Creates the descriptor for the given Molecule.
 AlignmentMolecule getAlignmenMolecule()
           
 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(MolecularDescriptor other)
          Calculates the dissimilarity ratio between two MolecularDescriptor objects using the default metric.
 float getDissimilarity(MolecularDescriptor other, int parametrizedMetricIndex)
          Calculates the dissimilarity between two MolecularDescriptor objects using the specified metric, apart from that it is the same as getDissimilarity( final MolecularDescriptor other ).
 java.lang.String[] getDissimilarityMetrics()
          Gets the dissimilarity metric names in an array.
 float getHistogramSimilarity(MolecularDescriptor other)
           
 java.lang.String getName()
          Gets the name of the ShapeDescriptor fingerprint object.
 java.lang.String getParametersClassName()
          Gets the name of the parameters class corresponding to the descriptor.
 float getShapeSimilarity(MolecularDescriptor other)
           
 java.lang.String getShortName()
          Gets the short name of the fingerprint.
 boolean isLicensed()
           
 void setAlignmentMolecule(AlignmentMolecule am)
           
 void setLicenseEnvironment(java.lang.String env)
           
 void setParameters(java.lang.String parameters)
          Sets the parameters of an already created ShapeDescriptor object.
 java.lang.String toBinaryString()
          Creates the binary string representation of a MolecularDescriptor object.
 byte[] toData()
          Converts the internal (memory) representation of a MolecularDescriptor instance into an external format that can be stored in a database.
 java.lang.String toDecimalString()
          Creates the string representation of a MolecularDescriptor object.
 float[] toFloatArray()
          Creates the float array representation of a MolecularDescriptor object.
 java.lang.String toString()
          Creates the string representation of a MolecularDescriptor object.
 
Methods inherited from class chemaxon.descriptors.MolecularDescriptor
generate, getAtomSetColors, getAtomSetIndexes, getAtomSetNames, getDefaultMetricIndex, getDissimilarityMetricIndex, getLowerBound, getMetricIndex, getMetricName, getMetricName, getNumberOfMetrics, getNumberOfWeights, getParameters, getThreshold, getThreshold, main, needsConfig, newInstance, newInstance, newInstanceFromXML, setParameters, setScreeningConfiguration
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ShapeDescriptor

public ShapeDescriptor()

ShapeDescriptor

public ShapeDescriptor(ShapeParameters params)
Creates a new instance of ShapeDescriptor according to the parameters given.

Parameters:
params - parameter settings

ShapeDescriptor

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

Parameters:
params - parameter settings

ShapeDescriptor

public ShapeDescriptor(ShapeDescriptor sh)
Copy constructor. An identical copy of the ShapeDescriptor passed is created. The old and the new instances share the same ShapeDescriptorParameters object.

Parameters:
sh - fingerprint to be copied
Method Detail

getDefaultThreshold

public float getDefaultThreshold(int metricIndex)
Gets a metric dependent default threshold value. Ideally, this value should be based on statistics, though the actual value is not too critical, since these are only used in user interfaces to simplify the use of applications for beginners. Do not use this method. Required only for the compatibility with the screening framework.

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

getDefaultDissimilarityMetricThresholds

public float[] getDefaultDissimilarityMetricThresholds()
Gets the default dissimilarity threshold values for all dissimilarity metrics defined. Do not use this method. Required only for the compatibility with the screening framework.

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

setLicenseEnvironment

public void setLicenseEnvironment(java.lang.String env)
Specified by:
setLicenseEnvironment in interface chemaxon.license.Licensable

isLicensed

public boolean isLicensed()
Specified by:
isLicensed in interface chemaxon.license.Licensable

clone

public ShapeDescriptor clone()
Description copied from class: MolecularDescriptor
Creates a new instance with identical internal state.

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

setAlignmentMolecule

public void setAlignmentMolecule(AlignmentMolecule am)

generate

public java.lang.String[] generate(Molecule m)
                            throws MDGeneratorException
Description copied from class: MolecularDescriptor
Creates the descriptor for the given Molecule.

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

getName

public java.lang.String getName()
Gets the name of the ShapeDescriptor fingerprint object. This name is not the same as the class name: nicer, and more meaningful for end-users too.

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

getShortName

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

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(java.lang.String parameters)
                   throws MDParametersException
Sets the parameters of an already created ShapeDescriptor object.

Specified by:
setParameters in class MolecularDescriptor
Parameters:
parameters - parameter settings for the fingerprint
Throws:
MDParametersException - any XML error

clear

public void clear()
Clears the fingerprint, all values are set to zero.


toData

public byte[] toData()
Description copied from class: MolecularDescriptor
Converts the internal (memory) representation of a MolecularDescriptor instance into an external format that can be stored in a database.

Specified by:
toData in class MolecularDescriptor
Returns:
binary representation of the descriptor

fromData

public void fromData(byte[] dbRepr)
Description copied from class: MolecularDescriptor
Builds a MolecularDescriptor object from its external (database) representation.

Specified by:
fromData in class MolecularDescriptor
Parameters:
dbRepr - an array generated by toData()

toString

public java.lang.String toString()
Description copied from class: MolecularDescriptor
Creates the string representation of a MolecularDescriptor object. This string value is stored in SDfiles, though the use of this string is not limited to this purpose. Typically, this string is compact, for instance zero values are not necessarily printed.

Specified by:
toString in class MolecularDescriptor
Returns:
a formatted string of the descriptor

toDecimalString

public java.lang.String toDecimalString()
Description copied from class: MolecularDescriptor
Creates the string representation of a MolecularDescriptor object. This string value contains all values of the descriptor (including all zeros), values are separated by tabs.

Specified by:
toDecimalString in class MolecularDescriptor
Returns:
a formatted string of the descriptor

fromString

public void fromString(java.lang.String descr)
                throws java.text.ParseException
Description copied from class: MolecularDescriptor
Builds a molecular descriptor from its string representation. Typically used when SDfile is read.

Specified by:
fromString in class MolecularDescriptor
Parameters:
descr - descriptor string, previously generated by toString()
Throws:
java.text.ParseException

toFloatArray

public float[] toFloatArray()
Description copied from class: MolecularDescriptor
Creates the float array representation of a MolecularDescriptor object. This array contains all values of the descriptor (including all zeros) in the elements of the array.

Specified by:
toFloatArray in class MolecularDescriptor
Returns:
a formatted float array of the descriptor

fromFloatArray

public void fromFloatArray(float[] descr)
Description copied from class: MolecularDescriptor
Builds a molecular descriptor from its float array representation. Typically used when a hypothesis is created.

Specified by:
fromFloatArray in class MolecularDescriptor
Parameters:
descr - descriptor represented in a float array (e.g. generated by toFloatArray())

toBinaryString

public java.lang.String toBinaryString()
Description copied from class: MolecularDescriptor
Creates the binary string representation of a MolecularDescriptor object.

Overrides:
toBinaryString in class MolecularDescriptor
Returns:
a 0,1 string of the descriptor

getDissimilarityMetrics

public java.lang.String[] getDissimilarityMetrics()
Description copied from class: MolecularDescriptor
Gets the dissimilarity metric names in an array.
This method must be overloaded by derived classes in order to get the metrics array depending on the dynamic type. (This is needed because the metrics[] array is a class variable, but class variables are shared among all derived classes.)

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

getDissimilarity

public float getDissimilarity(MolecularDescriptor other)
Description copied from class: MolecularDescriptor
Calculates the dissimilarity ratio between two MolecularDescriptor objects using the default metric. Default metric is set in the corresponding MDParameters object. In the case of asymmetric distances swapping the two descriptors can make a big difference.

Specified by:
getDissimilarity in class MolecularDescriptor
Parameters:
other - the query descriptor with initialized Similarity3d object.
Returns:
the dissimilarity

getShapeSimilarity

public float getShapeSimilarity(MolecularDescriptor other)
Parameters:
other - the query descriptor with initialized Similarity3d obj.
Returns:
the shape similarity (s) where 0\<= s \<=1

getHistogramSimilarity

public float getHistogramSimilarity(MolecularDescriptor other)
Parameters:
other - the query descriptor with initialized Similarity3d obj.
Returns:
the histogram similarity (h) where 0\<= h

getDissimilarity

public float getDissimilarity(MolecularDescriptor other,
                              int parametrizedMetricIndex)
Description copied from class: MolecularDescriptor
Calculates the dissimilarity between two MolecularDescriptor objects using the specified metric, apart from that it is the same as getDissimilarity( final MolecularDescriptor other ).

Specified by:
getDissimilarity in class MolecularDescriptor
Parameters:
other - a descriptor, to which the dissimilarity ratio is measured
parametrizedMetricIndex - the index of the parameterized metric to used
Returns:
dissimilarity ratio
See Also:
MDParameters, PFParameters

getAlignmenMolecule

public AlignmentMolecule getAlignmenMolecule()