Esempio n. 1
0
        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]")));
        }
Esempio n. 2
0
 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")));
 }
Esempio n. 3
0
        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]")));
        }
Esempio n. 4
0
        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]")));
        }
Esempio n. 5
0
 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-]>>")));
 }
Esempio n. 6
0
 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")));
 }
Esempio n. 7
0
 public void Components()
 {
     Assert.IsTrue(SmartsPattern.Create("(O).(O)").Matches(Smi("O.O")));
     Assert.IsFalse(SmartsPattern.Create("(O).(O)").Matches(Smi("OO")));
 }
Esempio n. 8
0
        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")));
        }
Esempio n. 9
0
 public void NoMapsInQueryMapsInTargetIgnored()
 {
     Assert.AreEqual(4, SmartsPattern.Create("C>>C").MatchAll(Rsmi("[C:7][C:8]>>[C:7][C:8]")).Count());
 }
Esempio n. 10
0
 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());
 }
Esempio n. 11
0
 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());
 }
Esempio n. 12
0
 public void MismatchedQueryMapsIgnored()
 {
     Assert.AreEqual(4, SmartsPattern.Create("[C:1]>>[C:2]").MatchAll(Rsmi("[CH3:7][CH3:8]>>[CH3:7][CH3:8]")).Count());
 }
Esempio n. 13
0
 public void MappedMatch()
 {
     Assert.AreEqual(2, SmartsPattern.Create("[C:1]>>[C:1]").MatchAll(Rsmi("[CH3:7][CH3:8]>>[CH3:7][CH3:8]")).Count());
 }
Esempio n. 14
0
 [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());
 }
Esempio n. 15
0
 public void NoMapsInTarget()
 {
     Assert.AreEqual(0, SmartsPattern.Create("[C:1]>>[C:1]").MatchAll(Rsmi("C>>C")).Count());
 }
Esempio n. 16
0
 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());
 }
Esempio n. 17
0
 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());
 }
Esempio n. 18
0
 public void NoMaps()
 {
     Assert.AreEqual(4, SmartsPattern.Create("C>>C").MatchAll(Rsmi("CC>>CC")).Count());
 }