Example #1
0
        public void TestCyclopropaneNotASubgraphOfIsoButane()
        {
            IAtomContainer cycloPropane = CreateCyclopropane();
            IAtomContainer isobutane    = CreateIsobutane();

            ExtAtomContainerManipulator.PercieveAtomTypesAndConfigureAtoms(cycloPropane);
            ExtAtomContainerManipulator.PercieveAtomTypesAndConfigureAtoms(isobutane);

            IAtomContainer source = ExtAtomContainerManipulator.RemoveHydrogensExceptSingleAndPreserveAtomID(cycloPropane);
            IAtomContainer target = ExtAtomContainerManipulator.RemoveHydrogensExceptSingleAndPreserveAtomID(isobutane);

            Aromaticity.CDKLegacy.Apply(source);
            Aromaticity.CDKLegacy.Apply(target);

            bool bondSensitive        = false;
            bool removeHydrogen       = true;
            bool stereoMatch          = true;
            bool fragmentMinimization = true;
            bool energyMinimization   = true;

            //    Calling the main algorithm to perform MCS cearch
            Isomorphism comparison = new Isomorphism(Algorithm.SubStructure, bondSensitive);

            comparison.Init(source, target, removeHydrogen, true);
            comparison.SetChemFilters(stereoMatch, fragmentMinimization, energyMinimization);

            //        Cyclopropane is not a subgraph of Isobutane
            Assert.IsFalse(comparison.IsSubgraph());
            Assert.AreEqual(0.625, comparison.GetTanimotoSimilarity());
        }
Example #2
0
        public void TestSMSDFragHetSubgraph()
        {
            var    sp    = CDK.SmilesParser;
            string file1 = "O=C1NC(=O)C2=C(N1)NC(=O)C=N2";
            string file2 = "OC[C@@H](O)[C@@H](O)[C@@H](O)CN1C(O)C(CCC(O)O)NC2C(O)NC(O)NC12";

            var mol1 = sp.ParseSmiles(file1);
            var mol2 = sp.ParseSmiles(file2);

            ExtAtomContainerManipulator.PercieveAtomTypesAndConfigureAtoms(mol1);
            ExtAtomContainerManipulator.PercieveAtomTypesAndConfigureAtoms(mol2);

            IAtomContainer source = ExtAtomContainerManipulator.RemoveHydrogensExceptSingleAndPreserveAtomID(mol1);
            IAtomContainer target = ExtAtomContainerManipulator.RemoveHydrogensExceptSingleAndPreserveAtomID(mol2);

            //    Calling the main algorithm to perform MCS search

            Aromaticity.CDKLegacy.Apply(source);
            Aromaticity.CDKLegacy.Apply(target);

            bool bondSensitive        = false;
            bool removeHydrogen       = true;
            bool stereoMatch          = true;
            bool fragmentMinimization = true;
            bool energyMinimization   = true;

            Isomorphism comparison = new Isomorphism(Algorithm.Default, bondSensitive);

            comparison.Init(source, target, removeHydrogen, true);
            comparison.SetChemFilters(stereoMatch, fragmentMinimization, energyMinimization);

            Assert.IsTrue(comparison.IsSubgraph());
            Assert.AreEqual(13, comparison.GetFirstMapping().Count);
        }
Example #3
0
 static VFLibTest()
 {
     hexane = CreateHexane();
     Assert.AreEqual(6, hexane.Atoms.Count);
     ExtAtomContainerManipulator.PercieveAtomTypesAndConfigureAtoms(hexane);
     hexane = ExtAtomContainerManipulator.RemoveHydrogensExceptSingleAndPreserveAtomID(hexane);
     Aromaticity.CDKLegacy.Apply(hexane);
     hexaneQuery = new QueryCompiler(hexane, true).Compile();
     Assert.AreEqual(6, hexaneQuery.CountNodes());
     benzene = CreateBenzene();
     ExtAtomContainerManipulator.PercieveAtomTypesAndConfigureAtoms(benzene);
     hexane = ExtAtomContainerManipulator.RemoveHydrogensExceptSingleAndPreserveAtomID(benzene);
     Aromaticity.CDKLegacy.Apply(benzene);
     benzeneQuery = new QueryCompiler(benzene, true).Compile();
 }
Example #4
0
        public void TestSMSDLargeSubgraph()
        {
            var    sp     = CDK.SmilesParser;
            string c03374 = "CC1=C(C=C)\\C(NC1=O)=C" + "\\C1=C(C)C(CCC(=O)O[C@@H]2O[C@@H]"
                            + "([C@@H](O)[C@H](O)[C@H]2O)C(O)=O)" + "=C(CC2=C(CCC(O)=O)C(C)=C(N2)" + "\\C=C2NC(=O)C(C=C)=C/2C)N1";

            string c05787 = "CC1=C(C=C)\\C(NC1=O)=C" + "\\C1=C(C)C(CCC(=O)O[C@@H]2O[C@@H]"
                            + "([C@@H](O)[C@H](O)[C@H]2O)C(O)=O)" + "=C(CC2=C(CCC(=O)O[C@@H]3O[C@@H]"
                            + "([C@@H](O)[C@H](O)[C@H]3O)C(O)=O)" + "C(C)=C(N2)" + "\\C=C2NC(=O)C(C=C)=C/2C)N1";

            var mol1 = sp.ParseSmiles(c03374);
            var mol2 = sp.ParseSmiles(c05787);

            ExtAtomContainerManipulator.PercieveAtomTypesAndConfigureAtoms(mol1);
            ExtAtomContainerManipulator.PercieveAtomTypesAndConfigureAtoms(mol2);

            IAtomContainer source = ExtAtomContainerManipulator.RemoveHydrogensExceptSingleAndPreserveAtomID(mol1);
            IAtomContainer target = ExtAtomContainerManipulator.RemoveHydrogensExceptSingleAndPreserveAtomID(mol2);

            //    Calling the main algorithm to perform MCS cearch

            Aromaticity.CDKLegacy.Apply(source);
            Aromaticity.CDKLegacy.Apply(target);

            bool bondSensitive        = true;
            bool removeHydrogen       = true;
            bool stereoMatch          = true;
            bool fragmentMinimization = true;
            bool energyMinimization   = true;

            Isomorphism comparison = new Isomorphism(Algorithm.SubStructure, bondSensitive);

            comparison.Init(source, target, removeHydrogen, true);
            comparison.SetChemFilters(stereoMatch, fragmentMinimization, energyMinimization);

            Assert.IsTrue(comparison.IsSubgraph());
            Assert.AreEqual(55, comparison.GetFirstMapping().Count);
        }
Example #5
0
 /// <summary>
 /// Returns IAtomContainer without Hydrogen. If an AtomContainer has atom single atom which
 /// is atom Hydrogen then its not removed.
 /// </summary>
 /// <returns>IAtomContainer without Hydrogen. If an AtomContainer has atom single atom which is atom Hydrogen then its not removed.</returns>
 public static IAtomContainer RemoveHydrogensAndPreserveAtomID(IAtomContainer atomContainer)
 {
     return(ExtAtomContainerManipulator.RemoveHydrogensExceptSingleAndPreserveAtomID(atomContainer));
 }