public void TestAnonFingerprints() { var expected = new BitArray[] { ParseBitSet("{148, 206, 392, 542, 637, 742, 752, 830}"), ParseBitSet("{148, 206, 392, 542, 637, 742, 752, 830}"), ParseBitSet("{148, 206, 392, 542, 637, 742, 752, 830}"), ParseBitSet("{148, 206, 392, 542, 637, 742, 752, 830}"), ParseBitSet("{148, 206, 392, 542, 637, 742, 752, 830}"), ParseBitSet("{148, 206, 392, 542, 637, 742, 752, 830}"), ParseBitSet("{148, 206, 392, 542, 637, 742, 752, 830}"), ParseBitSet("{148, 206, 392, 542, 637, 742, 752, 830}"), ParseBitSet("{148, 206, 392, 542, 637, 742, 752, 830}"), ParseBitSet("{148, 206, 392, 542, 637, 742, 752, 830}"), }; var filename = "NCDK.Data.MDL.fingerprints_from_modelbuilder3d.sdf"; var ins = this.GetType().Assembly.GetManifestResourceStream(filename); var data = TemplateExtractor.MakeFingerprintsFromSdf(true, true, new Dictionary <string, int>(), new StreamReader(ins), 10); var obj = new QueryChemObject(); var dummy = obj.Builder; for (int i = 0; i < data.Count; i++) { IBitFingerprint bs = data[i]; Assert.IsTrue(Compares.AreEqual(expected[i], bs.AsBitSet())); } }
public override void TestBug706786() { IAtomContainer superStructure = Bug706786_1(); IAtomContainer subStructure = Bug706786_2(); AddImplicitHydrogens(superStructure); AddImplicitHydrogens(subStructure); // SMARTS is now correct and D will include H atoms, CDK had this wrong // for years (had it has non-H count). Whilst you can set the optional // SMARTS flavor CDK_LEGACY this is not correct AtomContainerManipulator.SuppressHydrogens(superStructure); AtomContainerManipulator.SuppressHydrogens(subStructure); IFingerprinter fpr = GetBitFingerprinter(); IBitFingerprint superBits = fpr.GetBitFingerprint(superStructure); IBitFingerprint subBits = fpr.GetBitFingerprint(subStructure); Assert.IsTrue(BitArrays.Equals( AsBitSet(0, 11, 13, 17, 40, 48, 136, 273, 274, 278, 286, 294, 299, 301, 304, 306), superBits.AsBitSet())); Assert.IsTrue(BitArrays.Equals( AsBitSet(1, 17, 273, 274, 278, 294, 306), subBits.AsBitSet())); }
public override void TestBug934819() { IAtomContainer subStructure = Bug934819_1(); IAtomContainer superStructure = Bug934819_2(); AtomContainerManipulator.PercieveAtomTypesAndConfigureAtoms(superStructure); AtomContainerManipulator.PercieveAtomTypesAndConfigureAtoms(subStructure); AddImplicitHydrogens(superStructure); AddImplicitHydrogens(subStructure); IFingerprinter fpr = new PubchemFingerprinter(); IBitFingerprint superBits = fpr.GetBitFingerprint(superStructure); IBitFingerprint subBits = fpr.GetBitFingerprint(subStructure); Assert.IsTrue(BitArrays.Equals( AsBitSet(9, 10, 14, 18, 19, 33, 143, 146, 255, 256, 283, 284, 285, 293, 301, 332, 344, 349, 351, 353, 355, 368, 370, 371, 376, 383, 384, 395, 401, 412, 416, 421, 423, 434, 441, 446, 449, 454, 455, 464, 470, 471, 480, 489, 490, 500, 502, 507, 513, 514, 516, 520, 524, 531, 532, 545, 546, 549, 552, 556, 558, 564, 570, 586, 592, 599, 600, 607, 633, 658, 665), subBits.AsBitSet())); Assert.IsTrue(BitArrays.Equals( AsBitSet(9, 10, 11, 14, 18, 19, 33, 34, 143, 146, 150, 153, 255, 256, 257, 258, 283, 284, 285, 293, 301, 332, 344, 349, 351, 353, 355, 368, 370, 371, 374, 376, 383, 384, 395, 401, 412, 416, 417, 421, 423, 427, 434, 441, 446, 449, 454, 455, 460, 464, 470, 471, 479, 480, 489, 490, 500, 502, 507, 513, 514, 516, 520, 524, 531, 532, 545, 546, 549, 552, 556, 558, 564, 570, 578, 582, 584, 586, 592, 595, 600, 603, 607, 608, 633, 634, 640, 658, 660, 664, 665, 668, 677, 678, 683), superBits.AsBitSet())); }
private IBitFingerprint CreateFP2() { IBitFingerprint fp = (IBitFingerprint)C.GetConstructor(Type.EmptyTypes).Invoke(new object[] { }); fp[2] = true; fp[3] = true; return(fp); }
/// <summary> /// While this test fails, Daylight says that the /// SMARTS pattern used for vinylogous ester should /// match benzaldehyde twice. So according to the /// supplied definition this answer is actually correct. /// </summary> // @cdk.bug 2871303 //("the SMARTS pattern vinylogous ester is not strict enough - we can not fix this") public static void TestVinylogousEster() { string benzaldehyde = "c1ccccc1C=O"; IFingerprinter fprinter = new SubstructureFingerprinter(); var sp = CDK.SmilesParser; IBitFingerprint fp = fprinter.GetBitFingerprint(sp.ParseSmiles(benzaldehyde)); Assert.IsFalse(fp[136], "Bit 136 (vinylogous ester) is set to true"); }
public void TestgetBitFingerprint_IAtomContainer() { Fingerprinter fingerprinter = new Fingerprinter(); var mol = TestMoleculeFactory.MakeIndole(); IBitFingerprint bs = fingerprinter.GetBitFingerprint(mol); Assert.IsNotNull(bs); Assert.AreEqual(fingerprinter.Length, bs.Length); }
public void TestFingerprint() { var parser = CDK.SmilesParser; IFingerprinter printer = new GraphOnlyFingerprinter(); IBitFingerprint bs1 = printer.GetBitFingerprint(parser.ParseSmiles("C=C-C#N")); IBitFingerprint bs2 = printer.GetBitFingerprint(parser.ParseSmiles("CCCN")); Assert.AreEqual(bs1, bs2); }
public static string ToExcelString(IBitFingerprint fp) { var sb = new StringBuilder(); for (int i = 0; i < fp.Length; i++) { sb.Append(fp[i] ? "1" : "0"); } return(sb.ToString()); }
public static void Main() { { #region var molecule = new AtomContainer(); IFingerprinter fingerprinter = new PubchemFingerprinter(Silent.ChemObjectBuilder.Instance); IBitFingerprint fingerprint = fingerprinter.GetBitFingerprint(molecule); Console.WriteLine(fingerprint.Length); // returns 881 #endregion } }
public void Or(IBitFingerprint fingerprint) { if (fingerprint is IntArrayFingerprint) { Or((IntArrayFingerprint)fingerprint); } else { //TODO add support for this? throw new NotSupportedException("OR on IntArrayFingerPrint only supported for other IntArrayFingerPrints for the moment"); } }
public void TestgetBitFingerprint_IAtomContainer() { ShortestPathFingerprinter fingerprinter = new ShortestPathFingerprinter(); IAtomContainer mol = TestMoleculeFactory.MakeIndole(); AtomContainerManipulator.PercieveAtomTypesAndConfigureAtoms(mol); IBitFingerprint bs = fingerprinter.GetBitFingerprint(mol); Assert.IsNotNull(bs); Assert.AreEqual(fingerprinter.Length, bs.Length); }
public void TestFingerprint() { var parser = CDK.SmilesParser; IFingerprinter printer = new EStateFingerprinter(); IBitFingerprint bs1 = printer.GetBitFingerprint(parser.ParseSmiles("C=C-C#N")); IBitFingerprint bs2 = printer.GetBitFingerprint(parser.ParseSmiles("C=CCC(O)CC#N")); Assert.AreEqual(79, printer.Length); Assert.IsTrue(bs1[7]); Assert.IsTrue(bs1[10]); Assert.IsTrue(FingerprinterTool.IsSubset(bs2.AsBitSet(), bs1.AsBitSet())); }
public void TestAtomPermutation() { IAtomContainer pamine = MakePropylAmine(); ShortestPathFingerprinter fp = new ShortestPathFingerprinter(); IBitFingerprint bs1 = fp.GetBitFingerprint(pamine); AtomContainerAtomPermutor acp = new AtomContainerAtomPermutor(pamine); while (acp.MoveNext()) { IAtomContainer container = acp.Current; IBitFingerprint bs2 = fp.GetBitFingerprint(container); Assert.IsTrue(bs1.Equals(bs2)); } }
public void TestAtomPermutation2() { IAtomContainer pamine = TestMoleculeFactory.MakeCyclopentane(); Fingerprinter fp = new Fingerprinter(); IBitFingerprint bs1 = fp.GetBitFingerprint(pamine); AtomContainerAtomPermutor acp = new AtomContainerAtomPermutor(pamine); while (acp.MoveNext()) { IAtomContainer container = acp.Current; IBitFingerprint bs2 = fp.GetBitFingerprint(container); Assert.IsTrue(bs1.Equals(bs2)); } }
public void TestEquals() { IBitFingerprint fp1 = (IBitFingerprint)C.GetConstructor(Type.EmptyTypes).Invoke(new object[] { }); IBitFingerprint fp2 = (IBitFingerprint)C.GetConstructor(Type.EmptyTypes).Invoke(new object[] { }); foreach (var fp in new IBitFingerprint[] { fp1, fp2 }) { fp[0] = true; fp[1] = false; fp[2] = true; } Assert.IsTrue(fp1.Equals(fp2), "identical fingerprints should be equal"); Assert.IsFalse(bitsetFP.Equals(fp1), "different fingerprints should not be equal"); Assert.IsTrue(fp1.GetHashCode() == fp2.GetHashCode(), "equal fingerprints must have same hashcode"); }
public void TestRegression() { IAtomContainer mol1 = TestMoleculeFactory.MakeIndole(); IAtomContainer mol2 = TestMoleculeFactory.MakePyrrole(); AtomContainerManipulator.PercieveAtomTypesAndConfigureAtoms(mol1); AtomContainerManipulator.PercieveAtomTypesAndConfigureAtoms(mol2); ShortestPathFingerprinter fingerprinter = new ShortestPathFingerprinter(); IBitFingerprint bs1 = fingerprinter.GetBitFingerprint(mol1); Assert.AreEqual(22, bs1.Cardinality, "Seems the fingerprint code has changed. This will cause a number of other tests to fail too!"); IBitFingerprint bs2 = fingerprinter.GetBitFingerprint(mol2); Assert.AreEqual(11, bs2.Cardinality, "Seems the fingerprint code has changed. This will cause a number of other tests to fail too!"); }
public void TestFunctionalGroupsBinary() { var printer = new SubstructureFingerprinter(); Assert.AreEqual(307, printer.Length); var sp = CDK.SmilesParser; var mol1 = sp.ParseSmiles("c1ccccc1CCC"); IBitFingerprint fp = printer.GetBitFingerprint(mol1); Assert.IsNotNull(fp); Assert.IsTrue(fp[273]); Assert.IsTrue(fp[0]); Assert.IsTrue(fp[1]); Assert.IsFalse(fp[100]); }
public BitSetFingerprint(IBitFingerprint fingerprint) { if (fingerprint is BitSetFingerprint) { bitset = (BitArray)((BitSetFingerprint)fingerprint).bitset.Clone(); } else { var bitSet = new BitArray((int)fingerprint.Length); for (int i = 0; i < fingerprint.Length; i++) { bitSet.Set(i, fingerprint[i]); } this.bitset = bitSet; } }
public void TestRegression() { IAtomContainer mol1 = TestMoleculeFactory.MakeIndole(); IAtomContainer mol2 = TestMoleculeFactory.MakePyrrole(); Fingerprinter fingerprinter = new Fingerprinter(1024, 8); IBitFingerprint bs1 = fingerprinter.GetBitFingerprint(mol1); Assert.AreEqual( 33, bs1.Cardinality, "Seems the fingerprint code has changed. This will cause a number of other tests to fail too!"); IBitFingerprint bs2 = fingerprinter.GetBitFingerprint(mol2); Assert.AreEqual( 13, bs2.Cardinality, "Seems the fingerprint code has changed. This will cause a number of other tests to fail too!"); }
public void TestAtomPermutation2() { IAtomContainer pamine = TestMoleculeFactory.MakeCyclopentane(); AtomContainerManipulator.PercieveAtomTypesAndConfigureAtoms(pamine); ShortestPathFingerprinter fp = new ShortestPathFingerprinter(); IBitFingerprint bs1 = fp.GetBitFingerprint(pamine); AtomContainerAtomPermutor acp = new AtomContainerAtomPermutor(pamine); while (acp.MoveNext()) { IAtomContainer container = acp.Current; IBitFingerprint bs2 = fp.GetBitFingerprint(container); Assert.IsTrue(bs1.Equals(bs2)); } }
public void Or(IBitFingerprint fingerprint) { if (bitset.Count != fingerprint.Length) { throw new ArgumentException("Fingerprints must have same size"); } if (fingerprint is BitSetFingerprint) { bitset.Or(((BitSetFingerprint)fingerprint).bitset); } else { for (int i = 0; i < bitset.Count; i++) { bitset.Set(i, bitset[i] || fingerprint[i]); } } }
/// <summary> /// Evaluates Tanimoto coefficient for two <see cref="IBitFingerprint"/>. /// </summary> /// <param name="fingerprint1">fingerprint for the first molecule</param> /// <param name="fingerprint2">fingerprint for the second molecule</param> /// <returns>The Tanimoto coefficient</returns> /// <exception cref="ArgumentException">if bitsets are not of the same length</exception> public static double Calculate(IBitFingerprint fingerprint1, IBitFingerprint fingerprint2) { if (fingerprint1.Length != fingerprint2.Length) { throw new ArgumentException("Fingerprints must have the same size"); } int cardinality1 = fingerprint1.Cardinality; int cardinality2 = fingerprint2.Cardinality; // If the fingerprint is an IntArrayFingeprint that could mean a big // fingerprint so let's take the safe way out and create a // new IntArrayfingerprint IBitFingerprint one_and_two = fingerprint1 is IntArrayFingerprint ? (IBitFingerprint) new IntArrayFingerprint( fingerprint1) : (IBitFingerprint) new BitSetFingerprint(fingerprint1); one_and_two.And(fingerprint2); double cardinalityCommon = one_and_two.Cardinality; return(cardinalityCommon / (cardinality1 + cardinality2 - cardinalityCommon)); }
public IntArrayFingerprint(IBitFingerprint fingerprint) { // if it is an IntArrayFingerprint we can do faster (Array.Copy) if (fingerprint is IntArrayFingerprint iaFP) { trueBits = new int[iaFP.trueBits.Length]; Array.Copy(iaFP.trueBits, 0, trueBits, 0, trueBits.Length); } else { trueBits = new int[fingerprint.Cardinality]; int index = 0; for (int i = 0; i < fingerprint.Length; i++) { if (fingerprint[i]) { trueBits[index++] = i; } } } }
public override void TestBug706786() { IAtomContainer superStructure = Bug706786_1(); IAtomContainer subStructure = Bug706786_2(); AtomContainerManipulator.PercieveAtomTypesAndConfigureAtoms(superStructure); AtomContainerManipulator.PercieveAtomTypesAndConfigureAtoms(subStructure); AddImplicitHydrogens(superStructure); AddImplicitHydrogens(subStructure); IFingerprinter fpr = new MACCSFingerprinter(); IBitFingerprint superBits = fpr.GetBitFingerprint(superStructure); IBitFingerprint subBits = fpr.GetBitFingerprint(subStructure); Assert.IsTrue(BitArrays.Equals( AsBitSet(53, 56, 65, 71, 73, 88, 97, 104, 111, 112, 126, 130, 136, 138, 139, 140, 142, 143, 144, 145, 148, 149, 151, 153, 156, 158, 159, 161, 162, 163, 164), superBits.AsBitSet())); Assert.IsTrue(BitArrays.Equals( AsBitSet(56, 97, 104, 108, 112, 117, 131, 136, 143, 144, 146, 151, 152, 156, 161, 162, 163, 164), subBits.AsBitSet())); }
public override void TestBug706786() { IAtomContainer superStructure = Bug706786_1(); IAtomContainer subStructure = Bug706786_2(); AtomContainerManipulator.PercieveAtomTypesAndConfigureAtoms(superStructure); AtomContainerManipulator.PercieveAtomTypesAndConfigureAtoms(subStructure); AddImplicitHydrogens(superStructure); AddImplicitHydrogens(subStructure); // SMARTS is now correct and D will include H atoms, CDK had this wrong // for years (had it has non-H count). Whilst you can set the optional // SMARTS flavor CDK_LEGACY this is not correct AtomContainerManipulator.SuppressHydrogens(superStructure); AtomContainerManipulator.SuppressHydrogens(subStructure); IFingerprinter fpr = new EStateFingerprinter(); IBitFingerprint superBits = fpr.GetBitFingerprint(superStructure); IBitFingerprint subBits = fpr.GetBitFingerprint(subStructure); Assert.IsTrue(BitArrays.Equals(AsBitSet(6, 11, 12, 15, 16, 18, 33, 34, 35), superBits.AsBitSet())); Assert.IsTrue(BitArrays.Equals(AsBitSet(8, 11, 16, 35), subBits.AsBitSet())); }
public void TestUserFunctionalGroups() { string[] smarts = { "c1ccccc1", "[CX4H3][#6]", "[CX2]#[CX2]" }; var printer = new SubstructureFingerprinter(smarts); Assert.AreEqual(3, printer.Length); var sp = CDK.SmilesParser; var mol1 = sp.ParseSmiles("c1ccccc1CCC"); IBitFingerprint fp = printer.GetBitFingerprint(mol1); Assert.IsNotNull(fp); Assert.IsTrue(fp[0]); Assert.IsTrue(fp[1]); Assert.IsFalse(fp[2]); mol1 = sp.ParseSmiles("C=C=C"); fp = printer.GetBitFingerprint(mol1); Assert.IsNotNull(fp); Assert.IsFalse(fp[0]); Assert.IsFalse(fp[1]); Assert.IsFalse(fp[2]); }
private Type C; // : IBitFingerprint public AbstractBitFingerprintTest(Type C) { this.C = C; bitsetFP = (IBitFingerprint)C.GetConstructor(Type.EmptyTypes).Invoke(new object[] { }); }
/// <summary> /// Build fingerprint /// </summary> /// <param name="mol"></param> public static BitSetFingerprint BuildBitSetFingerprint( IAtomContainer mol, FingerprintType fpType, int fpSubtype = -1, int fpLen = -1) { // Data for Tanimoto similarity using various fingerprint types for CorpId 123456 query. // Cart - Standard MDL Oracle Cartridge scores // // Similarity Score // ------------------------------------------------ // Size -> 192 896 1024 1024 128 1024 320 // CorpId Cart MACCS PbChm ECFP4 EXT EState Basic Sbstr // ------ ---- ---- ---- ---- ---- ---- ---- ---- // 123456 0.99 1.00 1.00 1.00 1.00 1.00 1.00 1.00 // 123456 0.99 0.98 0.96 0.77 0.95 1.00 0.95 1.00 // 123456 0.99 0.98 0.96 0.77 0.95 1.00 0.94 1.00 // 123456 0.99 1.00 1.00 1.00 1.00 1.00 1.00 1.00 // 123456 0.99 1.00 1.00 1.00 1.00 1.00 1.00 1.00 // 123456 0.99 0.91 1.00 0.81 1.00 1.00 1.00 1.00 // 123456 0.98 0.95 1.00 0.74 0.92 1.00 0.93 0.94 // 123456 0.98 1.00 1.00 1.00 1.00 1.00 1.00 1.00 // 123456 0.98 1.00 1.00 1.00 1.00 1.00 1.00 1.00 // 123456 0.98 1.00 0.83 0.76 0.77 0.90 0.76 0.94 // LSH Bin Count - The number of LSH bins (of 25) that match the query bin values //-------------- // CorpId MAC PbC ECFP EX // ------ --- --- --- --- // 123456 25 25 25 25 // 123456 25 20 7 16 // 123456 25 20 9 19 // 123456 25 25 25 25 // 123456 25 25 25 25 // 123456 20 25 9 25 // 123456 21 25 11 17 // 123456 25 25 25 25 // 123456 25 25 25 25 // 123456 25 9 6 11 // Data for Tanimoto similarity using various Circular fingerprint types. // Using 2 molecules where the 2nd just has an added methyl group. // // Measure Score // -------- ----- // ECFP0 1.00 // ECFP2 .88 // ECFP4 .75 // ECFP6 .64 // FCFP0 1.00 // FCFP2 .92 // FCFP4 .84 // FCFP6 .74 IFingerprinter ifptr = null; IBitFingerprint ibfp = null; BitSetFingerprint bfp = null; IAtomContainer mol2; string s = ""; DateTime t0 = DateTime.Now; double getFptrTime = 0, buildFpTime = 0; if (fpType == FingerprintType.Basic) // size = 1024 { ifptr = new Fingerprinter(); } else if (fpType == FingerprintType.Circular) // size variable { CircularFingerprinterClass cfpClass = (CircularFingerprinterClass)fpSubtype; if (cfpClass < CircularFingerprinterClass.ECFP0 || cfpClass > CircularFingerprinterClass.ECFP6) { cfpClass = (CircularFingerprinterClass)CircularFingerprintType.DefaultCircularClass; // default class } if (fpLen < 0) { fpLen = CircularFingerprintType.DefaultCircularLength; // default length } ifptr = new CircularFingerprinter(cfpClass, fpLen); //CircularFingerprinter cfp = (CircularFingerprinter)ifptr; //ICountFingerprint cntFp = cfp.getCountFingerprint(mol); // debug //s = CircularFpToString(cfp); // debug } else if (fpType == FingerprintType.Extended) // size = 1024 { ifptr = new ExtendedFingerprinter(); // use DEFAULT_SIZE and DEFAULT_SEARCH_DEPTH } else if (fpType == FingerprintType.EState) // size = 128 { ifptr = new EStateFingerprinter(); // use DEFAULT_SIZE and DEFAULT_SEARCH_DEPTH } else if (fpType == FingerprintType.MACCS) // size = 192 { if (MACCSFp == null) { MACCSFp = new MACCSFingerprinter(); } ifptr = MACCSFp; } else if (fpType == FingerprintType.PubChem) // size = 896 { //IChemObjectBuilder builder = DefaultChemObjectBuilder.getInstance(); ifptr = new PubchemFingerprinter(); } else if (fpType == FingerprintType.ShortestPath) // size = { ifptr = new ShortestPathFingerprinter(); // fails with atom type issue for many structures (e.g. 123456) } else if (fpType == FingerprintType.Signature) // size = { ifptr = new SignatureFingerprinter(); // can't convert array fingerprint to bitsetfingerprint } else if (fpType == FingerprintType.Substructure) // size = 320 { ifptr = new SubstructureFingerprinter(); } else { throw new Exception("Invalid CdkFingerprintType: " + fpType); } getFptrTime = TimeOfDay.Delta(ref t0); ibfp = ifptr.GetBitFingerprint(mol); bfp = (BitSetFingerprint)ibfp; buildFpTime = TimeOfDay.Delta(ref t0); //long size = bfp.size(); //int card = bfp.Cardinality; return(bfp); }
/// <summary> /// BuildTest /// </summary> public static void BuildTest() { CircularFingerprinter cfp = null; CircularFingerprinterClass FpClass = CircularFingerprinterClass.ECFP6; // FP diameter int FpLen = 2048; // folded binary fp length IAtomContainer mol, mol2; //string molfile = FileUtil.ReadFile(@"C:\Download\CorpId-12345.mol"); //java.io.StringReader sr = new java.io.StringReader(molfile); //if (Lex.Contains(molfile, "v2000")) // cor = new MDLV2000Reader(sr); //else // cor = new MDLV3000Reader(sr); //cor.setReaderMode(IChemObjectReader.Mode.RELAXED); //ac = (IAtomContainer)cor.read(new AtomContainer()); //cor.close(); FpClass = CircularFingerprinterClass.ECFP4; // debug cfp = new CircularFingerprinter(FpClass, FpLen); StreamReader reader = new StreamReader(@"C:\Download\CorpId-12345.mol"); //FileReader FileReader = new FileReader(@"C:\Download\V3000 Mols.sdf"); EnumerableSDFReader rdr = new EnumerableSDFReader(reader.BaseStream, ChemObjectBuilder.Instance); rdr.ReaderMode = ChemObjectReaderMode.Relaxed; IEnumerator <IAtomContainer> cursor = rdr.GetEnumerator(); while (cursor.MoveNext()) { mol = cursor.Current; mol = CdkMol.GetLargestMoleculeFragment(mol); ICountFingerprint cfp1 = cfp.GetCountFingerprint(mol); // get hash values and counts for each cfp.Calculate(mol); int fpCount = cfp.FPCount; for (int fpi = 0; fpi < fpCount; fpi++) // gets { CircularFingerprint cfp2 = cfp.GetFP(fpi); // gets hash, iteration and lists of atoms (dups appear multiple times) } IBitFingerprint bfp = cfp.GetBitFingerprint(mol); BitArray bs = bfp.AsBitSet(); int bsCard = bfp.Cardinality; long bsSize = bfp.Length; continue; } reader.Close(); return; //java.io.StringReader sr = new java.io.StringReader(molfile); //AtomContainer mol = new AtomContainer(); //mol.addAtom(new Atom("C")); //mol.addAtom(new Atom("H")); //mol.addAtom(new Atom("H")); //mol.addAtom(new Atom("H")); //mol.addAtom(new Atom("H")); //mol.addBond(new Bond(mol.getAtom(0), mol.getAtom(1))); //mol.addBond(new Bond(mol.getAtom(0), mol.getAtom(2))); //mol.addBond(new Bond(mol.getAtom(0), mol.getAtom(3))); //mol.addBond(new Bond(mol.getAtom(0), mol.getAtom(4))); //FileReader FileReader = new FileReader(@"C:\Download\CorpId-12345.mol"); //MolReader mr = new MolReader(FileReader, DefaultChemObjectBuilder.getInstance()); //java.io.StringReader sr = new java.io.StringReader(molfile); //IMol m = (IMol)mr.next(); //FileReader.close(); }