Exemplo n.º 1
0
        public void BondStereoUnspec()
        {
            var mol = new QueryAtomContainer(null);

            Assert.IsTrue(Smarts.Parse(mol, "C/C=C/?\\?C"));
            Assert.AreEqual("C/C=C!/!\\C", Smarts.Generate(mol));
        }
Exemplo n.º 2
0
        public void CompGroupingOnAgent()
        {
            var mol = new QueryAtomContainer(null);

            Assert.IsTrue(Smarts.Parse(mol, ">(c1ccccc1[O-].[Na+])>"));
            Assert.AreEqual(">(c1c(cccc1)[O-].[Na+])>", Smarts.Generate(mol));
        }
Exemplo n.º 3
0
        public void AtomStereoOrUnspec()
        {
            var mol = new QueryAtomContainer(null);

            Assert.IsTrue(Smarts.Parse(mol, "C[C@?H](O)CC"));
            Assert.AreEqual("C[CH1@?](O)CC", Smarts.Generate(mol));
        }
Exemplo n.º 4
0
        public void ReactionWithMaps()
        {
            var mol = new QueryAtomContainer(null);

            Assert.IsTrue(Smarts.Parse(mol, "c1cccc[c:1]1[NH2:2]>>c1cccc[c:1]1[N:2](~O)~O"));
            Assert.AreEqual("c1[c:1](cccc1)[NH2:2]>>c1[c:1](cccc1)[N:2](~O)~O", Smarts.Generate(mol));
        }
Exemplo n.º 5
0
        public void CompGrouping()
        {
            var mol = new QueryAtomContainer(null);

            Assert.IsTrue(Smarts.Parse(mol, "([Na+].[Cl-]).c1ccccc1"));
            Assert.AreEqual("c1ccccc1.([Na+].[Cl-])", Smarts.Generate(mol));
        }
Exemplo n.º 6
0
        public void RingClosureExprs3()
        {
            var mol = new QueryAtomContainer(null);

            Assert.IsTrue(Smarts.Parse(mol, "C1-,=CCCC1"));
            Assert.AreEqual("C1CCCC-,=1", Smarts.Generate(mol));
        }
Exemplo n.º 7
0
        public void Reaction()
        {
            var mol = new QueryAtomContainer(null);

            Assert.IsTrue(Smarts.Parse(mol, "c1ccccc1[NH2]>>c1ccccc1N(~O)~O"));
            Assert.AreEqual("c1c(cccc1)[NH2]>>c1c(cccc1)N(~O)~O", Smarts.Generate(mol));
        }
Exemplo n.º 8
0
        public void NotTripleBond()
        {
            var mol = new QueryAtomContainer(null);

            Assert.IsTrue(Smarts.Parse(mol, "C!#C"));
            Assert.AreEqual("C!#C", Smarts.Generate(mol));
        }
Exemplo n.º 9
0
        public void AromaticBond()
        {
            var mol = new QueryAtomContainer(null);

            Assert.IsTrue(Smarts.Parse(mol, "[#6]:[#6]"));
            Assert.AreEqual("[#6]:[#6]", Smarts.Generate(mol));
        }
Exemplo n.º 10
0
        public void BondFalse()
        {
            var mol = new QueryAtomContainer(null);

            Assert.IsTrue(Smarts.Parse(mol, "C!~C"));
            Assert.AreEqual("C!~C", Smarts.Generate(mol));
        }
Exemplo n.º 11
0
        public override int GetHashCode()
        {
            int result = Smarts != null?Smarts.GetHashCode() : 0;

            result = 31 * result + (matchingAtoms != null ? Arrays.GetHashCode(matchingAtoms) : 0);
            return(result);
        }
Exemplo n.º 12
0
        static IAtomContainer Sma(string smarts)
        {
            var query = new QueryAtomContainer(null);

            Smarts.Parse(query, smarts);
            return(query);
        }
Exemplo n.º 13
0
        public void BondStereoCisThenTransWithNbr()
        {
            var mol = new QueryAtomContainer(null);

            Assert.IsTrue(Smarts.Parse(mol, "C/C=C(C)\\C=C\\C"));
            Assert.AreEqual("C/C=C(C)\\C=C\\C", Smarts.Generate(mol));
        }
Exemplo n.º 14
0
        public void BondStereoCisThenTransUnspecWithNbrComplex()
        {
            var mol = new QueryAtomContainer(null);

            Assert.IsTrue(Smarts.Parse(mol, "C/?C=C(C)\\C=C\\O"));
            Assert.AreEqual("C/?C=C(C)/C=C/O", Smarts.Generate(mol));
        }
Exemplo n.º 15
0
        public static IAtomContainer MolFromSmarts(string smarts)
        {
            var mol = CDK.Builder.NewAtomContainer();

            Smarts.Parse(mol, smarts, SmartsFlaver.Daylight);
            return(mol);
        }
Exemplo n.º 16
0
        public void BondInRing()
        {
            var mol = new QueryAtomContainer();

            Assert.IsTrue(Smarts.Parse(mol, "C@C"));
            Assert.AreEqual("C@C", Smarts.Generate(mol));
        }
Exemplo n.º 17
0
        public void SingleOrDouble()
        {
            var expr = new Expr(ExprType.AliphaticOrder, 1)
                       .Or(new Expr(ExprType.AliphaticOrder, 2));

            Assert.AreEqual("-,=", Smarts.GenerateBond(expr));
        }
Exemplo n.º 18
0
        public void BondTrue()
        {
            var mol = new QueryAtomContainer();

            Assert.IsTrue(Smarts.Parse(mol, "C~C~N(~O)~O"));
            Assert.AreEqual("C~C~N(~O)~O", Smarts.Generate(mol));
        }
Exemplo n.º 19
0
        public void SingleOrDoubleInRing2()
        {
            var expr = new Expr(ExprType.IsInRing)
                       .And(new Expr(ExprType.SingleOrDouble));

            Assert.AreEqual("@;-,=", Smarts.GenerateBond(expr));
        }
Exemplo n.º 20
0
        static Expr GetBondExpr(string sma, SmartsFlaver flav)
        {
            var mol = new AtomContainer();

            Assert.IsTrue(Smarts.Parse(mol, sma, flav));
            return(GetBondExpr(mol.Bonds[0]));
        }
Exemplo n.º 21
0
        public void TestAliphaticSymbols()
        {
            foreach (var e in ChemicalElement.Values)
            {
                switch (e.Symbol)
                {
                case "R":
                    continue;

                default:
                    int len = e.Symbol.Length;
                    if (len == 1 || len == 2)
                    {
                        string smarts = $"[{e.Symbol}]";
                        var    mol    = new QueryAtomContainer();
                        Assert.IsTrue(Smarts.Parse(mol, smarts), smarts);
                        var expr = GetAtomExpr(mol.Atoms[0]);
                        var ee   = new Expr(ExprType.Element, e.AtomicNumber);
                        var ea   = new Expr(AliphaticElement, e.AtomicNumber);
                        Assert.IsTrue(expr.Equals(ee) || expr.Equals(ea));
                    }
                    break;
                }
            }
        }
Exemplo n.º 22
0
        public void RoundTripStereo()
        {
            var mol = new QueryAtomContainer(null);

            Smarts.Parse(mol, "O1.[S@]=1(C)CC");
            Assert.AreEqual("O=[S@@](C)CC", Smarts.Generate(mol));
        }
Exemplo n.º 23
0
        public void MultipleReads()
        {
            var mol = new QueryAtomContainer();

            Assert.IsTrue(Smarts.Parse(mol, "C/C=C/C"));
            Assert.IsTrue(Smarts.Parse(mol, "C/C=C\\C"));
            Assert.AreEqual("C/C=C/C.C/C=C\\C", Smarts.Generate(mol));
        }
Exemplo n.º 24
0
 public void FormalCharges()
 {
     Assert.AreEqual("[-2]", Smarts.GenerateAtom(GetExpr(ExprType.FormalCharge, -2)));
     Assert.AreEqual("[-]", Smarts.GenerateAtom(GetExpr(ExprType.FormalCharge, -1)));
     Assert.AreEqual("[+0]", Smarts.GenerateAtom(GetExpr(ExprType.FormalCharge, 0)));
     Assert.AreEqual("[+]", Smarts.GenerateAtom(GetExpr(ExprType.FormalCharge, 1)));
     Assert.AreEqual("[+2]", Smarts.GenerateAtom(GetExpr(ExprType.FormalCharge, 2)));
 }
Exemplo n.º 25
0
        public void AtomMaps()
        {
            var mol = new QueryAtomContainer();

            Assert.IsFalse(Smarts.Parse(mol, "[:10]"));
            Assert.IsTrue(Smarts.Parse(mol, "[*:10]"));
            Assert.AreEqual(10, mol.Atoms[0].GetProperty <int>(CDKPropertyName.AtomAtomMapping));
        }
Exemplo n.º 26
0
 public void TestRecursive()
 {
     Assert.IsTrue(Smarts.Parse(new QueryAtomContainer(), "[$(*OC)]"));
     Assert.IsFalse(Smarts.Parse(new QueryAtomContainer(), "[$*OC)]"));
     Assert.IsFalse(Smarts.Parse(new QueryAtomContainer(), "[$(*OC]"));
     Assert.IsTrue(Smarts.Parse(new QueryAtomContainer(), "[$((*[O-].[Na+]))]"));
     Assert.IsFalse(Smarts.Parse(new QueryAtomContainer(), "[$([J])]"));
 }
Exemplo n.º 27
0
        public void PrintData()
        {
            PrintMessage("Beauty", Beauty.ToString(), Utilities.Getmark(1, Beauty));
            PrintMessage("Smarts", Smarts.ToString(), Utilities.Getmark(4, Smarts));
            PrintMessage("Phisics", Phisics.ToString(), Utilities.Getmark(7, Phisics));

            PrintAllData(arr);
        }
Exemplo n.º 28
0
        public void IndoleWithExprRoundTrip()
        {
            var mol = new QueryAtomContainer();

            Assert.IsTrue(Smarts.Parse(mol, "[n;$(*C),$(*OC)]1ccc2c1cccc2"));
            // CDK choice of data structures lose local arrangement but
            // output is still indole
            Assert.AreEqual("[n;$(*C),$(*OC)]1c2c(cc1)cccc2", Smarts.Generate(mol));
        }
Exemplo n.º 29
0
        public void UsrRecrNot()
        {
            var expr = new Expr(ExprType.Element, 9)
                       .Or(new Expr(ExprType.Element, 17))
                       .Or(new Expr(ExprType.Element, 35))
                       .Negate();

            Assert.AreEqual("[!$([F,Cl,Br])]", Smarts.GenerateAtom(expr));
        }
Exemplo n.º 30
0
 public void AtomicNumHighWeightElements()
 {
     Assert.AreEqual("[#110]", Smarts.GenerateAtom(GetExpr(ExprType.Element, AtomicNumbers.Darmstadtium)));
     Assert.AreEqual("[#117]", Smarts.GenerateAtom(GetExpr(ExprType.Element, AtomicNumbers.Tennessine)));
     Assert.AreEqual("[#113]", Smarts.GenerateAtom(GetExpr(ExprType.Element, AtomicNumbers.Nihonium)));
     Assert.AreEqual("[#110]", Smarts.GenerateAtom(GetExpr(ExprType.AliphaticElement, AtomicNumbers.Darmstadtium)));
     Assert.AreEqual("[#117]", Smarts.GenerateAtom(GetExpr(ExprType.AliphaticElement, AtomicNumbers.Tennessine)));
     Assert.AreEqual("[#113]", Smarts.GenerateAtom(GetExpr(ExprType.AliphaticElement, AtomicNumbers.Nihonium)));
 }