public void Isotopes() { // FIXME SMARTS Grammar needs fixing/replacing [12] is not considered valid Assert.IsFalse(SmartsPattern.Create("[12*]").Matches(Smi("C"))); Assert.IsFalse(SmartsPattern.Create("[12*]").Matches(Smi("[CH4]"))); Assert.IsTrue(SmartsPattern.Create("[12*]").Matches(Smi("[12CH4]"))); Assert.IsFalse(SmartsPattern.Create("[12*]").Matches(Smi("[13CH4]"))); Assert.IsFalse(SmartsPattern.Create("[13*]").Matches(Smi("C"))); Assert.IsFalse(SmartsPattern.Create("[13*]").Matches(Smi("[CH4]"))); Assert.IsFalse(SmartsPattern.Create("[13*]").Matches(Smi("[12CH4]"))); Assert.IsTrue(SmartsPattern.Create("[13*]").Matches(Smi("[13CH4]"))); Assert.IsTrue(SmartsPattern.Create("[0*]").Matches(Smi("C"))); Assert.IsTrue(SmartsPattern.Create("[0*]").Matches(Smi("[CH4]"))); Assert.IsFalse(SmartsPattern.Create("[0*]").Matches(Smi("[12CH4]"))); Assert.IsFalse(SmartsPattern.Create("[0*]").Matches(Smi("[13CH4]"))); // Not possible with current grammar // assertFalse(SmartsPattern.create("[!0*]").matches(smi("C"))); // assertFalse(SmartsPattern.create("[!0*]").matches(smi("[CH4]"))); // assertTrue(SmartsPattern.create("[!0*]").matches(smi("[12CH4]"))); // assertTrue(SmartsPattern.create("[!0*]").matches(smi("[13CH4]"))); }
public void SmartsMatchingReaction() { Assert.IsTrue(SmartsPattern.Create("CC").Matches(Rsmi("CC>>"))); Assert.IsTrue(SmartsPattern.Create("CC").Matches(Rsmi(">>CC"))); Assert.IsTrue(SmartsPattern.Create("CC").Matches(Rsmi(">CC>"))); Assert.IsFalse(SmartsPattern.Create("CO").Matches(Rsmi(">>CC"))); }
public void HIsotope() { var ptrn = SmartsPattern.Create("[2#1,3#1]"); Assert.IsFalse(ptrn.Matches(Smi("[H][H]"))); Assert.IsTrue(ptrn.Matches(Smi("[2H]"))); Assert.IsTrue(ptrn.Matches(Smi("[3H]"))); }
public void HasIsotope() { var ptrn = SmartsPattern.Create("[!0]"); Assert.IsFalse(ptrn.Matches(Smi("C"))); Assert.IsTrue(ptrn.Matches(Smi("[12C]"))); Assert.IsTrue(ptrn.Matches(Smi("[13C]"))); }
public void ReactionGrouping() { Assert.IsTrue(SmartsPattern.Create("[Na+].[OH-]>>").Matches(Rsmi("[Na+].[OH-]>>"))); Assert.IsTrue(SmartsPattern.Create("[Na+].[OH-]>>").Matches(Rsmi("[Na+].[OH-]>> |f:0.1|"))); Assert.IsTrue(SmartsPattern.Create("([Na+].[OH-])>>").Matches(Rsmi("[Na+].[OH-]>> |f:0.1|"))); // this one can't match because we don't know if NaOH is one component from the input smiles Assert.IsFalse(SmartsPattern.Create("([Na+].[OH-])>>").Matches(Rsmi("[Na+].[OH-]>>"))); }
public void Stereochemistry() { Assert.IsTrue(SmartsPattern.Create("C[C@H](O)CC").Matches(Smi("C[C@H](O)CC"))); Assert.IsFalse(SmartsPattern.Create("C[C@H](O)CC").Matches(Smi("C[C@@H](O)CC"))); Assert.IsFalse(SmartsPattern.Create("C[C@H](O)CC").Matches(Smi("CC(O)CC"))); }
public void Components() { Assert.IsTrue(SmartsPattern.Create("(O).(O)").Matches(Smi("O.O"))); Assert.IsFalse(SmartsPattern.Create("(O).(O)").Matches(Smi("OO"))); }
public void Stereo_ring_closures() { var ptrn = SmartsPattern.Create("[C@@]1(O[C@@]([C@@]([C@]([C@]1(C)O)(C)O)(O)C)(O)C)(O)C"); Assert.IsTrue(ptrn.Matches(Smi("[C@@]1(O[C@@]([C@@]([C@]([C@]1(C)O)(C)O)(O)C)(O)C)(O)C"))); }
public void NoMapsInQueryMapsInTargetIgnored() { Assert.AreEqual(4, SmartsPattern.Create("C>>C").MatchAll(Rsmi("[C:7][C:8]>>[C:7][C:8]")).Count()); }
public void CCBondForming() { Assert.AreEqual(2, SmartsPattern.Create("([C:1]).([C:2])>>[C:1][C:2]").MatchAll(Rsmi("[C-:13]#[N:14].[K+].[CH:3]1=[CH:4][C:5](=[CH:11][CH:12]=[C:2]1[CH2:1]Br)[C:6](=[O:10])[CH:7]2[CH2:8][CH2:9]2>>[CH:3]1=[CH:4][C:5](=[CH:11][CH:12]=[C:2]1[CH2:1][C:13]#[N:14])[C:6](=[O:10])[CH:7]2[CH2:8][CH2:9]2 |f:0.1|")).Count()); }
public void AtomMapsWithOrLogic3() { Assert.AreEqual(2, SmartsPattern.Create("[C:1][C:1]>>[C:1]").MatchAll(Rsmi("[CH3:7][CH3:7]>>[CH3:7][CH3:8]")).Count()); }
public void MismatchedQueryMapsIgnored() { Assert.AreEqual(4, SmartsPattern.Create("[C:1]>>[C:2]").MatchAll(Rsmi("[CH3:7][CH3:8]>>[CH3:7][CH3:8]")).Count()); }
public void MappedMatch() { Assert.AreEqual(2, SmartsPattern.Create("[C:1]>>[C:1]").MatchAll(Rsmi("[CH3:7][CH3:8]>>[CH3:7][CH3:8]")).Count()); }
[TestMethod(), Ignore()] // Not supported yet public void OptionalMapping() { Assert.AreEqual(2, SmartsPattern.Create("[C:?1]>>[C:?1]").MatchAll(Rsmi("[CH3:7][CH3:8]>>[CH3:7][CH3:8]")).Count()); Assert.AreEqual(4, SmartsPattern.Create("[C:?1]>>[C:?1]").MatchAll(Rsmi("CC>>CC")).Count()); }
public void NoMapsInTarget() { Assert.AreEqual(0, SmartsPattern.Create("[C:1]>>[C:1]").MatchAll(Rsmi("C>>C")).Count()); }
public void UnpairedMapIsQueryIsIgnored() { Assert.AreEqual(4, SmartsPattern.Create("[C:1]>>C").MatchAll(Rsmi("[CH3:7][CH3:8]>>[CH3:7][CH3:8]")).Count()); Assert.AreEqual(4, SmartsPattern.Create("C>>[C:1]").MatchAll(Rsmi("[CH3:7][CH3:8]>>[CH3:7][CH3:8]")).Count()); }
public void MatchProductStereo() { Assert.AreEqual(1, SmartsPattern.Create(">>C[C@H](CC)[C@H](CC)O") .MatchAll(Rsmi(">>C[C@H](CC)[C@H](CC)O")) .CountUnique()); }
public void NoMaps() { Assert.AreEqual(4, SmartsPattern.Create("C>>C").MatchAll(Rsmi("CC>>CC")).Count()); }