Exemple #1
0
        public void Test2LetterSMARTS()
        {
            var query = SMARTSParser.Parse("Sc1ccccc1", ChemObjectBuilder.Instance);

            Assert.AreEqual(7, query.Atoms.Count);
            Assert.AreEqual("S", query.Atoms[0].Symbol);
        }
Exemple #2
0
        public void Test2LetterSMARTS()
        {
            var query = SMARTSParser.Parse("Sc1ccccc1");

            Assert.AreEqual(7, query.Atoms.Count);
            Assert.AreEqual("S", query.Atoms[0].Symbol);
        }
        public void Visit(string smarts)
        {
            var parser  = new SMARTSParser(new StringReader(smarts));
            var start   = parser.Start();
            var visitor = new SmartsQueryVisitor();

            visitor.Visit(start, null);
        }
Exemple #4
0
        public void Visit(string smarts)
        {
            SMARTSParser       parser  = new SMARTSParser(new StringReader(smarts));
            ASTStart           start   = parser.Start();
            SmartsQueryVisitor visitor = new SmartsQueryVisitor(ChemObjectBuilder.Instance);

            visitor.Visit(start, null);
        }
        public void Dump(string smarts)
        {
            SMARTSParser      parser  = new SMARTSParser(new StringReader(smarts));
            ASTStart          start   = parser.Start();
            SmartsDumpVisitor visitor = new SmartsDumpVisitor();

            visitor.Visit(start, null);
        }
Exemple #6
0
        public void TestAliphaticAtom()
        {
            var container = SMARTSParser.Parse("A");

            Assert.AreEqual(1, container.Atoms.Count);
            IAtom atom = container.Atoms[0];

            Assert.IsTrue(atom is SMARTSAtom);
        }
Exemple #7
0
        public void TestQueryAtomCreation()
        {
            var container = SMARTSParser.Parse("*");

            Assert.AreEqual(1, container.Atoms.Count);
            IAtom atom = container.Atoms[0];

            Assert.IsTrue(atom is SMARTSAtom);
        }
 static void Main()
 {
     #region 1
     SMARTSParser       parser  = new SMARTSParser(new StringReader("C*C"));
     ASTStart           ast     = parser.Start();
     SmartsQueryVisitor visitor = new SmartsQueryVisitor();
     QueryAtomContainer query   = (QueryAtomContainer)visitor.Visit(ast, null);
     #endregion
 }
Exemple #9
0
        public void TestImplicitHCount()
        {
            var container = SMARTSParser.Parse("[h3]");

            Assert.AreEqual(1, container.Atoms.Count);
            IAtom atom = container.Atoms[0];

            Assert.IsTrue(atom is SMARTSAtom);
        }
Exemple #10
0
 private void InitializeQuery()
 {
     mappings = null;
     if (!cache.TryGetValue(smarts, out query))
     {
         query         = SMARTSParser.Parse(smarts);
         cache[smarts] = query;
     }
 }
Exemple #11
0
        public void TestTotalHCount()
        {
            var container = SMARTSParser.Parse("[H2]", ChemObjectBuilder.Instance);

            Assert.AreEqual(1, container.Atoms.Count);
            IAtom atom = container.Atoms[0];

            Assert.IsTrue(atom is SMARTSAtom);
        }
Exemple #12
0
        public void TestDegree()
        {
            var container = SMARTSParser.Parse("[D2]");

            Assert.AreEqual(1, container.Atoms.Count);
            IAtom atom = container.Atoms[0];

            Assert.IsTrue(atom is SMARTSAtom);
        }
Exemple #13
0
        public void TestAnyOrderBond()
        {
            var container = SMARTSParser.Parse("C~C");

            Assert.AreEqual(2, container.Atoms.Count);
            Assert.AreEqual(1, container.Bonds.Count);
            var bond = container.Bonds[0];

            Assert.IsTrue(bond is AnyOrderQueryBond);
        }
Exemple #14
0
        public void TestAromaticBond()
        {
            var container = SMARTSParser.Parse("C:C");

            Assert.AreEqual(2, container.Atoms.Count);
            Assert.AreEqual(1, container.Bonds.Count);
            IBond bond = container.Bonds[0];

            Assert.IsTrue(bond is AromaticQueryBond);
        }
Exemple #15
0
        public void TestAnyOrderBond()
        {
            var container = SMARTSParser.Parse("C~C", ChemObjectBuilder.Instance);

            Assert.AreEqual(2, container.Atoms.Count);
            Assert.AreEqual(1, container.Bonds.Count);
            IBond bond = container.Bonds[0];

            Assert.IsTrue(bond is AnyOrderQueryBond);
        }
Exemple #16
0
        public void TestAromaticBond()
        {
            var container = SMARTSParser.Parse("C:C", ChemObjectBuilder.Instance);

            Assert.AreEqual(2, container.Atoms.Count);
            Assert.AreEqual(1, container.Bonds.Count);
            var bond = container.Bonds[0];

            Assert.IsTrue(bond is AromaticQueryBond);
        }
Exemple #17
0
        public void TestTripleBond()
        {
            var container = SMARTSParser.Parse("C#C", ChemObjectBuilder.Instance);

            Assert.AreEqual(2, container.Atoms.Count);
            Assert.AreEqual(1, container.Bonds.Count);
            IBond bond = container.Bonds[0];

            Assert.IsTrue(bond is OrderQueryBond);
            OrderQueryBond qBond = (OrderQueryBond)bond;

            Assert.AreEqual(BondOrder.Triple, qBond.Order);
        }
Exemple #18
0
        public void TestSingleBond()
        {
            var container = SMARTSParser.Parse("C-C");

            Assert.AreEqual(2, container.Atoms.Count);
            Assert.AreEqual(1, container.Bonds.Count);
            IBond bond = container.Bonds[0];

            Assert.IsTrue(bond is OrderQueryBond);
            OrderQueryBond qBond = (OrderQueryBond)bond;

            Assert.AreEqual(BondOrder.Single, qBond.Order);
        }
Exemple #19
0
        public void TestTripleBond()
        {
            var container = SMARTSParser.Parse("C#C");

            Assert.AreEqual(2, container.Atoms.Count);
            Assert.AreEqual(1, container.Bonds.Count);
            var bond = container.Bonds[0];

            Assert.IsTrue(bond is OrderQueryBond);
            var qBond = (OrderQueryBond)bond;

            Assert.AreEqual(BondOrder.Triple, qBond.Order);
        }
        void Main()
        {
            UniversalIsomorphismTester universalIsomorphismTester = null;

            #region 1
            SmilesParser       sp            = new SmilesParser();
            IAtomContainer     atomContainer = sp.ParseSmiles("CC(=O)OC(=O)C");
            QueryAtomContainer query         = SMARTSParser.Parse("C*C");
            bool queryMatch = universalIsomorphismTester.IsSubgraph(atomContainer, query);
            #endregion
            #region 2
            SMARTSParser parser = new SMARTSParser(new StringReader("C*C"));
            ASTStart     start  = parser.Start();
            #endregion
        }
 public ASTRingConnectivity(SMARTSParser p, int id)
     : base(p, id)
 {
 }
Exemple #22
0
 public ASTTotalHCount(SMARTSParser p, int id)
     : base(p, id)
 {
 }
Exemple #23
0
 public ASTRingMembership(SMARTSParser p, int id)
     : base(p, id)
 {
 }
Exemple #24
0
 public ASTAtomicNumber(SMARTSParser p, int id)
     : base(p, id)
 {
 }
Exemple #25
0
 public ASTExplicitAtom(SMARTSParser p, int id)
     : base(p, id)
 {
 }
Exemple #26
0
 public ASTExplicitHighAndExpression(SMARTSParser p, int id)
     : base(p, id)
 {
 }
 public ASTTotalConnectivity(SMARTSParser p, int id)
     : base(p, id)
 {
 }
Exemple #28
0
 public ASTStart(SMARTSParser p, int id)
     : base(p, id)
 {
 }
Exemple #29
0
 /// <summary>
 /// Creates a new instance.
 /// </summary>
 public ASTPrimitiveAtomExpression(SMARTSParser p, int id)
     : base(p, id)
 {
 }
Exemple #30
0
 public ASTLowAndExpression(SMARTSParser p, int id)
     : base(p, id)
 {
 }