public void TestAngleMatch2() { var filename = "NCDK.Data.MDL.cnssmarts.sdf"; var ins = ResourceLoader.GetAsStream(filename); var reader = new EnumerableSDFReader(ins, CDK.Builder); var query = new PharmacophoreQuery(); var n1 = new PharmacophoreQueryAtom("BasicAmine", "[NX3;h2,h1,H1,H2;!$(NC=O)]"); var n2 = new PharmacophoreQueryAtom("BasicAmine", "[NX3;h2,h1,H1,H2;!$(NC=O)]"); var n3 = new PharmacophoreQueryAtom("BasicAmine", "[NX3;h2,h1,H1,H2;!$(NC=O)]"); var b1 = new PharmacophoreQueryAngleBond(n1, n2, n3, 89.14); query.Atoms.Add(n1); query.Atoms.Add(n2); query.Atoms.Add(n3); query.Bonds.Add(b1); var mol = reader.First(); reader.Close(); var matcher = new PharmacophoreMatcher(query); var status = matcher.Matches(mol); Assert.IsTrue(status); }
public void TestAngleMatch3() { 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 PharmacophoreQueryAngleBond(o, n1, n2, 43, 47); query.Bonds.Add(b1); var matcher = new PharmacophoreMatcher(query); bool firstTime = true; int i = 0; var statuses = new bool[100]; foreach (var conf in conformers) { if (firstTime) { statuses[i] = matcher.Matches(conf, true); firstTime = false; } else { statuses[i] = matcher.Matches(conf, false); } i++; } Assert.AreEqual(100, statuses.Length); var hits = new int[9]; int idx = 0; for (i = 0; i < statuses.Length; i++) { if (statuses[i]) { hits[idx++] = i; } } int[] expected = { 0, 6, 32, 33, 48, 54, 60, 62, 69 }; for (i = 0; i < expected.Length; i++) { Assert.AreEqual(expected[i], hits[i], $"Hit {i} didn't match"); } }
public void TestToString() { PharmacophoreQueryAtom qatom1 = new PharmacophoreQueryAtom("Amine", "[CX2]N"); PharmacophoreQueryAtom qatom2 = new PharmacophoreQueryAtom("aromatic", "c1ccccc1"); PharmacophoreQueryAtom qatom3 = new PharmacophoreQueryAtom("blah", "C"); PharmacophoreQueryAngleBond qbond1 = new PharmacophoreQueryAngleBond(qatom1, qatom2, qatom3, 54.735); string repr = qbond1.ToString(); Assert.AreEqual(repr, "AC::Amine [[CX2]N]::aromatic [c1ccccc1]::blah [C]::[54.74 - 54.74] "); }
public void TestLower() { PharmacophoreQueryAtom qatom1 = new PharmacophoreQueryAtom("Amine", "[CX2]N"); PharmacophoreQueryAtom qatom2 = new PharmacophoreQueryAtom("aromatic", "c1ccccc1"); PharmacophoreQueryAtom qatom3 = new PharmacophoreQueryAtom("blah", "C"); PharmacophoreQueryAngleBond qbond1 = new PharmacophoreQueryAngleBond(qatom1, qatom2, qatom3, 54.735); PharmacophoreQueryAngleBond qbond2 = new PharmacophoreQueryAngleBond(qatom1, qatom2, qatom3, 50, 60); Assert.AreEqual(54.74, qbond1.GetLower(), 0.01); Assert.AreEqual(50.00, qbond2.GetLower(), 0.01); }
public void TestMatches() { PharmacophoreAtom patom1 = new PharmacophoreAtom("[CX2]N", "Amine", new Vector3(1, 1, 1)); PharmacophoreAtom patom2 = new PharmacophoreAtom("c1ccccc1", "Aromatic", Vector3.Zero); PharmacophoreAtom patom3 = new PharmacophoreAtom("C", "Blah", new Vector3(1, 0, 0)); PharmacophoreAngleBond pbond = new PharmacophoreAngleBond(patom1, patom2, patom3); PharmacophoreQueryAtom qatom1 = new PharmacophoreQueryAtom("Amine", "[CX2]N"); PharmacophoreQueryAtom qatom2 = new PharmacophoreQueryAtom("aromatic", "c1ccccc1"); PharmacophoreQueryAtom qatom3 = new PharmacophoreQueryAtom("blah", "C"); PharmacophoreQueryAngleBond qbond1 = new PharmacophoreQueryAngleBond(qatom1, qatom2, qatom3, 54.735); PharmacophoreQueryAngleBond qbond2 = new PharmacophoreQueryAngleBond(qatom1, qatom2, qatom3, 50, 60); PharmacophoreQueryAngleBond qbond3 = new PharmacophoreQueryAngleBond(qatom1, qatom2, qatom3, 60, 80); PharmacophoreQueryBond qbond4 = new PharmacophoreQueryBond(qatom1, qatom2, 1, 2); Assert.IsTrue(qbond1.Matches(pbond)); Assert.IsTrue(qbond2.Matches(pbond)); Assert.IsFalse(qbond3.Matches(pbond)); Assert.IsFalse(qbond4.Matches(pbond)); }