public void TestSetChemFilters()
        {
            var sp      = CDK.SmilesParser;
            var target  = sp.ParseSmiles("C\\C=C/OCC=C");
            var queryac = sp.ParseSmiles("CCCOCC(C)=C");

            Isomorphism smsd1 = new Isomorphism(Algorithm.Default, false);

            smsd1.Init(queryac, target, true, true);
            smsd1.SetChemFilters(true, true, true);
            Assert.AreEqual(1, smsd1.GetAllAtomMapping().Count);
        }
        public void TestIsSubgraph()
        {
            var sp      = CDK.SmilesParser;
            var target  = sp.ParseSmiles("C\\C=C/Nc1cccc(c1)N(O)\\C=C\\C\\C=C\\C=C/C");
            var queryac = sp.ParseSmiles("Nc1ccccc1");

            Isomorphism smsd1 = new Isomorphism(Algorithm.SubStructure, false);

            smsd1.Init(queryac, target, true, true);
            smsd1.SetChemFilters(true, true, true);
            Assert.AreEqual(true, smsd1.IsSubgraph());
        }
        public void TestInit_3args_2()
        {
            var sp      = CDK.SmilesParser;
            var target  = sp.ParseSmiles("C\\C=C/OCC=C");
            var queryac = sp.ParseSmiles("CCCOCC(C)=C");

            Isomorphism smsd1 = new Isomorphism(Algorithm.Default, false);

            smsd1.Init(queryac, target, true, true);
            smsd1.SetChemFilters(true, false, false);
            Assert.IsNotNull(smsd1.ReactantMolecule);
            Assert.IsNotNull(smsd1.ProductMolecule);
        }
        public void TestGetProductMolecule()
        {
            var sp      = CDK.SmilesParser;
            var target  = sp.ParseSmiles("C\\C=C/Nc1cccc(c1)N(O)\\C=C\\C\\C=C\\C=C/C");
            var queryac = sp.ParseSmiles("Nc1ccccc1");

            Isomorphism smsd1 = new Isomorphism(Algorithm.Default, true);

            smsd1.Init(queryac, target, true, true);
            smsd1.SetChemFilters(true, true, true);

            Assert.AreEqual(20, smsd1.ProductMolecule.Atoms.Count);
        }
        public void TestGetFirstAtomMapping()
        {
            var sp      = CDK.SmilesParser;
            var target  = sp.ParseSmiles("C\\C=C/Nc1cccc(c1)N(O)\\C=C\\C\\C=C\\C=C/C");
            var queryac = sp.ParseSmiles("Nc1ccccc1");

            Isomorphism smsd1 = new Isomorphism(Algorithm.Default, true);

            smsd1.Init(queryac, target, true, true);
            smsd1.SetChemFilters(true, true, true);

            Assert.AreEqual(7, smsd1.GetFirstAtomMapping().Count);
        }
        public void TestGetEnergyScore()
        {
            var sp      = CDK.SmilesParser;
            var target  = sp.ParseSmiles("C\\C=C/Nc1cccc(c1)N(O)\\C=C\\C\\C=C\\C=C/C");
            var queryac = sp.ParseSmiles("Nc1ccccc1");

            Isomorphism smsd1 = new Isomorphism(Algorithm.SubStructure, false);

            smsd1.Init(queryac, target, true, true);
            smsd1.SetChemFilters(false, false, true);
            var score = 610.0;

            Assert.AreEqual(score, smsd1.GetEnergyScore(0));
        }
        public void TestGetStereoScore()
        {
            var sp      = CDK.SmilesParser;
            var target  = sp.ParseSmiles("C\\C=C/OCC=C");
            var queryac = sp.ParseSmiles("CCCOCC(C)=C");

            Isomorphism smsd1 = new Isomorphism(Algorithm.Default, false);

            smsd1.Init(queryac, target, true, true);
            smsd1.SetChemFilters(true, false, false);
            int score = 1048;

            Assert.AreEqual(score, smsd1.GetStereoScore(0));
        }
Esempio n. 8
0
        public void TestGetSortedFragment()
        {
            var sp      = CDK.SmilesParser;
            var target  = sp.ParseSmiles("C\\C=C/Nc1cccc(c1)N(O)\\C=C\\C\\C=C\\C=C/C");
            var queryac = sp.ParseSmiles("Nc1ccccc1");

            Isomorphism smsd1 = new Isomorphism(Algorithm.Default, true);

            smsd1.Init(queryac, target, true, true);
            smsd1.SetChemFilters(false, true, false);
            int score = 2;

            Assert.AreEqual(score, smsd1.GetFragmentSize(0));
        }
        public void TestGetTanimotoSimilarity()
        {
            var sp      = CDK.SmilesParser;
            var target  = sp.ParseSmiles("C\\C=C/Nc1cccc(c1)N(O)\\C=C\\C\\C=C\\C=C/C");
            var queryac = sp.ParseSmiles("Nc1ccccc1");

            Isomorphism smsd1 = new Isomorphism(Algorithm.Default, true);

            smsd1.Init(queryac, target, true, true);
            smsd1.SetChemFilters(true, true, true);

            double score = 0.35;

            Assert.AreEqual(score, smsd1.GetTanimotoSimilarity(), 0);
        }
        public void TestGetAllAtomMapping()
        {
            var sp      = new SmilesParser(ChemObjectBuilder.Instance, false);
            var target  = sp.ParseSmiles("C\\C=C/Nc1cccc(c1)N(O)\\C=C\\C\\C=C\\C=C/C");
            var queryac = sp.ParseSmiles("Nc1ccccc1");

            AtomContainerManipulator.PercieveAtomTypesAndConfigureAtoms(target);
            AtomContainerManipulator.PercieveAtomTypesAndConfigureAtoms(queryac);
            Aromaticity.CDKLegacy.Apply(target);
            Aromaticity.CDKLegacy.Apply(queryac);

            Isomorphism smsd1 = new Isomorphism(Algorithm.Default, true);

            smsd1.Init(queryac, target, true, true);
            smsd1.SetChemFilters(true, true, true);

            Assert.AreEqual(2, smsd1.GetAllAtomMapping().Count);
        }
Esempio n. 11
0
        public void TestSortResultsByEnergies()
        {
            var sp      = CDK.SmilesParser;
            var target  = sp.ParseSmiles("C\\C=C/Nc1cccc(c1)N(O)\\C=C\\C\\C=C\\C=C/C");
            var queryac = sp.ParseSmiles("Nc1ccccc1");

            Isomorphism smsd = new Isomorphism(Algorithm.Default, true);

            smsd.Init(queryac, target, true, true);
            smsd.SetChemFilters(false, false, false);
            Assert.AreEqual(4, smsd.GetAllAtomMapping().Count);

            Isomorphism smsd1 = new Isomorphism(Algorithm.Default, true);

            smsd1.Init(queryac, target, true, true);
            smsd1.SetChemFilters(false, false, true);
            Assert.AreEqual(2, smsd1.GetAllAtomMapping().Count);
        }
        public void TestGetEuclideanDistance()
        {
            var sp      = CDK.SmilesParser;
            var target  = sp.ParseSmiles("C\\C=C/Nc1cccc(c1)N(O)\\C=C\\C\\C=C\\C=C/C");
            var queryac = sp.ParseSmiles("Nc1ccccc1");

            Isomorphism smsd1 = new Isomorphism(Algorithm.SubStructure, true);

            smsd1.Init(queryac, target, true, true);
            smsd1.SetChemFilters(true, true, true);

            double score = 3.605;

            Assert.AreEqual(score, smsd1.GetEuclideanDistance(), 0.005);

            Isomorphism smsd2 = new Isomorphism(Algorithm.VFLibMCS, true);

            smsd2.Init(queryac, target, true, true);
            smsd2.SetChemFilters(true, true, true);

            Assert.AreEqual(score, smsd2.GetEuclideanDistance(), 0.005);
        }
Esempio n. 13
0
        public void TestSet_String_String()
        {
            string         molfile   = "NCDK.Data.MDL.decalin.mol";
            string         queryfile = "NCDK.Data.MDL.decalin.mol";
            IAtomContainer query     = new AtomContainer();
            IAtomContainer target    = new AtomContainer();

            var ins    = ResourceLoader.GetAsStream(molfile);
            var reader = new MDLV2000Reader(ins, ChemObjectReaderMode.Strict);

            reader.Read(query);
            ins    = ResourceLoader.GetAsStream(queryfile);
            reader = new MDLV2000Reader(ins, ChemObjectReaderMode.Strict);
            reader.Read(target);

            Isomorphism smsd1 = new Isomorphism(Algorithm.Default, true);

            smsd1.Init(query, target, true, true);
            smsd1.SetChemFilters(true, true, true);
            double score = 1.0;

            Assert.AreEqual(score, smsd1.GetTanimotoSimilarity(), 0.0001);
        }