|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectchemaxon.descriptors.MolecularDescriptor
chemaxon.descriptors.ChemicalFingerprint
public class ChemicalFingerprint
The ChemicalFingerprint class implements topological fingerprints as a
type of MolecularDescriptors. Such fingerprints encode the
topological connection between atoms of the chemical graph. Though such
encoding loses information, still it preserves enough to allow fast
comparisons of chemical structures without their direct structural comparison
but instead involving their topological fingerprints.
This class provides two metrics for dissimilarity calculations: Tanimoto and
Euclidean. Many varieties fo the base metrics are supported, for instance
scaling, directing, weighting. Euclidean has a normalized form too in order
to upper bound the otherwise unbounded Euclidean metric.
CFParameters params = new CFParameters( "config.xml" );
CF fp = new CF( params );
// always use an MDSet object, even if it has one component only
MDSet ds = new MDSet();
ds.addDescriptor( pfp );
// create an input source reader that takes molecules from a smiles file
MDFileReader src = new MDFileReader( "input.smiles" );
src.setIdTagName( "CGX_ID" ); // just an example
// process input: get the fingerprints from the input source and do sg
while ( src.next( ds ) ) { // scr generates the descriptor!
do_something( ds );
}
src.close();
| Field Summary | |
|---|---|
protected int |
brightness
number of bits set in the fingerprint (sometimes this is called the darkness, but that seems to be less pausible) |
static int[] |
cfphistogram
|
protected int[] |
fp
storage for the fingerprint |
| Fields inherited from class chemaxon.descriptors.MolecularDescriptor |
|---|
params |
| Constructor Summary | |
|---|---|
ChemicalFingerprint()
Creates a new, empty instance of ChemicalFingerprint without allocating internal storage. |
|
ChemicalFingerprint(CFParameters params)
Creates a new instance of ChemicalFingerprint according to the parameters given. |
|
ChemicalFingerprint(ChemicalFingerprint cfp)
Copy constructor. |
|
ChemicalFingerprint(java.lang.String params)
Creates a new instance of ChemicalFingerprint according to the parameters given. |
|
| Method Summary | |
|---|---|
void |
clear()
Clears the fingerprint: sets all bins to store zero value. |
java.lang.Object |
clone()
Creates a new instance with identical internal state. |
void |
fromData(byte[] dbRepr)
Builds a fingerprint from an external data format, created by a previous call to toData(). |
void |
fromFloatArray(float[] descr)
Builds fingerprint from its float array representation. |
void |
fromString(java.lang.String cfp)
Builds a fingerprint from its string representation created by toString(). |
java.lang.String[] |
generate(Molecule m)
Creates the ChemicalFingerprint descriptor for the given Molecule. |
float |
getAsymmetricEuclidean(ChemicalFingerprint f)
Calculates the asymmetric Euclidean distance. |
int |
getBrightness()
Gets the brightness of the fingerprint. |
int |
getCommonBitCount(ChemicalFingerprint f)
|
float[] |
getDefaultDissimilarityMetricThresholds()
Gets the default dissimilarity threshold values for all dissimilarity metrics defined. |
int |
getDefaultMetricIndex()
Gets the index of the default metric. |
float |
getDefaultThreshold(int metricIndex)
Gets a metric dependent default threshold value. |
float |
getDissimilarity(java.lang.Object fp2)
Calculates the dissimilarity between two pharmacophore fingerprints using the default distance measure. |
float |
getDissimilarity(java.lang.Object fp2,
int metricIndex)
Calculates the dissimilarity between two pharmacophore fingerprints using the specified distance metric. |
java.lang.String[] |
getDissimilarityMetrics()
Gets the dissimilarity metric names |
float |
getEuclidean(ChemicalFingerprint f)
Calculates the Euclidean distance. |
float |
getLowerBound(java.lang.Object fp2)
Calculates the lower bound estimate of the dissimilarity from the given fingerprint. |
java.lang.String |
getName()
Gets the name of the ChemicalFingerprint 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. |
float |
getTanimoto(ChemicalFingerprint f)
Calculates the Tanimoto metric. |
float |
getWeightedAsymmetricEuclidean(ChemicalFingerprint f)
Calculates the weighted asymmetric Euclidean distance. |
float |
getWeightedEuclidean(ChemicalFingerprint f)
Calculates the weighted Euclidean distance. |
boolean |
isSubSetOf(ChemicalFingerprint f)
|
static void |
main(java.lang.String[] argv)
|
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 ChemicalFingerprint object. |
java.lang.String |
toBinaryString()
Converts the fingerprint into a 0,1 string. |
byte[] |
toData()
Converts a chemical fingerprint object into a byte array. |
java.lang.String |
toDecimalString()
Converts the fingerprint into a tab separated string. |
float[] |
toFloatArray()
Creates the float array representation of the fingerprint. |
java.lang.String |
toString()
Converts the fingerprint into a readable string. |
| Methods inherited from class chemaxon.descriptors.MolecularDescriptor |
|---|
getAtomSetColors, getAtomSetIndexes, getAtomSetNames, getDissimilarityMetricIndex, getMetricIndex, getMetricName, getMetricName, getNumberOfMetrics, getNumberOfWeights, getParameters, getThreshold, getThreshold, needsConfig, newInstance, newInstance, newInstanceFromXML, setScreeningConfiguration |
| Methods inherited from class java.lang.Object |
|---|
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
protected int[] fp
protected int brightness
public static int[] cfphistogram
| Constructor Detail |
|---|
public ChemicalFingerprint()
public ChemicalFingerprint(CFParameters params)
params - parameters used in fingerprint generation and handlingpublic ChemicalFingerprint(java.lang.String params)
params - parameter settingspublic ChemicalFingerprint(ChemicalFingerprint cfp)
CFParameters object.
cfp - fingerprint to be copied| Method Detail |
|---|
public java.lang.Object clone()
clone in class MolecularDescriptorpublic java.lang.String getName()
getName in class MolecularDescriptorpublic java.lang.String getShortName()
getShortName in class MolecularDescriptorpublic java.lang.String getParametersClassName()
getParametersClassName in class MolecularDescriptorpublic int getBrightness()
public void setParameters(MDParameters parameters)
setParameters in class MolecularDescriptorparameters - fingerprint parameters
public void setParameters(java.lang.String parameters)
throws chemaxon.descriptors.MDParametersException
ChemicalFingerprint object.
setParameters in class MolecularDescriptorparameters - parameter settings for the descriptor
chemaxon.descriptors.MDParametersException - any XML errorpublic byte[] toData()
fromData() method to build the fingerprint from
this "external" representation.
toData in class MolecularDescriptorpublic void fromData(byte[] dbRepr)
toData().
fromData in class MolecularDescriptordbRepr - "external" representation of ChemicalFingerprintpublic final void clear()
public final java.lang.String toString()
toString in class MolecularDescriptorpublic final java.lang.String toDecimalString()
toDecimalString in class MolecularDescriptorpublic java.lang.String toBinaryString()
toBinaryString in class MolecularDescriptor
public final void fromString(java.lang.String cfp)
throws java.text.ParseException
toString().
fromString in class MolecularDescriptorcfp - fingerprint string
java.text.ParseExceptionpublic final float[] toFloatArray()
toFloatArray in class MolecularDescriptor
public void fromFloatArray(float[] descr)
throws java.lang.RuntimeException
fromFloatArray in class MolecularDescriptordescr - fingerprint represented in a float array
(e.g. generated by toFloatArray())
java.lang.RuntimeException
public java.lang.String[] generate(Molecule m)
throws chemaxon.descriptors.MDGeneratorException
MDParameters class.
generate in class MolecularDescriptorchemaxon.descriptors.MDGeneratorException - when failed to generate descriptorpublic java.lang.String[] getDissimilarityMetrics()
getDissimilarityMetrics in class MolecularDescriptorpublic float[] getDefaultDissimilarityMetricThresholds()
getDefaultDissimilarityMetricThresholds in class MolecularDescriptorpublic int getDefaultMetricIndex()
PharmacophoreFingerprint
this is Tanimoto.
getDefaultMetricIndex in class MolecularDescriptorpublic float getDefaultThreshold(int metricIndex)
getDefaultThreshold in class MolecularDescriptormetricIndex - index of a parametrized metricpublic int getCommonBitCount(ChemicalFingerprint f)
public float getTanimoto(ChemicalFingerprint f)
f - the distance from f is calculated
public float getEuclidean(ChemicalFingerprint f)
f - the distance from f is calculated
public float getWeightedEuclidean(ChemicalFingerprint f)
f - the distance from f is calculated
public float getAsymmetricEuclidean(ChemicalFingerprint f)
f - the distance from f is calculated
public float getWeightedAsymmetricEuclidean(ChemicalFingerprint f)
f - the distance from f is calculated
public float getDissimilarity(java.lang.Object fp2)
Diffable interface even though ChemicalFingerprint does not
implement Diffable. The reason for that is that
MDSet, which may contain ChemicalFingerprint as a component
implements Diffable, and it has to call the
getDissimilarity( final Object fp2 ) method of the component
class when its getDissimilarity( final Object fp2 ) method is
envoked.
getDissimilarity in interface chemaxon.stat.DiffablegetDissimilarity in class MolecularDescriptorfp2 - the other pahrmacophore fingerprint
public float getDissimilarity(java.lang.Object fp2,
int metricIndex)
getMetricIndex( String metricName ) .
getDissimilarity in class MolecularDescriptorfp2 - the pharmacohore fingerprint from which the distance
is measuredmetricIndex - index of the metric to be used
MDParameters,
PFParameterspublic float getLowerBound(java.lang.Object fp2)
Diffable see
remarks at getDissimilarity
for further explanation.
In the case of ChemicalFingerprint a good estimate for the minimum distance
cannot be obtained efficiently (that is, significantly faster than
calculating the proper distance) therefore 0 is returned. This trivial
distance bound estimation will lead to calling getDistance.
- Specified by:
getLowerBound in interface chemaxon.stat.Diffable- Overrides:
getLowerBound in class MolecularDescriptor
- Parameters:
fp2 - pharmacophore fingerprint from which distance is measured
- Returns:
- estimate of the minimum distance
public boolean isSubSetOf(ChemicalFingerprint f)
public static void main(java.lang.String[] argv)
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||