/** * Generates a fingerprint of the default size for the given * AtomContainer, using path and ring metrics. It contains the * informations from getBitFingerprint() and bits which tell if the structure * has 0 rings, 1 or less rings, 2 or less rings ... 10 or less rings * (referring to smallest set of smallest rings) and bits which tell if * there is a fused ring system with 1,2...8 or more rings in it * *@param container The AtomContainer for which a Fingerprint is generated *@return a bit fingerprint for the given <code>IAtomContainer</code>. */ @Override public IBitFingerprint getBitFingerprint(IAtomContainer container) throws CDKException { return this.getBitFingerprint(container, null, null); }
@Test public void testgetBitFingerprint_IAtomContainer_IRingSet_List() throws java.lang.Exception { ExtendedFingerprinter fingerprinter = new ExtendedFingerprinter(); Assert.assertNotNull(fingerprinter); IAtomContainer mol = TestMoleculeFactory.makeIndole(); IRingSet rs = Cycles.sssr(mol).toRingSet(); List<IRingSet> rslist = RingPartitioner.partitionRings(rs); BitSet bs = fingerprinter.getBitFingerprint(mol, rs, rslist).asBitSet(); IAtomContainer frag1 = TestMoleculeFactory.makePyrrole(); BitSet bs1 = fingerprinter.getBitFingerprint(frag1).asBitSet(); Assert.assertTrue(FingerprinterTool.isSubset(bs, bs1)); Assert.assertFalse(FingerprinterTool.isSubset(bs1, bs)); }
/** * @cdk.bug 2219597 * @throws CDKException * @throws CloneNotSupportedException */ @Test public void testMoleculeInvariance() throws Exception, CloneNotSupportedException { IAtomContainer mol = TestMoleculeFactory.makePyrrole(); IAtomContainer clone = (IAtomContainer) mol.clone(); // should pass since we have not explicitly detected aromaticity for (IAtom atom : mol.atoms()) { Assert.assertFalse(atom.getFlag(CDKConstants.ISAROMATIC)); } String diff1 = AtomContainerDiff.diff(mol, clone); Assert.assertEquals("", diff1); ExtendedFingerprinter fprinter = new ExtendedFingerprinter(); BitSet fp = fprinter.getBitFingerprint(mol).asBitSet(); Assert.assertNotNull(fp); String diff2 = AtomContainerDiff.diff(mol, clone); Assert.assertTrue("There was a difference\n" + diff2, diff2.equals("")); } }