public void TestSMSDAdpAtpSubgraph() { var sp = CDK.SmilesParser; string adp = "NC1=NC=NC2=C1N=CN2[C@@H]1O[C@H](COP(O)(=O)OP(O)(O)=O)[C@@H](O)[C@H]1O"; string atp = "NC1=NC=NC2=C1N=CN2[C@@H]1O[C@H](COP(O)(=O)OP(O)(=O)OP(O)(O)=O)[C@@H](O)[C@H]1O"; var mol1 = sp.ParseSmiles(adp); var mol2 = sp.ParseSmiles(atp); ExtAtomContainerManipulator.PercieveAtomTypesAndConfigureAtoms(mol1); ExtAtomContainerManipulator.PercieveAtomTypesAndConfigureAtoms(mol2); // Calling the main algorithm to perform MCS cearch Aromaticity.CDKLegacy.Apply(mol1); Aromaticity.CDKLegacy.Apply(mol2); bool bondSensitive = true; bool removeHydrogen = true; bool stereoMatch = true; bool fragmentMinimization = true; bool energyMinimization = true; Isomorphism comparison = new Isomorphism(Algorithm.Default, bondSensitive); comparison.Init(mol1, mol2, removeHydrogen, true); comparison.SetChemFilters(stereoMatch, fragmentMinimization, energyMinimization); // Get modified Query and Target Molecules as Mappings will correspond to these molecules Assert.IsTrue(comparison.IsSubgraph()); Assert.AreEqual(2, comparison.GetAllMapping().Count); Assert.AreEqual(27, comparison.GetFirstMapping().Count); }
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()); }
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); ExtAtomContainerManipulator.PercieveAtomTypesAndConfigureAtoms(queryac); ExtAtomContainerManipulator.PercieveAtomTypesAndConfigureAtoms(target); // Calling the main algorithm to perform MCS cearch Aromaticity.CDKLegacy.Apply(queryac); Aromaticity.CDKLegacy.Apply(target); Isomorphism smsd1 = new Isomorphism(Algorithm.Default, true); smsd1.Init(queryac, target, true, true); smsd1.SetChemFilters(true, true, true); Assert.IsNotNull(smsd1.GetFirstMapping()); Assert.AreEqual(2, smsd1.GetAllAtomMapping().Count); }
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); }
public void TestSMSD() { // Isomorphism ebimcs = new Isomorphism(Algorithm.VFLibMCS, true); // ebimcs.Init(Cyclohexane, Benzene, true, true); // ebimcs.SetChemFilters(true, true, true); // Assert.AreEqual(1, ebimcs.GetFirstMapping().Count); Isomorphism ebimcs1 = new Isomorphism(Algorithm.Default, true); ebimcs1.Init(Benzene, Napthalene, true, true); ebimcs1.SetChemFilters(true, true, true); Assert.AreEqual(6, ebimcs1.GetFirstAtomMapping().Count); ebimcs1 = new Isomorphism(Algorithm.Default, false); ebimcs1.Init(Benzene, Napthalene, true, true); ebimcs1.SetChemFilters(true, true, true); Assert.AreEqual(6, ebimcs1.GetFirstAtomMapping().Count); ebimcs1 = new Isomorphism(Algorithm.VFLibMCS, true); ebimcs1.Init(Benzene, Napthalene, true, true); ebimcs1.SetChemFilters(true, true, true); Assert.AreEqual(6, ebimcs1.GetFirstAtomMapping().Count); ebimcs1 = new Isomorphism(Algorithm.CDKMCS, true); ebimcs1.Init(Benzene, Napthalene, true, true); ebimcs1.SetChemFilters(true, true, true); Assert.AreEqual(6, ebimcs1.GetFirstAtomMapping().Count); ebimcs1 = new Isomorphism(Algorithm.MCSPlus, true); ebimcs1.Init(Benzene, Napthalene, true, true); ebimcs1.SetChemFilters(true, true, true); Assert.AreEqual(6, ebimcs1.GetFirstAtomMapping().Count); }
public void TestSMSD() { Isomorphism ebimcs = new Isomorphism(Algorithm.Default, false); ebimcs.Init(Cyclohexane, Benzene, true, true); ebimcs.SetChemFilters(true, true, true); Assert.AreEqual(6, ebimcs.GetFirstMapping().Count); }
public void TestSubgraph() { Isomorphism sbf = new Isomorphism(Algorithm.SubStructure, false); sbf.Init(Benzene, Benzene, true, true); sbf.SetChemFilters(false, false, false); Assert.IsTrue(sbf.IsSubgraph()); }
public void TestVFLib() { Isomorphism sbf = new Isomorphism(Algorithm.VFLibMCS, true); sbf.Init(Benzene, Benzene, true, true); sbf.SetChemFilters(true, true, true); Assert.IsTrue(sbf.IsSubgraph()); }
public void TestSMSDCyclohexaneBenzeneSubgraph() { Isomorphism ebimcs1 = new Isomorphism(Algorithm.SubStructure, false); ebimcs1.Init(Cyclohexane, Benzene, true, true); ebimcs1.SetChemFilters(true, true, true); Assert.IsTrue(ebimcs1.IsSubgraph()); }
public void TestSMSDChemicalFilters() { Isomorphism ebimcs = new Isomorphism(Algorithm.Default, false); ebimcs.Init(Cyclohexane, Benzene, true, true); ebimcs.SetChemFilters(true, true, true); Assert.AreEqual(12, ebimcs.GetAllMapping().Count); Assert.IsTrue(ebimcs.IsSubgraph()); }
public void TestSMSDChemicalFilters() { Isomorphism ebimcs1 = new Isomorphism(Algorithm.Default, true); ebimcs1.Init(Napthalene, Benzene, true, true); ebimcs1.SetChemFilters(true, true, true); Assert.AreEqual(6, ebimcs1.GetAllMapping().Count); Assert.IsFalse(ebimcs1.IsSubgraph()); }
public void TestCDKMCS() { Isomorphism ebimcs = new Isomorphism(Algorithm.CDKMCS, false); ebimcs.Init(Cyclohexane, Benzene, true, true); ebimcs.SetChemFilters(true, true, true); Assert.AreEqual(6, ebimcs.GetFirstMapping().Count); Assert.IsTrue(ebimcs.IsSubgraph()); }
public void TestMCSPlus() { //TO DO fix me this error Isomorphism ebimcs = new Isomorphism(Algorithm.MCSPlus, false); ebimcs.Init(Cyclohexane, Benzene, true, true); ebimcs.SetChemFilters(true, true, true); Assert.IsTrue(ebimcs.IsSubgraph()); }
public void TestSubgraph() { Isomorphism sbf = new Isomorphism(Algorithm.SubStructure, true); sbf.Init(Benzene, Napthalene, true, true); sbf.SetChemFilters(false, false, false); Assert.IsTrue(sbf.IsSubgraph()); Assert.AreEqual(24, sbf.GetAllAtomMapping().Count); }
public void TestSMSDCyclohexaneBenzeneSubgraph() { // IQueryAtomContainer queryContainer = QueryAtomContainerCreator.CreateSymbolAndBondOrderQueryContainer(Cyclohexane); Isomorphism ebimcs = new Isomorphism(Algorithm.VFLibMCS, true); ebimcs.Init(Cyclohexane, Benzene, true, true); ebimcs.SetChemFilters(true, true, true); Assert.IsFalse(ebimcs.IsSubgraph()); }
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 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 TestSet_IAtomContainer_IAtomContainer() { 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.IsNotNull(smsd1.GetFirstMapping()); }
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 TestSet_MolHandler_MolHandler() { var sp = CDK.SmilesParser; var target1 = sp.ParseSmiles("C\\C=C/Nc1cccc(c1)N(O)\\C=C\\C\\C=C\\C=C/C"); var queryac = sp.ParseSmiles("Nc1ccccc1"); MolHandler source = new MolHandler(queryac, true, true); MolHandler target = new MolHandler(target1, true, true); Isomorphism smsd1 = new Isomorphism(Algorithm.Default, true); smsd1.Init(source.Molecule, target.Molecule, true, true); smsd1.SetChemFilters(true, true, true); Assert.IsNotNull(smsd1.GetFirstMapping()); }
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)); }
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.Default, true); smsd1.Init(queryac, target, true, true); smsd1.SetChemFilters(false, false, true); double score = 610.0; Assert.AreEqual(score, smsd1.GetEnergyScore(0)); }
public void TestSMSDBondInSensitive() { Isomorphism ebimcs1 = new Isomorphism(Algorithm.Default, false); ebimcs1.Init(Cyclohexane, Benzene, true, true); ebimcs1.SetChemFilters(true, true, true); Assert.AreEqual(6, ebimcs1.GetFirstAtomMapping().Count); Isomorphism ebimcs2 = new Isomorphism(Algorithm.Default, false); ebimcs2.Init(Benzene, Napthalene, true, true); ebimcs2.SetChemFilters(true, true, true); Assert.AreEqual(6, ebimcs2.GetFirstAtomMapping().Count); }
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 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"); var 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); }
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); }
public void TestSMSDBondSensitive() { Isomorphism ebimcs3 = new Isomorphism(Algorithm.CDKMCS, true); ebimcs3.Init(Cyclohexane, Benzene, true, true); ebimcs3.SetChemFilters(false, false, false); Assert.IsFalse(ebimcs3.IsSubgraph()); Isomorphism ebimcs4 = new Isomorphism(Algorithm.CDKMCS, true); ebimcs4.Init(Benzene, Napthalene, true, true); ebimcs4.SetChemFilters(true, true, true); Assert.AreEqual(6, ebimcs4.GetFirstAtomMapping().Count); Isomorphism ebimcs5 = new Isomorphism(Algorithm.VFLibMCS, true); ebimcs5.Init(Cyclohexane, Benzene, true, true); ebimcs5.SetChemFilters(true, true, true); Assert.IsFalse(ebimcs5.IsSubgraph()); Isomorphism ebimcs6 = new Isomorphism(Algorithm.VFLibMCS, true); ebimcs6.Init(Benzene, Napthalene, true, true); ebimcs6.SetChemFilters(true, true, true); Assert.AreEqual(6, ebimcs6.GetFirstAtomMapping().Count); Isomorphism ebimcs7 = new Isomorphism(Algorithm.MCSPlus, true); ebimcs7.Init(Cyclohexane, Benzene, true, true); ebimcs7.SetChemFilters(true, true, true); Assert.IsFalse(ebimcs7.IsSubgraph()); Isomorphism ebimcs8 = new Isomorphism(Algorithm.MCSPlus, true); ebimcs8.Init(Benzene, Napthalene, true, true); ebimcs8.SetChemFilters(true, true, true); Assert.AreEqual(6, ebimcs8.GetFirstAtomMapping().Count); }
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); }
public void TestSingleMappingTesting() { var sp = CDK.SmilesParser; var atomContainer = sp.ParseSmiles("C"); IAtomContainer mol2 = Create4Toluene(); ExtAtomContainerManipulator.PercieveAtomTypesAndConfigureAtoms(mol2); Aromaticity.CDKLegacy.Apply(mol2); bool bondSensitive = false; bool removeHydrogen = true; bool stereoMatch = false; bool fragmentMinimization = false; bool energyMinimization = false; Isomorphism comparison = new Isomorphism(Algorithm.Default, bondSensitive); comparison.Init(atomContainer, mol2, removeHydrogen, true); comparison.SetChemFilters(stereoMatch, fragmentMinimization, energyMinimization); Assert.IsTrue(comparison.IsSubgraph()); Assert.AreEqual(7, comparison.GetAllMapping().Count); }