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 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 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 TestMatchCountCDKMCS() { Isomorphism smsd = new Isomorphism(Algorithm.CDKMCS, true); var sp = CDK.SmilesParser; var query = sp.ParseSmiles("CC"); var target = sp.ParseSmiles("C1CCC12CCCC2"); smsd.Init(query, target, false, true); bool foundMatches = smsd.IsSubgraph(); Assert.AreEqual(18, smsd.GetAllAtomMapping().Count); Assert.IsTrue(foundMatches); IQueryAtomContainer queryContainer = QueryAtomContainerCreator.CreateSymbolAndBondOrderQueryContainer(query); smsd.Init(queryContainer, target); foundMatches = smsd.IsSubgraph(); Assert.IsTrue(foundMatches); }
public void TestSearchMCS() { try { var sp = new SmilesParser(ChemObjectBuilder.Instance, false); IAtomContainer target = null; target = sp.ParseSmiles("C\\C=C/Nc1cccc(c1)N(O)\\C=C\\C\\C=C\\C=C/C"); AtomContainerManipulator.PercieveAtomTypesAndConfigureAtoms(target); var queryac = sp.ParseSmiles("Nc1ccccc1"); 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(7, smsd1.GetFirstAtomMapping().Count); Assert.AreEqual(2, smsd1.GetAllAtomMapping().Count); Assert.IsNotNull(smsd1.GetFirstMapping()); } catch (InvalidSmilesException ex) { Trace.TraceError(ex.Message); } }