Example #1
0
        public void TestQueryToolReSetSmarts()
        {
            var             sp            = CDK.SmilesParser;
            var             atomContainer = sp.ParseSmiles("C1CCC12CCCC2");
            SMARTSQueryTool querytool     = new SMARTSQueryTool("C", ChemObjectBuilder.Instance);

            bool status = querytool.Matches(atomContainer);

            Assert.IsTrue(status);

            int nmatch = querytool.MatchesCount;

            Assert.AreEqual(8, nmatch);

            querytool.Smarts = "CC";
            status           = querytool.Matches(atomContainer);
            Assert.IsTrue(status);

            nmatch = querytool.MatchesCount;
            Assert.AreEqual(18, nmatch);

            var umatch = querytool.GetUniqueMatchingAtoms();

            Assert.AreEqual(9, umatch.Count());
        }
Example #2
0
        public void TestQuery()
        {
            var sp            = CDK.SmilesParser;
            var atomContainer = sp.ParseSmiles("c12cc(CCN)ccc1c(COC)ccc2");

            AtomContainerManipulator.PercieveAtomTypesAndConfigureAtoms(atomContainer);
            Aromaticity.CDKLegacy.Apply(atomContainer);
            SMARTSQueryTool querytool = new SMARTSQueryTool("c12ccccc1cccc2", ChemObjectBuilder.Instance);

            bool status = querytool.Matches(atomContainer);

            Assert.IsTrue(status);

            int nmatch = querytool.MatchesCount;

            Assert.AreEqual(4, nmatch);

            var umatch = querytool.GetUniqueMatchingAtoms();

            Assert.AreEqual(1, umatch.Count());
        }
Example #3
0
        public void TestUniqueQueries()
        {
            var sp            = CDK.SmilesParser;
            var atomContainer = sp.ParseSmiles("c1ccccc1CCCNCCCc1ccccc1");

            AtomContainerManipulator.PercieveAtomTypesAndConfigureAtoms(atomContainer);
            Aromaticity.CDKLegacy.Apply(atomContainer);
            SMARTSQueryTool querytool = new SMARTSQueryTool("c1ccccc1");

            bool status = querytool.Matches(atomContainer);

            Assert.IsTrue(status);

            int nmatch = querytool.MatchesCount;

            Assert.AreEqual(24, nmatch);

            var umatch = querytool.GetUniqueMatchingAtoms();

            Assert.AreEqual(2, umatch.Count());
        }