@TestClass(value="org.openscience.cdk.similarity.TanimotoTest") public class Tanimoto extends Object
You can use the FingerPrinter class to retrieve two fingerprint bitsets. We assume that you have two structures stored in cdk.Molecule objects. A tanimoto coefficient can then be calculated like:
BitSet fingerprint1 = Fingerprinter.getFingerprint(molecule1); BitSet fingerprint2 = Fingerprinter.getFingerprint(molecule2); float tanimoto_coefficient = Tanimoto.calculate(fingerprint1, fingerprint2);
The FingerPrinter assumes that hydrogens are explicitely given, if this is desired!
Note that the continuous Tanimoto coefficient does not lead to a metric space
Constructor and Description |
---|
Tanimoto() |
Modifier and Type | Method and Description |
---|---|
static float |
calculate(BitSet bitset1,
BitSet bitset2)
Evaluates Tanimoto coefficient for two bit sets.
|
static float |
calculate(double[] features1,
double[] features2)
Evaluates the continuous Tanimoto coefficient for two real valued vectors.
|
@TestMethod(value="testTanimoto1,testTanimoto2") public static float calculate(BitSet bitset1, BitSet bitset2) throws CDKException
bitset1
- A bitset (such as a fingerprint) for the first moleculebitset2
- A bitset (such as a fingerprint) for the second moleculeCDKException
- if bitsets are not of the same length@TestMethod(value="testTanimoto3") public static float calculate(double[] features1, double[] features2) throws CDKException
features1
- The first feature vectorfeatures2
- The second feature vectorCDKException
- if the features are not of the same length