/** * 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); }
@Override public IFingerprinter getBitFingerprinter() { return new ExtendedFingerprinter(); }
@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)); }
int size = this.getSize(); double weight = MolecularFormulaManipulator.getTotalNaturalAbundance(MolecularFormulaManipulator .getMolecularFormula(container));
/** * @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("")); } }
@Test public void testExtendedFingerprinter() throws java.lang.Exception { IFingerprinter fingerprinter = new ExtendedFingerprinter(); Assert.assertNotNull(fingerprinter); }
@Test public void testGetSize() throws java.lang.Exception { IFingerprinter fingerprinter = new ExtendedFingerprinter(512); Assert.assertNotNull(fingerprinter); Assert.assertEquals(512, fingerprinter.getSize()); }
@Test public void testChebi() throws Exception { IAtomContainer searchmol = null; IAtomContainer findmol = null; String filename = "data/mdl/chebisearch.mol"; InputStream ins = this.getClass().getClassLoader().getResourceAsStream(filename); MDLV2000Reader reader = new MDLV2000Reader(ins); searchmol = reader.read(new AtomContainer()); reader.close(); filename = "data/mdl/chebifind.mol"; ins = this.getClass().getClassLoader().getResourceAsStream(filename); reader = new MDLV2000Reader(ins); findmol = reader.read(new AtomContainer()); reader.close(); IFingerprinter fingerprinter = new ExtendedFingerprinter(); BitSet superBS = fingerprinter.getBitFingerprint(findmol).asBitSet(); BitSet subBS = fingerprinter.getBitFingerprint(searchmol).asBitSet(); boolean isSubset = FingerprinterTool.isSubset(superBS, subBS); boolean isSubset2 = FingerprinterTool.isSubset(subBS, superBS); Assert.assertFalse(isSubset); Assert.assertFalse(isSubset2); }
@Test public void testgetBitFingerprint_IAtomContainer() throws java.lang.Exception { IFingerprinter fingerprinter = new ExtendedFingerprinter(); Assert.assertNotNull(fingerprinter); IAtomContainer mol = TestMoleculeFactory.makeIndole(); BitSet bs = fingerprinter.getBitFingerprint(mol).asBitSet(); IAtomContainer frag1 = TestMoleculeFactory.makePyrrole(); BitSet bs1 = fingerprinter.getBitFingerprint(frag1).asBitSet(); Assert.assertTrue(FingerprinterTool.isSubset(bs, bs1)); Assert.assertFalse(FingerprinterTool.isSubset(bs1, bs)); }
@Test public void testExtendedFingerprinter_int() throws java.lang.Exception { IFingerprinter fingerprinter = new ExtendedFingerprinter(512); Assert.assertNotNull(fingerprinter); IAtomContainer mol = TestMoleculeFactory.makeIndole(); BitSet bs = fingerprinter.getBitFingerprint(mol).asBitSet(); IAtomContainer frag1 = TestMoleculeFactory.makePyrrole(); BitSet bs1 = fingerprinter.getBitFingerprint(frag1).asBitSet(); Assert.assertTrue(FingerprinterTool.isSubset(bs, bs1)); Assert.assertFalse(FingerprinterTool.isSubset(bs1, bs)); }
@Test public void testExtendedFingerprinter_int_int() throws java.lang.Exception { IFingerprinter fingerprinter = new ExtendedFingerprinter(512, 7); Assert.assertNotNull(fingerprinter); IAtomContainer mol = TestMoleculeFactory.makeIndole(); BitSet bs = fingerprinter.getBitFingerprint(mol).asBitSet(); IAtomContainer frag1 = TestMoleculeFactory.makePyrrole(); BitSet bs1 = fingerprinter.getBitFingerprint(frag1).asBitSet(); Assert.assertTrue(FingerprinterTool.isSubset(bs, bs1)); Assert.assertFalse(FingerprinterTool.isSubset(bs1, bs)); }
@Test public void testDifferentRingFinders() throws Exception { IFingerprinter fingerprinter = new ExtendedFingerprinter(); IAtomContainer ac1 = new AtomContainer(); Atom atom1 = new Atom("C");
molsingle.addBond(b22s); IFingerprinter fingerprinter = new ExtendedFingerprinter(); BitSet bs1 = fingerprinter.getBitFingerprint(molsingle).asBitSet(); BitSet bs2 = fingerprinter.getBitFingerprint(molcondensed).asBitSet();