@PublicAPI public class CustomDescriptor extends MolecularDescriptor
CustomDescriptor
class implements a generic molecular
descriptor class which supports third party or use defined descriptors.
Such descriptors can be used throughout the entire JChem system as any other
MolecularDescriptor
with only one exception: they cannot be
generated by this class, they must be provided
by the user of this class. CustomDescriptor
supports the
management (storage/retrival) and dissimilarity calculations of such
descriptors. These descriptors can have three distinct types: float, int or
binary, their dimension is not limited. All metrics implemented in the
Metrics
class are supported
and can be optimized.Modifier and Type | Field and Description |
---|---|
protected float[] |
floatDescr
storage for the floating point descriptors
|
protected int[] |
intDescr
storage for the integer or binary descriptors
|
params
Constructor and Description |
---|
CustomDescriptor()
Creates a new, empty instance of CustomDescriptor without allocating
internal storage for its value.
|
CustomDescriptor(CDParameters params)
Creates a new instance of CustomDescriptor according to the parameters
given.
|
CustomDescriptor(CustomDescriptor cd)
Copy constructor.
|
CustomDescriptor(int type,
int length)
Creates a new, empty instance of CustomDescriptor and allocates internal
storage to store values.
|
CustomDescriptor(java.lang.String params)
Creates a new instance of CustomDescriptor according to the parameters given.
|
Modifier and Type | Method and Description |
---|---|
void |
clear()
Clears the descriptor: sets all cells to store zero value.
|
CustomDescriptor |
clone()
Creates a new instance with identical internal state.
|
void |
fromData(byte[] dbRepr)
Builds a
CustomDescriptor from an external data format,
created by a previous call to toData() . |
void |
fromFloatArray(float[] descr)
Builds a molecular descriptor from its float array representation.
|
void |
fromString(java.lang.String descr)
Builds a descriptor from its string representation created by
toString() . |
float |
getAsymmetricEuclidean(CustomDescriptor f)
Calculates the asymmetric Euclidean distance.
|
int |
getBit(int cell) |
float[] |
getDefaultDissimilarityMetricThresholds()
Gets the default dissimilarity threshold values for all dissimilarity
metrics defined.
|
float |
getDissimilarity(MolecularDescriptor descr)
Calculates the dissimilarity between two pharmacophore fingerprints using
the default distance measure.
|
float |
getDissimilarity(MolecularDescriptor descr,
int metricIndex)
Calculates the dissimilarity between two descriptors using
the specified parametrized dissimilarity metric.
|
java.lang.String[] |
getDissimilarityMetrics()
Gets the dissimilarity metric names.
|
float |
getEuclidean(CustomDescriptor f)
Calculates the Euclidean distance.
|
float |
getFloat(int cell) |
int |
getInt(int cell) |
java.lang.String |
getName()
Gets the name of the
CustomDescriptor object. |
java.lang.String |
getParametersClassName()
Gets the name of the parameters class corresponding to the descriptor.
|
float |
getScaledTanimoto(CustomDescriptor f)
Gets the Tanimoto dissimilarity coefficient.
|
java.lang.String |
getShortName()
Gets the short name of the descriptor.
|
float |
getTanimoto(CustomDescriptor f)
Gets the Tanimoto dissimilarity coefficient.
|
float |
getWeightedAsymmetricEuclidean(CustomDescriptor f)
Calculates the weighted asymmetric Euclidean distance.
|
float |
getWeightedEuclidean(CustomDescriptor f)
Calculates the weighted Euclidean distance.
|
void |
set(int cell,
float value)
Sets the value of one cell of the descriptor.
|
void |
set(int cell,
float[] values)
Sets values of the descriptor.
|
void |
set(int cell,
int value)
Sets the value of one cell of the descriptor.
|
void |
set(int cell,
int[] values)
Sets values of the descriptor.
|
void |
setParameters(CDParameters parameters)
Sets parameters, allocates internal storage if needed and clears
the descriptor.
|
void |
setParameters(java.lang.String parameters)
Sets the parameters of an already created
CustomDescriptor
object. |
byte[] |
toData()
Converts a
CustomDescriptor object into a byte array. |
java.lang.String |
toDecimalString()
Converts the descriptor into a readable string of decimal numbers (float
or integer, depending on descriptor type).
|
float[] |
toFloatArray()
Creates the float array representation of a
CustomDescriptor
object. |
java.lang.String |
toString()
Converts the descriptor into a readable string.
|
generate, generate, getAtomSetColors, getAtomSetIndexes, getAtomSetNames, getDefaultMetricIndex, getDefaultThreshold, getDissimilarityMetricIndex, getLowerBound, getMetricIndex, getMetricName, getMetricName, getNumberOfMetrics, getNumberOfWeights, getParameters, getThreshold, getThreshold, main, needsConfig, newInstance, newInstance, newInstanceFromXML, newInstanceSupplier, setParameters, setScreeningConfiguration, toBinaryString
protected float[] floatDescr
protected int[] intDescr
public CustomDescriptor()
public CustomDescriptor(int type, int length)
type
- type of each cell of the descriptor (binary, int, float)length
- size (dimension) of the descriptorpublic CustomDescriptor(CDParameters params)
params
- parameter configurationpublic CustomDescriptor(java.lang.String params)
params
- parameter configuration (XML) stringpublic CustomDescriptor(CustomDescriptor cd)
CustomDescriptor
object passed is created. The original and the copy share the same
CDParameters
object.cd
- descriptor object to be copiedpublic CustomDescriptor clone()
clone
in class MolecularDescriptor
public java.lang.String getName()
CustomDescriptor
object. This name is
not the same as the class name, it is nicer, more readable and meaningful
for end-users too.getName
in class MolecularDescriptor
CCustomDescriptor
class
objectspublic java.lang.String getShortName()
getShortName
in class MolecularDescriptor
public java.lang.String getParametersClassName()
getParametersClassName
in class MolecularDescriptor
public void setParameters(CDParameters parameters)
parameters
- descriptor parameterspublic void setParameters(java.lang.String parameters) throws MDParametersException
CustomDescriptor
object.setParameters
in class MolecularDescriptor
parameters
- parameter settings for the descriptorMDParametersException
- any XML errorpublic byte[] toData()
CustomDescriptor
object into a byte array.
This format can be reffered to as an "external representation" since
it servers for storing fingerprints in databases.
fromData()
method to build the object from this
"external" representation.toData
in class MolecularDescriptor
public void fromData(byte[] dbRepr)
CustomDescriptor
from an external data format,
created by a previous call to toData()
.fromData
in class MolecularDescriptor
dbRepr
- "external" representation of CustomDescriptorpublic void set(int cell, float[] values)
cell
- the index of the first cell (dimension) to be modifiedvalues
- new values to be storedpublic void set(int cell, float value)
cell
- the index of the first cell to be modifiedvalue
- new value to be storedpublic void set(int cell, int[] values)
cell
- the index of the first cell (dimension) to be modifiedvalues
- new values to be storedpublic void set(int cell, int value)
cell
- the index of the first cell to be modifiedvalue
- new value to be storedpublic int getBit(int cell)
public int getInt(int cell)
public float getFloat(int cell)
public void clear()
public java.lang.String toString()
CustomDescriptor
.toString
in class MolecularDescriptor
public java.lang.String toDecimalString()
toDecimalString
in class MolecularDescriptor
public void fromString(java.lang.String descr) throws java.text.ParseException
toString()
.fromString
in class MolecularDescriptor
descr
- a custom descriptor string of decimal valuesjava.text.ParseException
public float[] toFloatArray()
CustomDescriptor
object. This array contains all values of the descriptor
(including all zeros) in the elements of the array.toFloatArray
in class MolecularDescriptor
public void fromFloatArray(float[] descr)
fromFloatArray
in class MolecularDescriptor
descr
- descriptor represented in a float arraypublic java.lang.String[] getDissimilarityMetrics()
getDissimilarityMetrics
in class MolecularDescriptor
public float[] getDefaultDissimilarityMetricThresholds()
getDefaultDissimilarityMetricThresholds
in class MolecularDescriptor
public float getTanimoto(CustomDescriptor f)
f
- the descriptor form which distance is measuredpublic float getScaledTanimoto(CustomDescriptor f)
CDParameters
object.f
- the descriptor form which distance is measuredpublic float getEuclidean(CustomDescriptor f)
f
- another fingerprint from which the distance is measuredpublic float getAsymmetricEuclidean(CustomDescriptor f)
CDParameters
object.f
- another fingerprint from which the distance is measuredpublic float getWeightedEuclidean(CustomDescriptor f)
CDParameters
object.f
- a fingerprint from which the distance is measuredpublic float getWeightedAsymmetricEuclidean(CustomDescriptor f)
CDParameters
object.f
- a fingerprint from which the distance is measuredpublic float getDissimilarity(MolecularDescriptor descr)
getDissimilarity
in class MolecularDescriptor
descr
- the other descriptorpublic float getDissimilarity(MolecularDescriptor descr, int metricIndex)
getDissimilarity
in class MolecularDescriptor
descr
- the descriptor from which the distance
is measuredmetricIndex
- index of the parametrized metric to be usedMDParameters
,
PFParameters