@Test public void testFingerprinterBitSetSize() throws Exception { ShortestPathFingerprinter fingerprinter = new ShortestPathFingerprinter(1024); Assert.assertNotNull(fingerprinter); IAtomContainer mol = TestMoleculeFactory.makeIndole(); AtomContainerManipulator.percieveAtomTypesAndConfigureAtoms(mol); BitSet bs = fingerprinter.getBitFingerprint(mol).asBitSet(); Assert.assertEquals(1024, bs.length()); // highest set bit Assert.assertEquals(1024, bs.size()); // actual bit set size }
@Test public void testgetBitFingerprint_IAtomContainer() throws java.lang.Exception { ShortestPathFingerprinter fingerprinter = new ShortestPathFingerprinter(); IAtomContainer mol = TestMoleculeFactory.makeIndole(); AtomContainerManipulator.percieveAtomTypesAndConfigureAtoms(mol); IBitFingerprint bs = fingerprinter.getBitFingerprint(mol); Assert.assertNotNull(bs); Assert.assertEquals(fingerprinter.getSize(), bs.size()); }
@Test public void testFingerprinter_int_int() throws java.lang.Exception { ShortestPathFingerprinter fingerprinter = new ShortestPathFingerprinter(1024); Assert.assertNotNull(fingerprinter); IAtomContainer mol = TestMoleculeFactory.makeIndole(); AtomContainerManipulator.percieveAtomTypesAndConfigureAtoms(mol); BitSet bs = fingerprinter.getBitFingerprint(mol).asBitSet(); IAtomContainer frag1 = TestMoleculeFactory.makePyrrole(); AtomContainerManipulator.percieveAtomTypesAndConfigureAtoms(frag1); BitSet bs1 = fingerprinter.getBitFingerprint(frag1).asBitSet(); Assert.assertTrue(FingerprinterTool.isSubset(bs, bs1)); }
@Test public void testRegression() throws Exception { IAtomContainer mol1 = TestMoleculeFactory.makeIndole(); IAtomContainer mol2 = TestMoleculeFactory.makePyrrole(); AtomContainerManipulator.percieveAtomTypesAndConfigureAtoms(mol1); AtomContainerManipulator.percieveAtomTypesAndConfigureAtoms(mol2); ShortestPathFingerprinter fingerprinter = new ShortestPathFingerprinter(); IBitFingerprint bs1 = fingerprinter.getBitFingerprint(mol1); Assert.assertEquals( "Seems the fingerprint code has changed. This will cause a number of other tests to fail too!", 22, bs1.cardinality()); IBitFingerprint bs2 = fingerprinter.getBitFingerprint(mol2); Assert.assertEquals( "Seems the fingerprint code has changed. This will cause a number of other tests to fail too!", 11, bs2.cardinality()); }