Package chemaxon.descriptors
Class ScalarDescriptor
java.lang.Object
chemaxon.descriptors.MolecularDescriptor
chemaxon.descriptors.ScalarDescriptor
- All Implemented Interfaces:
Cloneable
Base class for all scalar descriptors. All scalar descriptors should be
derived from this class.
- Since:
- JChem 2.2
-
Field Summary
FieldsFields inherited from class chemaxon.descriptors.MolecularDescriptor
params -
Constructor Summary
ConstructorsConstructorDescriptionCreates a new, empty instance of ScalarDescriptor.Copy constructor.ScalarDescriptor(SDParameters params) Creates a new instance of ScalarDescriptor according to the parameters given.ScalarDescriptor(String params) Creates a new instance of ScalarDescriptor according to the parameters given. -
Method Summary
Modifier and TypeMethodDescriptionvoidclear()Clears the descritor: sets its value to zero value.clone()Creates a new instance with identical internal state.voidfromData(byte[] dbRepr) Builds a descriptor from an external data format, created by a previous call totoData().voidfromFloatArray(float[] descr) Builds the descriptor from a float array of one element.final voidfromString(String sd) Builds a descriptpr from its string representation created bytoString().String[]Creates the ScalarDescriptor descriptor for the given Molecule.float[]Gets the default dissimilarity threshold values for all dissimilarity metrics defined.floatgetDefaultThreshold(int metricIndex) Gets a metric dependent default threshold value.floatCalculates the dissimilarity between two scalar descriptor using the default metrics In the present implementation it is always the absolute difference between them.floatgetDissimilarity(MolecularDescriptor sd, int metricIndex) Calculates the dissimilarity between two scalar descriptor using the specified metric.String[]Gets the dissimilarity metric namesfloatCalculates the lower bound estimate of the dissimilarity from the given descriptor.getName()Gets the name of the ScalarDescriptor object.Gets the name of the parameters class corresponding to the descriptor.Gets the short name of the descriptor.voidset(float newValue) Set the value of the descriptor.voidsetParameters(MDParameters parameters) Sets parameters, allocates internal storage if needed and cleans the descriptor.voidsetParameters(String parameters) Sets the parameters of an already createdScalarDescriptorobject.byte[]toData()Converts aScalarDescriptorobject into an array of bytes.Converts the descriptor value into a readable string.final float[]Creates the float array representation of the descriptor.final StringtoString()Converts the descriptor value into a readable string.Methods inherited from class chemaxon.descriptors.MolecularDescriptor
generate, getAtomSetColors, getAtomSetIndexes, getAtomSetNames, getDefaultMetricIndex, getDissimilarityMetricIndex, getMetricIndex, getMetricName, getMetricName, getNumberOfMetrics, getNumberOfWeights, getParameters, getThreshold, getThreshold, needsConfig, newInstance, newInstance, newInstanceFromXML, setScreeningConfiguration, toBinaryString
-
Field Details
-
descrValue
protected float descrValuedescriptor value
-
-
Constructor Details
-
ScalarDescriptor
public ScalarDescriptor()Creates a new, empty instance of ScalarDescriptor. -
ScalarDescriptor
Creates a new instance of ScalarDescriptor according to the parameters given.- Parameters:
params- parameters settings
-
ScalarDescriptor
Creates a new instance of ScalarDescriptor according to the parameters given.- Parameters:
params- parameter string
-
ScalarDescriptor
Copy constructor. An identical copy of the descriptor passed is created. The old and the new instances share the sameSDParametersobject.- Parameters:
sd- a ScalarDescriptor to be copied
-
-
Method Details
-
clone
Creates a new instance with identical internal state.- Specified by:
clonein classMolecularDescriptor- Returns:
- the newly copied object
-
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:
getNamein classMolecularDescriptor- Returns:
- the nice external name for ScalarDescriptor class objects
-
getShortName
Gets the short name of the descriptor.- Overrides:
getShortNamein classMolecularDescriptor- Returns:
- the short name used in text outputs (tables etc.)
-
getParametersClassName
Gets the name of the parameters class corresponding to the descriptor.- Overrides:
getParametersClassNamein classMolecularDescriptor- Returns:
- the name of the parameters class
-
setParameters
Sets parameters, allocates internal storage if needed and cleans the descriptor.- Overrides:
setParametersin classMolecularDescriptor- Parameters:
parameters- fingerprint parameters
-
setParameters
Sets the parameters of an already createdScalarDescriptorobject.- Specified by:
setParametersin classMolecularDescriptor- Parameters:
parameters- parameter settings for the descriptor- Throws:
MDParametersException- any XML error
-
toData
public byte[] toData()Converts aScalarDescriptorobject 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 thefromData()method to build the scalar descriptor from this "external" representation.- Specified by:
toDatain classMolecularDescriptor- 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 totoData().- Specified by:
fromDatain classMolecularDescriptor- Parameters:
dbRepr- "external" representation of theScalarDescriptorobject
-
toFloatArray
public final float[] toFloatArray()Creates the float array representation of the descriptor.- Specified by:
toFloatArrayin classMolecularDescriptor- Returns:
- a float array of one element
-
fromFloatArray
Builds the descriptor from a float array of one element.- Specified by:
fromFloatArrayin classMolecularDescriptor- Parameters:
descr- descriptor stored in a (one element) float array- Throws:
RuntimeException
-
clear
public void clear()Clears the descritor: sets its value to zero value. -
toString
Converts the descriptor value into a readable string. This is the default external text format.- Specified by:
toStringin classMolecularDescriptor- Returns:
- string representation of the descriptor value
-
toDecimalString
Converts the descriptor value into a readable string. This is the default external text format.- Specified by:
toDecimalStringin classMolecularDescriptor- Returns:
- string representation of the descriptor value
-
fromString
Builds a descriptpr from its string representation created bytoString().- Specified by:
fromStringin classMolecularDescriptor- Parameters:
sd- descriptor value as string- Throws:
ParseException
-
set
public void set(float newValue) Set the value of the descriptor.- Parameters:
newValue- the value to be set
-
generate
Creates the ScalarDescriptor descriptor for the given Molecule. Side-effect!!!!!! Standardizes the input molecule (as defined inMDParameters).- Overrides:
generatein classMolecularDescriptor- Returns:
- property names set in the molecule passed during generation
- Throws:
MDGeneratorException- when failed to generate descriptor
-
getDissimilarityMetrics
Gets the dissimilarity metric names- Specified by:
getDissimilarityMetricsin classMolecularDescriptor- Returns:
- the metrics array
-
getDefaultDissimilarityMetricThresholds
public float[] getDefaultDissimilarityMetricThresholds()Gets the default dissimilarity threshold values for all dissimilarity metrics defined.- Specified by:
getDefaultDissimilarityMetricThresholdsin classMolecularDescriptor- Returns:
- array of dissimilarity threshold values
-
getDefaultThreshold
public float getDefaultThreshold(int metricIndex) Gets a metric dependent default threshold value.- Overrides:
getDefaultThresholdin classMolecularDescriptor- Parameters:
metricIndex- index of a parameterized metric
-
getDissimilarity
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:
getDissimilarityin classMolecularDescriptor- Parameters:
sd- a scalar descriptor value- Returns:
- dissimilarity value
-
getDissimilarity
Calculates the dissimilarity between two scalar descriptor using the specified metric.- Specified by:
getDissimilarityin classMolecularDescriptor- Parameters:
sd- a scalar descriptormetricIndex- index of the metric to be used- Returns:
- the dissimilarity ratio
- See Also:
-
getLowerBound
Calculates the lower bound estimate of the dissimilarity from the given descriptor.- Overrides:
getLowerBoundin classMolecularDescriptor- Parameters:
sd- a descriptor value- Returns:
- always returns 0
-