Search in sources :

Example 1 with IntArrayCountFingerprint

use of org.openscience.cdk.fingerprint.IntArrayCountFingerprint in project cdk by cdk.

the class SignatureFingerprintTanimotoTest method testCountMethod1and2.

@Test
public void testCountMethod1and2() throws CDKException {
    ICountFingerprint fp1 = new IntArrayCountFingerprint(new HashMap<String, Integer>() {

        {
            put("A", 3);
        }
    });
    ICountFingerprint fp2 = new IntArrayCountFingerprint(new HashMap<String, Integer>() {

        {
            put("A", 4);
        }
    });
    Assert.assertEquals(0.923, Tanimoto.method1(fp1, fp2), 0.001);
    Assert.assertEquals(0.75, Tanimoto.method2(fp1, fp2), 0.001);
    IAtomContainer mol1 = TestMoleculeFactory.makeIndole();
    IAtomContainer mol2 = TestMoleculeFactory.makeIndole();
    SignatureFingerprinter fingerprinter = new SignatureFingerprinter();
    fp1 = fingerprinter.getCountFingerprint(mol1);
    fp2 = fingerprinter.getCountFingerprint(mol2);
    Assert.assertEquals(1.0, Tanimoto.method1(fp1, fp2), 0.001);
    Assert.assertEquals(1.0, Tanimoto.method2(fp1, fp2), 0.001);
}
Also used : ICountFingerprint(org.openscience.cdk.fingerprint.ICountFingerprint) IAtomContainer(org.openscience.cdk.interfaces.IAtomContainer) SignatureFingerprinter(org.openscience.cdk.fingerprint.SignatureFingerprinter) IntArrayCountFingerprint(org.openscience.cdk.fingerprint.IntArrayCountFingerprint) Test(org.junit.Test)

Example 2 with IntArrayCountFingerprint

use of org.openscience.cdk.fingerprint.IntArrayCountFingerprint in project cdk by cdk.

the class TanimotoTest method method1.

@Test
public void method1() throws CDKException {
    ICountFingerprint fp1 = new IntArrayCountFingerprint(new HashMap<String, Integer>() {

        {
            put("A", 3);
        }
    });
    ICountFingerprint fp2 = new IntArrayCountFingerprint(new HashMap<String, Integer>() {

        {
            put("A", 4);
        }
    });
    Assert.assertEquals(0.923, Tanimoto.method1(fp1, fp2), 0.001);
}
Also used : ICountFingerprint(org.openscience.cdk.fingerprint.ICountFingerprint) IntArrayCountFingerprint(org.openscience.cdk.fingerprint.IntArrayCountFingerprint) Test(org.junit.Test)

Example 3 with IntArrayCountFingerprint

use of org.openscience.cdk.fingerprint.IntArrayCountFingerprint in project cdk by cdk.

the class TanimotoTest method method2.

@Test
public void method2() throws CDKException {
    ICountFingerprint fp1 = new IntArrayCountFingerprint(new HashMap<String, Integer>() {

        {
            put("A", 3);
        }
    });
    ICountFingerprint fp2 = new IntArrayCountFingerprint(new HashMap<String, Integer>() {

        {
            put("A", 4);
        }
    });
    Assert.assertEquals(0.75, Tanimoto.method2(fp1, fp2), 0.001);
}
Also used : ICountFingerprint(org.openscience.cdk.fingerprint.ICountFingerprint) IntArrayCountFingerprint(org.openscience.cdk.fingerprint.IntArrayCountFingerprint) Test(org.junit.Test)

Aggregations

Test (org.junit.Test)3 ICountFingerprint (org.openscience.cdk.fingerprint.ICountFingerprint)3 IntArrayCountFingerprint (org.openscience.cdk.fingerprint.IntArrayCountFingerprint)3 SignatureFingerprinter (org.openscience.cdk.fingerprint.SignatureFingerprinter)1 IAtomContainer (org.openscience.cdk.interfaces.IAtomContainer)1