示例#1
0
        public void TestRemoveMolecule()
        {
            Debug.WriteLine("***TestRemoveMolecule***");
            bool            itIsInThere = false;
            TemplateHandler th          = new TemplateHandler();
            IAtomContainer  mol         = TestMoleculeFactory.MakeAlphaPinene();

            sdg.Molecule = mol;
            sdg.GenerateCoordinates();
            mol = sdg.Molecule;

            var smiles    = "C1=C(C)C2CC(C1)C2(C)(C)";
            var smilesMol = sp.ParseSmiles(smiles);

            itIsInThere = th.MapTemplates(smilesMol);
            Debug.WriteLine($"Alpha-Pinene found by templateMapper: {itIsInThere}");
            Assert.IsFalse(itIsInThere);
            th.AddMolecule(mol);
            Debug.WriteLine("now adding template for alpha-Pinen and trying again.");
            itIsInThere = th.MapTemplates(smilesMol);
            Debug.WriteLine($"Alpha-Pinene found by templateMapper: {itIsInThere}");
            Assert.IsTrue(itIsInThere);
            Debug.WriteLine("now removing template for alpha-Pinen again and trying again.");
            th.RemoveMolecule(mol);
            itIsInThere = th.MapTemplates(smilesMol);
            Debug.WriteLine($"Alpha-Pinene found by templateMapper: {itIsInThere}");
            Assert.IsFalse(itIsInThere);
        }
示例#2
0
        public void TestOtherBondOrder()
        {
            bool            itIsInThere = false;
            TemplateHandler th          = new TemplateHandler();
            IAtomContainer  mol         = TestMoleculeFactory.MakeSteran();

            itIsInThere = th.MapTemplates(mol);
            Assert.IsTrue(itIsInThere);
            mol.Bonds[0].Order = BondOrder.Double;
            itIsInThere        = th.MapTemplates(mol);
            Assert.IsTrue(itIsInThere);
        }
示例#3
0
        public void TestOtherElements()
        {
            bool            itIsInThere = false;
            TemplateHandler th          = new TemplateHandler();
            IAtomContainer  mol         = TestMoleculeFactory.MakeSteran();

            itIsInThere = th.MapTemplates(mol);
            Assert.IsTrue(itIsInThere);
            mol.Atoms[0].Symbol = "N";
            itIsInThere         = th.MapTemplates(mol);
            Assert.IsTrue(itIsInThere);
        }
示例#4
0
        public void TestDetection()
        {
            TemplateHandler th     = new TemplateHandler();
            var             smiles = "CC12C3(C6CC6)C4(C)C1C5(C(CC)C)C(C(CC)C)2C(C)3C45CC(C)C";
            var             mol    = sp.ParseSmiles(smiles);

            Assert.IsTrue(th.MapTemplates(mol));
        }