public void TestCNSPcore()
        {
            var filename = "NCDK.Data.MDL.cnssmarts.sdf";
            var ins      = ResourceLoader.GetAsStream(filename);
            var reader   = new EnumerableSDFReader(ins, CDK.Builder);

            var query = new PharmacophoreQuery();
            var arom  = new PharmacophoreQueryAtom("A", "c1ccccc1");
            var n1    = new PharmacophoreQueryAtom("BasicAmine", "[NX3;h2,h1,H1,H2;!$(NC=O)]");
            var b1    = new PharmacophoreQueryBond(arom, n1, 5.0, 7.0);

            query.Atoms.Add(arom);
            query.Atoms.Add(n1);
            query.Bonds.Add(b1);

            var mol = reader.First();

            reader.Close();

            var matcher = new PharmacophoreMatcher(query);
            var status  = matcher.Matches(mol);

            Assert.IsTrue(status);

            var pmatches = matcher.GetMatchingPharmacophoreAtoms();

            Assert.AreEqual(1, pmatches.Count);

            var upmatches = matcher.GetUniqueMatchingPharmacophoreAtoms();

            Assert.AreEqual(1, upmatches.Count);
        }
Exemple #2
0
        public void TestMatchingBonds()
        {
            var filename = "NCDK.Data.MDL.cnssmarts.sdf";
            var ins      = ResourceLoader.GetAsStream(filename);
            EnumerableSDFReader reader = new EnumerableSDFReader(ins, CDK.Builder);

            PharmacophoreQuery     query = new PharmacophoreQuery();
            PharmacophoreQueryAtom arom  = new PharmacophoreQueryAtom("A", "c1ccccc1");
            PharmacophoreQueryAtom n1    = new PharmacophoreQueryAtom("BasicAmine", "[NX3;h2,h1,H1,H2;!$(NC=O)]");
            PharmacophoreQueryBond b1    = new PharmacophoreQueryBond(arom, n1, 5.0, 7.0);

            query.Atoms.Add(arom);
            query.Atoms.Add(n1);
            query.Bonds.Add(b1);

            IAtomContainer mol = (IAtomContainer)reader.First();

            reader.Close();

            PharmacophoreMatcher matcher = new PharmacophoreMatcher(query);
            bool status = matcher.Matches(mol);

            Assert.IsTrue(status);

            var pmatches = matcher.GetMatchingPharmacophoreAtoms();

            Assert.AreEqual(1, pmatches.Count);

            var upmatches = matcher.GetUniqueMatchingPharmacophoreAtoms();

            Assert.AreEqual(1, upmatches.Count);

            var bmatches = matcher.GetMatchingPharmacophoreBonds();

            Assert.AreEqual(1, bmatches.Count);
            var bmatch = bmatches[0];

            Assert.AreEqual(1, bmatch.Count);
            PharmacophoreBond pbond = (PharmacophoreBond)BondRef.Deref(bmatch[0]);

            Assert.AreEqual(5.63, pbond.BondLength, 0.01);
        }
        public void TestMatchedAtoms()
        {
            Assert.IsNotNull(conformers);

            // make a query
            var query = new PharmacophoreQuery();

            var o  = new PharmacophoreQueryAtom("D", "[OX1]");
            var n1 = new PharmacophoreQueryAtom("A", "[N]");
            var n2 = new PharmacophoreQueryAtom("A", "[N]");

            query.Atoms.Add(o);
            query.Atoms.Add(n1);
            query.Atoms.Add(n2);

            var b1 = new PharmacophoreQueryBond(o, n1, 4.0, 4.5);
            var b2 = new PharmacophoreQueryBond(o, n2, 4.0, 5.0);
            var b3 = new PharmacophoreQueryBond(n1, n2, 5.4, 5.8);

            query.Bonds.Add(b1);
            query.Bonds.Add(b2);
            query.Bonds.Add(b3);

            var  conf1   = conformers[0];
            var  matcher = new PharmacophoreMatcher(query);
            bool status  = matcher.Matches(conf1);

            Assert.IsTrue(status);

            var pmatches = matcher.GetMatchingPharmacophoreAtoms();

            Assert.AreEqual(2, pmatches.Count);

            var upmatches = matcher.GetUniqueMatchingPharmacophoreAtoms();

            Assert.AreEqual(1, upmatches.Count);
        }