Exemple #1
0
        public void TestFingerprint()
        {
            IFingerprinter printer = new PubchemFingerprinter();
            var            adder   = CDK.HydrogenAdder;

            var mol1 = parser.ParseSmiles("c1ccccc1CCc1ccccc1");
            var mol2 = parser.ParseSmiles("c1ccccc1CC");

            AtomContainerManipulator.PercieveAtomTypesAndConfigureAtoms(mol1);
            AtomContainerManipulator.PercieveAtomTypesAndConfigureAtoms(mol2);

            adder.AddImplicitHydrogens(mol1);
            adder.AddImplicitHydrogens(mol2);

            AtomContainerManipulator.ConvertImplicitToExplicitHydrogens(mol1);
            AtomContainerManipulator.ConvertImplicitToExplicitHydrogens(mol2);

            Aromaticity.CDKLegacy.Apply(mol1);
            Aromaticity.CDKLegacy.Apply(mol2);

            BitArray bs1 = printer.GetBitFingerprint(mol1).AsBitSet();
            BitArray bs2 = printer.GetBitFingerprint(mol2).AsBitSet();

            Assert.AreEqual(881, printer.Length);

            Assert.IsFalse(FingerprinterTool.IsSubset(bs1, bs2),
                           "c1ccccc1CC was detected as a subset of c1ccccc1CCc1ccccc1");
        }
        public void TestBug853254()
        {
            var            builder        = CDK.Builder;
            var            filename       = "NCDK.Data.MDL.bug853254-2.mol";
            var            ins            = ResourceLoader.GetAsStream(filename);
            var            reader         = new MDLV2000Reader(ins, ChemObjectReaderMode.Strict);
            IAtomContainer superstructure = (IAtomContainer)reader.Read(builder.NewAtomContainer());

            filename = "NCDK.Data.MDL.bug853254-1.mol";
            ins      = ResourceLoader.GetAsStream(filename);
            reader   = new MDLV2000Reader(ins, ChemObjectReaderMode.Strict);
            IAtomContainer substructure = (IAtomContainer)reader.Read(builder.NewAtomContainer());

            // these molecules are different resonance forms of the same molecule
            // make sure aromaticity is detected. although some fingerprinters do this
            // one should not expected all implementations to do so.
            AtomContainerManipulator.PercieveAtomTypesAndConfigureAtoms(superstructure);
            AtomContainerManipulator.PercieveAtomTypesAndConfigureAtoms(substructure);
            Aromaticity.CDKLegacy.Apply(superstructure);
            Aromaticity.CDKLegacy.Apply(substructure);

            IFingerprinter fingerprinter = GetBitFingerprinter();
            BitArray       superBS       = fingerprinter.GetBitFingerprint(superstructure).AsBitSet();
            BitArray       subBS         = fingerprinter.GetBitFingerprint(substructure).AsBitSet();
            bool           isSubset      = FingerprinterTool.IsSubset(superBS, subBS);

            Assert.IsTrue(isSubset);
        }
        public void Testfp2()
        {
            var            parser  = CDK.SmilesParser;
            IFingerprinter printer = new MACCSFingerprinter();

            var mol1 = parser.ParseSmiles("CC(N)CCCN");
            var mol2 = parser.ParseSmiles("CC(N)CCC");
            var mol3 = parser.ParseSmiles("CCCC");

            AtomContainerManipulator.PercieveAtomTypesAndConfigureAtoms(mol1);
            AtomContainerManipulator.PercieveAtomTypesAndConfigureAtoms(mol2);
            AtomContainerManipulator.PercieveAtomTypesAndConfigureAtoms(mol3);

            Aromaticity.CDKLegacy.Apply(mol1);
            Aromaticity.CDKLegacy.Apply(mol2);
            Aromaticity.CDKLegacy.Apply(mol3);

            BitArray bs1 = printer.GetBitFingerprint(mol1).AsBitSet();
            BitArray bs2 = printer.GetBitFingerprint(mol2).AsBitSet();
            BitArray bs3 = printer.GetBitFingerprint(mol3).AsBitSet();

            Assert.IsFalse(bs1[124]);
            Assert.IsFalse(bs2[124]);
            Assert.IsFalse(bs3[124]);

            Assert.IsFalse(FingerprinterTool.IsSubset(bs1, bs2));
            Assert.IsTrue(FingerprinterTool.IsSubset(bs2, bs3));
        }
        public void TestBug2819557()
        {
            IAtomContainer butane      = MakeButane();
            IAtomContainer propylAmine = MakePropylAmine();

            ShortestPathFingerprinter fp = new ShortestPathFingerprinter();
            BitArray b1 = fp.GetBitFingerprint(butane).AsBitSet();
            BitArray b2 = fp.GetBitFingerprint(propylAmine).AsBitSet();

            Assert.IsFalse(FingerprinterTool.IsSubset(b2, b1), "butane should not be a substructure of propylamine");
        }
        public void TestIsSubSet_BitSet_BitSet()
        {
            Fingerprinter fingerprinter = new Fingerprinter();

            IAtomContainer mol   = TestMoleculeFactory.MakeIndole();
            BitArray       bs    = fingerprinter.GetBitFingerprint(mol).AsBitSet();
            IAtomContainer frag1 = TestMoleculeFactory.MakePyrrole();
            BitArray       bs1   = fingerprinter.GetBitFingerprint(frag1).AsBitSet();

            Assert.IsTrue(FingerprinterTool.IsSubset(bs, bs1));
        }
Exemple #6
0
        public void TestFingerprint()
        {
            var parser  = CDK.SmilesParser;
            var printer = GetBitFingerprinter();

            var bs1 = printer.GetBitFingerprint(parser.ParseSmiles("C=C-C#N")).AsBitSet();
            var bs2 = printer.GetBitFingerprint(parser.ParseSmiles("C=CCC(O)CC#N")).AsBitSet();

            Assert.AreEqual(4860, printer.Length);

            Assert.IsTrue(FingerprinterTool.IsSubset(bs2, bs1));
        }
        public void TestDifferentRingFinders()
        {
            var fingerprinter = new ExtendedFingerprinter();
            var ac1           = builder.NewAtomContainer();
            var atom1         = builder.NewAtom("C");
            var atom2         = builder.NewAtom("C");
            var atom3         = builder.NewAtom("C");
            var atom4         = builder.NewAtom("C");
            var atom5         = builder.NewAtom("C");
            var atom6         = builder.NewAtom("C");

            ac1.Atoms.Add(atom1);
            ac1.Atoms.Add(atom2);
            ac1.Atoms.Add(atom3);
            ac1.Atoms.Add(atom4);
            ac1.Atoms.Add(atom5);
            ac1.Atoms.Add(atom6);
            var bond1 = builder.NewBond(atom1, atom2);
            var bond2 = builder.NewBond(atom2, atom3);
            var bond3 = builder.NewBond(atom3, atom4);
            var bond4 = builder.NewBond(atom4, atom5);
            var bond5 = builder.NewBond(atom5, atom6);
            var bond6 = builder.NewBond(atom6, atom1);

            ac1.Bonds.Add(bond1);
            ac1.Bonds.Add(bond2);
            ac1.Bonds.Add(bond3);
            ac1.Bonds.Add(bond4);
            ac1.Bonds.Add(bond5);
            ac1.Bonds.Add(bond6);
            var ac2 = builder.NewAtomContainer();

            ac2.Atoms.Add(atom1);
            ac2.Atoms.Add(atom2);
            ac2.Atoms.Add(atom3);
            ac2.Atoms.Add(atom4);
            ac2.Atoms.Add(atom5);
            ac2.Atoms.Add(atom6);
            var bond7 = builder.NewBond(atom3, atom1);

            ac2.Bonds.Add(bond1);
            ac2.Bonds.Add(bond2);
            ac2.Bonds.Add(bond3);
            ac2.Bonds.Add(bond4);
            ac2.Bonds.Add(bond5);
            ac2.Bonds.Add(bond6);
            ac2.Bonds.Add(bond7);
            var bs  = fingerprinter.GetBitFingerprint(ac1).AsBitSet();
            var bs1 = fingerprinter.GetBitFingerprint(ac2).AsBitSet();

            Assert.IsTrue(FingerprinterTool.IsSubset(bs1, bs));
            Assert.IsFalse(FingerprinterTool.IsSubset(bs, bs1));
        }
        public void TestExtendedFingerprinter_int()
        {
            IFingerprinter fingerprinter = new ExtendedFingerprinter(512);

            Assert.IsNotNull(fingerprinter);

            IAtomContainer mol   = TestMoleculeFactory.MakeIndole();
            BitArray       bs    = fingerprinter.GetBitFingerprint(mol).AsBitSet();
            IAtomContainer frag1 = TestMoleculeFactory.MakePyrrole();
            BitArray       bs1   = fingerprinter.GetBitFingerprint(frag1).AsBitSet();

            Assert.IsTrue(FingerprinterTool.IsSubset(bs, bs1));
            Assert.IsFalse(FingerprinterTool.IsSubset(bs1, bs));
        }
Exemple #9
0
        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 MakeCountFingerprint()
        {
            var features = new Dictionary <string, int>
            {
                { "CCO", 1 },
                { "CC", 2 },
                { "C", 2 }
            };
            var fp = FingerprinterTool.MakeCountFingerprint(features);

            Assert.AreEqual(3, fp.GetNumberOfPopulatedBins());
            Assert.AreEqual(1, fp.GetCountForHash("CCO".GetHashCode()));
            Assert.AreEqual(2, fp.GetCountForHash("CC".GetHashCode()));
            Assert.AreEqual(2, fp.GetCountForHash("C".GetHashCode()));
        }
        public void MakeBitFingerprint()
        {
            var features = new Dictionary <string, int>
            {
                { "CCO", 1 },
                { "CC", 1 },
                { "C", 1 }
            };
            var fp = FingerprinterTool.MakeBitFingerprint(features, 1024, 1);

            Assert.IsTrue(3 >= fp.Cardinality);
            Assert.IsTrue(fp[(int)((uint)"CCO".GetHashCode() % 1024)]);
            Assert.IsTrue(fp[(int)((uint)"CC".GetHashCode() % 1024)]);
            Assert.IsTrue(fp[(int)((uint)"C".GetHashCode() % 1024)]);
        }
        public void TestDifferences()
        {
            BitArray bs1 = new BitArray(4);
            BitArray bs2 = new BitArray(5);

            bs1.Set(0, true);
            bs2.Set(0, true);
            bs1.Set(1, true);
            bs1.Set(2, true);
            bs2.Set(2, true);
            bs1.Set(3, true);
            bs2.Set(4, true);

            Assert.AreEqual(3, FingerprinterTool.Differences(bs1, bs2).Count);
        }
        public void TestgetBitFingerprintIAtomContainerIRingSetList()
        {
            var fingerprinter = new ExtendedFingerprinter();

            Assert.IsNotNull(fingerprinter);

            var mol    = TestMoleculeFactory.MakeIndole();
            var rs     = Cycles.FindSSSR(mol).ToRingSet();
            var rslist = RingPartitioner.PartitionRings(rs);
            var bs     = fingerprinter.GetBitFingerprint(mol, rs, rslist).AsBitSet();
            var frag1  = TestMoleculeFactory.MakePyrrole();
            var bs1    = fingerprinter.GetBitFingerprint(frag1).AsBitSet();

            Assert.IsTrue(FingerprinterTool.IsSubset(bs, bs1));
            Assert.IsFalse(FingerprinterTool.IsSubset(bs1, bs));
        }
 public void Main()
 {
     {
         #region IsSubset
         var mol           = TestMoleculeFactory.MakeIndole();
         var fingerprinter = new Fingerprinter();
         var bs            = fingerprinter.GetBitFingerprint(mol);
         var frag1         = TestMoleculeFactory.MakePyrrole();
         var bs1           = fingerprinter.GetBitFingerprint(frag1);
         if (FingerprinterTool.IsSubset(bs.AsBitSet(), bs1.AsBitSet()))
         {
             Console.Out.WriteLine("Pyrrole is subset of Indole.");
         }
         #endregion
     }
 }
Exemple #15
0
        public void TestFingerPrint()
        {
            IFingerprinter printer = new GraphOnlyFingerprinter();

            IAtomContainer mol1 = CreateMolecule(molecule_test_2);
            IAtomContainer mol2 = CreateMolecule(ethanolamine);

            Assert.IsTrue(new UniversalIsomorphismTester().IsSubgraph(mol1, mol2), "SubGraph does NOT match");

            BitArray bs1 = printer.GetBitFingerprint((IAtomContainer)mol1.Clone()).AsBitSet();
            BitArray bs2 = printer.GetBitFingerprint((IAtomContainer)mol2.Clone()).AsBitSet();

            Assert.IsTrue(FingerprinterTool.IsSubset(bs1, bs2), "Subset (with fingerprint) does NOT match");

            // Match OK
            Debug.WriteLine("Subset (with fingerprint) does match");
        }
        public void TestFingerprinter_int_int()
        {
            ShortestPathFingerprinter fingerprinter = new ShortestPathFingerprinter(1024);

            Assert.IsNotNull(fingerprinter);

            IAtomContainer mol = TestMoleculeFactory.MakeIndole();

            AtomContainerManipulator.PercieveAtomTypesAndConfigureAtoms(mol);
            BitArray       bs    = fingerprinter.GetBitFingerprint(mol).AsBitSet();
            IAtomContainer frag1 = TestMoleculeFactory.MakePyrrole();

            AtomContainerManipulator.PercieveAtomTypesAndConfigureAtoms(frag1);
            BitArray bs1 = fingerprinter.GetBitFingerprint(frag1).AsBitSet();

            Assert.IsTrue(FingerprinterTool.IsSubset(bs, bs1));
        }
        public void TestListDifferences_BitSet_BitSet()
        {
            BitArray bs1 = new BitArray(4);
            BitArray bs2 = new BitArray(5);

            bs1.Set(0, true);
            bs2.Set(0, true);
            bs1.Set(1, true);
            bs1.Set(2, true);
            bs2.Set(2, true);
            bs1.Set(3, true);
            bs2.Set(4, true);

            // 2 bits set in bs1 which are clear in bs2
            Assert.AreEqual(2, FingerprinterTool.ListDifferences(bs2, bs1).Count);
            // 2 bits set in bs2 which are clear in bs1
            Assert.AreEqual(1, FingerprinterTool.ListDifferences(bs1, bs2).Count);
        }
        public void TestGenerateFingerprintIsNotASubSet1()
        {
            string smilesT      = "O[C@H]1[C@H](O)[C@@H](O)[C@H](O)[C@H](O)[C@@H]1O";
            string smilesQ      = "OC[C@@H](O)[C@@H](O)[C@H](O)[C@@H](O)C(O)=O";
            var    smilesParser = new SmilesParser(builder, false);
            var    moleculeQ    = smilesParser.ParseSmiles(smilesQ);
            var    moleculeT    = smilesParser.ParseSmiles(smilesT);

            AtomContainerManipulator.PercieveAtomTypesAndConfigureAtoms(moleculeQ);
            AtomContainerManipulator.PercieveAtomTypesAndConfigureAtoms(moleculeT);

            ShortestPathFingerprinter fingerprint = new ShortestPathFingerprinter(1024);
            BitArray fingerprintQ;
            BitArray fingerprintT;

            fingerprintQ = fingerprint.GetBitFingerprint(moleculeQ).AsBitSet();
            fingerprintT = fingerprint.GetBitFingerprint(moleculeT).AsBitSet();
            Assert.IsFalse(FingerprinterTool.IsSubset(fingerprintT, fingerprintQ));
        }
        public void TestGenerateFingerprintIsSubset()
        {
            string smilesT      = "NC(=O)C1=C2C=CC(Br)=CC2=C(Cl)C=C1";
            string smilesQ      = "CC1=C2C=CC(Br)=CC2=C(Cl)C=C1";
            var    smilesParser = CDK.SmilesParser;
            var    moleculeQ    = smilesParser.ParseSmiles(smilesQ);
            var    moleculeT    = smilesParser.ParseSmiles(smilesT);

            AtomContainerManipulator.PercieveAtomTypesAndConfigureAtoms(moleculeQ);
            AtomContainerManipulator.PercieveAtomTypesAndConfigureAtoms(moleculeT);

            ShortestPathFingerprinter fingerprint = new ShortestPathFingerprinter(1024);
            BitArray fingerprintQ;
            BitArray fingerprintT;

            fingerprintQ = fingerprint.GetBitFingerprint(moleculeQ).AsBitSet();
            fingerprintT = fingerprint.GetBitFingerprint(moleculeT).AsBitSet();

            Assert.IsTrue(FingerprinterTool.IsSubset(fingerprintT, fingerprintQ));
        }
Exemple #20
0
        public void PseudoAtomFingerprintArom()
        {
            SmilesParser  smipar    = CDK.SmilesParser;
            string        query     = "*1cnccc1";
            string        indole    = "n1cnccc1";
            var           queryMol  = smipar.ParseSmiles(query);
            var           indoleMol = smipar.ParseSmiles(indole);
            Fingerprinter fpr       = new Fingerprinter();
            BitArray      fp1       = fpr.GetFingerprint(queryMol);
            BitArray      fp2       = fpr.GetFingerprint(indoleMol);

            Assert.IsTrue(FingerprinterTool.IsSubset(fp2, fp1));
            Assert.IsFalse(FingerprinterTool.IsSubset(fp1, fp2));
            fpr.SetHashPseudoAtoms(true);
            BitArray fp3 = fpr.GetFingerprint(queryMol);
            BitArray fp4 = fpr.GetFingerprint(indoleMol);

            Assert.IsFalse(FingerprinterTool.IsSubset(fp4, fp3));
            Assert.IsFalse(FingerprinterTool.IsSubset(fp3, fp4));
        }
Exemple #21
0
        public void TestCountableMACCSBinary()
        {
            // Tests are modified copy of the test included in the MACCS-FPs class
            var parser  = CDK.SmilesParser;
            var printer = new SubstructureFingerprinter(StandardSubstructureSets.GetCountableMACCSSMARTS());

            Assert.AreEqual(142, printer.Length);
            var mol0 = parser.ParseSmiles("CC(N)CCCN");
            var mol1 = parser.ParseSmiles("c1ccccc1CCc1ccccc1");
            var mol2 = parser.ParseSmiles("c1ccccc1CC");
            var mol3 = parser.ParseSmiles("CC(N)CCC");
            var mol4 = parser.ParseSmiles("CCCC");

            AtomContainerManipulator.PercieveAtomTypesAndConfigureAtoms(mol0);
            AtomContainerManipulator.PercieveAtomTypesAndConfigureAtoms(mol1);
            AtomContainerManipulator.PercieveAtomTypesAndConfigureAtoms(mol2);
            AtomContainerManipulator.PercieveAtomTypesAndConfigureAtoms(mol3);
            AtomContainerManipulator.PercieveAtomTypesAndConfigureAtoms(mol4);
            Aromaticity.CDKLegacy.Apply(mol0);
            Aromaticity.CDKLegacy.Apply(mol1);
            Aromaticity.CDKLegacy.Apply(mol2);
            Aromaticity.CDKLegacy.Apply(mol3);
            Aromaticity.CDKLegacy.Apply(mol4);
            var bs0 = printer.GetBitFingerprint(mol0).AsBitSet();
            var bs1 = printer.GetBitFingerprint(mol1).AsBitSet();
            var bs2 = printer.GetBitFingerprint(mol2).AsBitSet();
            var bs3 = printer.GetBitFingerprint(mol3).AsBitSet();
            var bs4 = printer.GetBitFingerprint(mol4).AsBitSet();

            // Check for the aromatic 6M rings
            Assert.IsFalse(bs0[111]);
            Assert.IsTrue(bs1[111]);
            Assert.IsTrue(bs2[111]);
            Assert.IsFalse(bs3[111]);
            Assert.IsFalse(bs4[111]);
            // Check for the fingerprints being subsets
            Assert.IsFalse(FingerprinterTool.IsSubset(bs1, bs2));
            Assert.IsFalse(FingerprinterTool.IsSubset(bs0, bs3));
            Assert.IsTrue(FingerprinterTool.IsSubset(bs3, bs4));
        }
        public void TestBug771485()
        {
            var            builder    = CDK.Builder;
            var            filename   = "NCDK.Data.MDL.bug771485-1.mol";
            var            ins        = ResourceLoader.GetAsStream(filename);
            var            reader     = new MDLV2000Reader(ins, ChemObjectReaderMode.Strict);
            IAtomContainer structure1 = (IAtomContainer)reader.Read(builder.NewAtomContainer());

            filename = "NCDK.Data.MDL.bug771485-2.mol";
            ins      = ResourceLoader.GetAsStream(filename);
            reader   = new MDLV2000Reader(ins, ChemObjectReaderMode.Strict);
            IAtomContainer structure2 = (IAtomContainer)reader.Read(builder.NewAtomContainer());

            // these molecules are different resonance forms of the same molecule
            // make sure aromaticity is detected. although some fingerprinters do this
            // one should not expected all implementations to do so.
            AtomContainerManipulator.PercieveAtomTypesAndConfigureAtoms(structure1);
            AtomContainerManipulator.PercieveAtomTypesAndConfigureAtoms(structure2);
            Aromaticity.CDKLegacy.Apply(structure1);
            Aromaticity.CDKLegacy.Apply(structure2);
            AddImplicitHydrogens(structure1);
            AddImplicitHydrogens(structure2);

            Kekulization.Kekulize(structure1);
            Kekulization.Kekulize(structure2);

            // hydrogens loaded from MDL mol files if non-query. Structure 2 has
            // query aromatic bonds and the hydrogen counts are not assigned - ensure
            // this is done here.
            CDK.HydrogenAdder.AddImplicitHydrogens(structure1);
            CDK.HydrogenAdder.AddImplicitHydrogens(structure2);

            IFingerprinter fingerprinter = GetBitFingerprinter();
            BitArray       superBS       = fingerprinter.GetBitFingerprint(structure2).AsBitSet();
            BitArray       subBS         = fingerprinter.GetBitFingerprint(structure1).AsBitSet();
            bool           isSubset      = FingerprinterTool.IsSubset(superBS, subBS);

            Assert.IsTrue(isSubset);
        }
Exemple #23
0
        public void Testfp2()
        {
            IFingerprinter printer = new PubchemFingerprinter(ChemObjectBuilder.Instance);

            var mol1 = parser.ParseSmiles("CC(N)CCCN");
            var mol2 = parser.ParseSmiles("CC(N)CCC");
            var mol3 = parser.ParseSmiles("CCCC");

            AtomContainerManipulator.PercieveAtomTypesAndConfigureAtoms(mol1);
            AtomContainerManipulator.PercieveAtomTypesAndConfigureAtoms(mol2);
            AtomContainerManipulator.PercieveAtomTypesAndConfigureAtoms(mol3);

            Aromaticity.CDKLegacy.Apply(mol1);
            Aromaticity.CDKLegacy.Apply(mol2);
            Aromaticity.CDKLegacy.Apply(mol3);

            BitArray bs1 = printer.GetBitFingerprint(mol1).AsBitSet();
            BitArray bs2 = printer.GetBitFingerprint(mol2).AsBitSet();
            BitArray bs3 = printer.GetBitFingerprint(mol3).AsBitSet();

            Assert.IsTrue(FingerprinterTool.IsSubset(bs1, bs2));
            Assert.IsTrue(FingerprinterTool.IsSubset(bs2, bs3));
        }
        public void TestChebi()
        {
            IAtomContainer searchmol = null;
            IAtomContainer findmol   = null;
            var            filename  = "NCDK.Data.MDL.chebisearch.mol";
            var            ins       = ResourceLoader.GetAsStream(filename);
            var            reader    = new MDLV2000Reader(ins);

            searchmol = reader.Read(builder.NewAtomContainer());
            reader.Close();
            filename = "NCDK.Data.MDL.chebifind.mol";
            ins      = ResourceLoader.GetAsStream(filename);
            reader   = new MDLV2000Reader(ins);
            findmol  = reader.Read(builder.NewAtomContainer());
            reader.Close();
            var fingerprinter = new ExtendedFingerprinter();
            var superBS       = fingerprinter.GetBitFingerprint(findmol).AsBitSet();
            var subBS         = fingerprinter.GetBitFingerprint(searchmol).AsBitSet();
            var isSubset      = FingerprinterTool.IsSubset(superBS, subBS);
            var isSubset2     = FingerprinterTool.IsSubset(subBS, superBS);

            Assert.IsFalse(isSubset);
            Assert.IsFalse(isSubset2);
        }
 public override ICountFingerprint GetCountFingerprint(IAtomContainer container)
 {
     return(FingerprinterTool.MakeCountFingerprint(GetRawFingerprint(container)));
 }
        public void TestCondensedSingle()
        {
            var molcondensed = builder.NewAtomContainer();
            var a1           = molcondensed.Builder.NewAtom("C");

            a1.Point2D = new Vector2(421.99999999999994, 860.0);
            molcondensed.Atoms.Add(a1);
            var a2 = molcondensed.Builder.NewAtom("C");

            a2.Point2D = new Vector2(390.8230854637602, 878.0);
            molcondensed.Atoms.Add(a2);
            var a3 = molcondensed.Builder.NewAtom("C");

            a3.Point2D = new Vector2(390.8230854637602, 914.0);
            molcondensed.Atoms.Add(a3);
            var a4 = molcondensed.Builder.NewAtom("C");

            a4.Point2D = new Vector2(422.0, 932.0);
            molcondensed.Atoms.Add(a4);
            var a5 = molcondensed.Builder.NewAtom("C");

            a5.Point2D = new Vector2(453.1769145362398, 914.0);
            molcondensed.Atoms.Add(a5);
            var a6 = molcondensed.Builder.NewAtom("C");

            a6.Point2D = new Vector2(453.1769145362398, 878.0);
            molcondensed.Atoms.Add(a6);
            var a7 = molcondensed.Builder.NewAtom("C");

            a7.Point2D = new Vector2(484.3538290724796, 860.0);
            molcondensed.Atoms.Add(a7);
            var a8 = molcondensed.Builder.NewAtom("C");

            a8.Point2D = new Vector2(515.5307436087194, 878.0);
            molcondensed.Atoms.Add(a8);
            var a9 = molcondensed.Builder.NewAtom("C");

            a9.Point2D = new Vector2(515.5307436087194, 914.0);
            molcondensed.Atoms.Add(a9);
            var a10 = molcondensed.Builder.NewAtom("C");

            a10.Point2D = new Vector2(484.3538290724796, 932.0);
            molcondensed.Atoms.Add(a10);
            var a11 = molcondensed.Builder.NewAtom("C");

            a11.Point2D = new Vector2(546.7076581449592, 932.0);
            molcondensed.Atoms.Add(a11);
            var a12 = molcondensed.Builder.NewAtom("C");

            a12.Point2D = new Vector2(577.884572681199, 914.0);
            molcondensed.Atoms.Add(a12);
            var a13 = molcondensed.Builder.NewAtom("C");

            a13.Point2D = new Vector2(577.884572681199, 878.0);
            molcondensed.Atoms.Add(a13);
            var a14 = molcondensed.Builder.NewAtom("C");

            a14.Point2D = new Vector2(546.7076581449592, 860.0);
            molcondensed.Atoms.Add(a14);
            var a15 = molcondensed.Builder.NewAtom("C");

            a15.Point2D = new Vector2(359.6461709275204, 860.0);
            molcondensed.Atoms.Add(a15);
            var a16 = molcondensed.Builder.NewAtom("C");

            a16.Point2D = new Vector2(609.0614872174388, 860.0);
            molcondensed.Atoms.Add(a16);
            var b1 = molcondensed.Builder.NewBond(a1, a2, BondOrder.Single);

            molcondensed.Bonds.Add(b1);
            var b2 = molcondensed.Builder.NewBond(a2, a3, BondOrder.Single);

            molcondensed.Bonds.Add(b2);
            var b3 = molcondensed.Builder.NewBond(a3, a4, BondOrder.Single);

            molcondensed.Bonds.Add(b3);
            var b4 = molcondensed.Builder.NewBond(a4, a5, BondOrder.Single);

            molcondensed.Bonds.Add(b4);
            var b5 = molcondensed.Builder.NewBond(a5, a6, BondOrder.Single);

            molcondensed.Bonds.Add(b5);
            var b6 = molcondensed.Builder.NewBond(a6, a1, BondOrder.Single);

            molcondensed.Bonds.Add(b6);
            var b7 = molcondensed.Builder.NewBond(a6, a7, BondOrder.Single);

            molcondensed.Bonds.Add(b7);
            var b8 = molcondensed.Builder.NewBond(a7, a8, BondOrder.Single);

            molcondensed.Bonds.Add(b8);
            var b9 = molcondensed.Builder.NewBond(a8, a9, BondOrder.Single);

            molcondensed.Bonds.Add(b9);
            var b10 = molcondensed.Builder.NewBond(a9, a10, BondOrder.Single);

            molcondensed.Bonds.Add(b10);
            var b11 = molcondensed.Builder.NewBond(a10, a5, BondOrder.Single);

            molcondensed.Bonds.Add(b11);
            var b12 = molcondensed.Builder.NewBond(a9, a11, BondOrder.Single);

            molcondensed.Bonds.Add(b12);
            var b13 = molcondensed.Builder.NewBond(a11, a12, BondOrder.Single);

            molcondensed.Bonds.Add(b13);
            var b14 = molcondensed.Builder.NewBond(a12, a13, BondOrder.Single);

            molcondensed.Bonds.Add(b14);
            var b15 = molcondensed.Builder.NewBond(a13, a14, BondOrder.Single);

            molcondensed.Bonds.Add(b15);
            var b16 = molcondensed.Builder.NewBond(a14, a8, BondOrder.Single);

            molcondensed.Bonds.Add(b16);
            var b17 = molcondensed.Builder.NewBond(a2, a15, BondOrder.Single);

            molcondensed.Bonds.Add(b17);
            var b18 = molcondensed.Builder.NewBond(a13, a16, BondOrder.Single);

            molcondensed.Bonds.Add(b18);

            var molsingle = builder.NewAtomContainer();
            var a1s       = molsingle.Builder.NewAtom("C");

            a1s.Point2D = new Vector2(421.99999999999994, 860.0);
            molsingle.Atoms.Add(a1s);
            var a2s = molsingle.Builder.NewAtom("C");

            a2s.Point2D = new Vector2(390.8230854637602, 878.0);
            molsingle.Atoms.Add(a2s);
            var a6s = molsingle.Builder.NewAtom("C");

            a6s.Point2D = new Vector2(453.1769145362398, 878.0);
            molsingle.Atoms.Add(a6s);
            var a3s = molsingle.Builder.NewAtom("C");

            a3s.Point2D = new Vector2(390.8230854637602, 914.0);
            molsingle.Atoms.Add(a3s);
            var a15s = molsingle.Builder.NewAtom("C");

            a15s.Point2D = new Vector2(359.6461709275204, 860.0);
            molsingle.Atoms.Add(a15s);
            var a5s = molsingle.Builder.NewAtom("C");

            a5s.Point2D = new Vector2(453.1769145362398, 914.0);
            molsingle.Atoms.Add(a5s);
            var a7s = molsingle.Builder.NewAtom("C");

            a7s.Point2D = new Vector2(492.8230854637602, 881.0);
            molsingle.Atoms.Add(a7s);
            var a4s = molsingle.Builder.NewAtom("C");

            a4s.Point2D = new Vector2(422.0, 932.0);
            molsingle.Atoms.Add(a4s);
            var a8s = molsingle.Builder.NewAtom("C");

            a8s.Point2D = new Vector2(524.0, 863.0);
            molsingle.Atoms.Add(a8s);
            var a9s = molsingle.Builder.NewAtom("C");

            a9s.Point2D = new Vector2(492.8230854637602, 917.0);
            molsingle.Atoms.Add(a9s);
            var a10s = molsingle.Builder.NewAtom("C");

            a10s.Point2D = new Vector2(555.1769145362398, 881.0);
            molsingle.Atoms.Add(a10s);
            var a11s = molsingle.Builder.NewAtom("C");

            a11s.Point2D = new Vector2(524.0, 935.0);
            molsingle.Atoms.Add(a11s);
            var a12s = molsingle.Builder.NewAtom("C");

            a12s.Point2D = new Vector2(555.1769145362398, 917.0);
            molsingle.Atoms.Add(a12s);
            var a13s = molsingle.Builder.NewAtom("C");

            a13s.Point2D = new Vector2(592.8230854637602, 889.0);
            molsingle.Atoms.Add(a13s);
            var a14s = molsingle.Builder.NewAtom("C");

            a14s.Point2D = new Vector2(624.0, 871.0);
            molsingle.Atoms.Add(a14s);
            var a16s = molsingle.Builder.NewAtom("C");

            a16s.Point2D = new Vector2(592.8230854637602, 925.0);
            molsingle.Atoms.Add(a16s);
            var a17s = molsingle.Builder.NewAtom("C");

            a17s.Point2D = new Vector2(655.1769145362398, 889.0);
            molsingle.Atoms.Add(a17s);
            var a18s = molsingle.Builder.NewAtom("C");

            a18s.Point2D = new Vector2(624.0, 943.0);
            molsingle.Atoms.Add(a18s);
            var a19s = molsingle.Builder.NewAtom("C");

            a19s.Point2D = new Vector2(655.1769145362398, 925.0);
            molsingle.Atoms.Add(a19s);
            var a20s = molsingle.Builder.NewAtom("C");

            a20s.Point2D = new Vector2(686.3538290724796, 871.0);
            molsingle.Atoms.Add(a20s);
            var b1s = molsingle.Builder.NewBond(a1s, a2s, BondOrder.Single);

            molsingle.Bonds.Add(b1s);
            var b6s = molsingle.Builder.NewBond(a6s, a1s, BondOrder.Single);

            molsingle.Bonds.Add(b6s);
            var b2s = molsingle.Builder.NewBond(a2s, a3s, BondOrder.Single);

            molsingle.Bonds.Add(b2s);
            var b17s = molsingle.Builder.NewBond(a2s, a15s, BondOrder.Single);

            molsingle.Bonds.Add(b17s);
            var b5s = molsingle.Builder.NewBond(a5s, a6s, BondOrder.Single);

            molsingle.Bonds.Add(b5s);
            var b7s = molsingle.Builder.NewBond(a6s, a7s, BondOrder.Single);

            molsingle.Bonds.Add(b7s);
            var b3s = molsingle.Builder.NewBond(a3s, a4s, BondOrder.Single);

            molsingle.Bonds.Add(b3s);
            var b4s = molsingle.Builder.NewBond(a4s, a5s, BondOrder.Single);

            molsingle.Bonds.Add(b4s);
            var b8s = molsingle.Builder.NewBond(a8s, a7s, BondOrder.Single);

            molsingle.Bonds.Add(b8s);
            var b9s = molsingle.Builder.NewBond(a7s, a9s, BondOrder.Single);

            molsingle.Bonds.Add(b9s);
            var b10s = molsingle.Builder.NewBond(a10s, a8s, BondOrder.Single);

            molsingle.Bonds.Add(b10s);
            var b11s = molsingle.Builder.NewBond(a9s, a11s, BondOrder.Single);

            molsingle.Bonds.Add(b11s);
            var b12s = molsingle.Builder.NewBond(a12s, a10s, BondOrder.Single);

            molsingle.Bonds.Add(b12s);
            var b13s = molsingle.Builder.NewBond(a10s, a13s, BondOrder.Single);

            molsingle.Bonds.Add(b13s);
            var b14s = molsingle.Builder.NewBond(a11s, a12s, BondOrder.Single);

            molsingle.Bonds.Add(b14s);
            var b15s = molsingle.Builder.NewBond(a14s, a13s, BondOrder.Single);

            molsingle.Bonds.Add(b15s);
            var b16s = molsingle.Builder.NewBond(a13s, a16s, BondOrder.Single);

            molsingle.Bonds.Add(b16s);
            var b18s = molsingle.Builder.NewBond(a17s, a14s, BondOrder.Single);

            molsingle.Bonds.Add(b18s);
            var b19s = molsingle.Builder.NewBond(a16s, a18s, BondOrder.Single);

            molsingle.Bonds.Add(b19s);
            var b20s = molsingle.Builder.NewBond(a19s, a17s, BondOrder.Single);

            molsingle.Bonds.Add(b20s);
            var b21s = molsingle.Builder.NewBond(a18s, a19s, BondOrder.Single);

            molsingle.Bonds.Add(b21s);
            var b22s = molsingle.Builder.NewBond(a17s, a20s, BondOrder.Single);

            molsingle.Bonds.Add(b22s);

            var fingerprinter = new ExtendedFingerprinter();
            var bs1           = fingerprinter.GetBitFingerprint(molsingle).AsBitSet();
            var bs2           = fingerprinter.GetBitFingerprint(molcondensed).AsBitSet();

            Assert.IsFalse(FingerprinterTool.IsSubset(bs1, bs2));
            Assert.IsTrue(FingerprinterTool.IsSubset(bs2, bs1));
        }
 public override IBitFingerprint GetBitFingerprint(IAtomContainer iAtomContainer)
 {
     return(FingerprinterTool.MakeBitFingerprint(GetRawFingerprint(iAtomContainer)));
 }