Search in sources :

Example 1 with LingoFingerprinter

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

the class LingoSimilarityTest method testLingoSim.

@Test
public void testLingoSim() throws Exception {
    IAtomContainer mol1 = TestMoleculeFactory.makeIndole();
    IAtomContainer mol2 = TestMoleculeFactory.makeIndole();
    addImplicitHydrogens(mol1);
    addImplicitHydrogens(mol2);
    AtomContainerManipulator.percieveAtomTypesAndConfigureAtoms(mol1);
    AtomContainerManipulator.percieveAtomTypesAndConfigureAtoms(mol2);
    LingoFingerprinter fingerprinter = new LingoFingerprinter();
    Map<String, Integer> bs1 = fingerprinter.getRawFingerprint(mol1);
    Map<String, Integer> bs2 = fingerprinter.getRawFingerprint(mol2);
    float lingosim = LingoSimilarity.calculate(bs1, bs2);
    Assert.assertEquals(1.0, lingosim, 0.01);
}
Also used : IAtomContainer(org.openscience.cdk.interfaces.IAtomContainer) LingoFingerprinter(org.openscience.cdk.fingerprint.LingoFingerprinter) Test(org.junit.Test)

Example 2 with LingoFingerprinter

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

the class TanimotoTest method testExactMatch.

@Test
public void testExactMatch() throws Exception {
    IAtomContainer mol1 = TestMoleculeFactory.makeIndole();
    IAtomContainer mol2 = TestMoleculeFactory.makeIndole();
    addImplicitHydrogens(mol1);
    addImplicitHydrogens(mol2);
    LingoFingerprinter fingerprinter = new LingoFingerprinter();
    AtomContainerManipulator.percieveAtomTypesAndConfigureAtoms(mol1);
    AtomContainerManipulator.percieveAtomTypesAndConfigureAtoms(mol2);
    Map<String, Integer> feat1 = fingerprinter.getRawFingerprint(mol1);
    Map<String, Integer> feat2 = fingerprinter.getRawFingerprint(mol2);
    float tanimoto = Tanimoto.calculate(feat1, feat2);
    Assert.assertEquals(1.0, tanimoto, 0.001);
}
Also used : IAtomContainer(org.openscience.cdk.interfaces.IAtomContainer) LingoFingerprinter(org.openscience.cdk.fingerprint.LingoFingerprinter) Test(org.junit.Test)

Aggregations

Test (org.junit.Test)2 LingoFingerprinter (org.openscience.cdk.fingerprint.LingoFingerprinter)2 IAtomContainer (org.openscience.cdk.interfaces.IAtomContainer)2