public void BondStereoCisTrans() { var mol = new QueryAtomContainer(null); Assert.IsTrue(Smarts.Parse(mol, "C/C=C/,\\C")); Assert.AreEqual("C/C=C/,\\C", Smarts.Generate(mol)); }
public void AtomStereo() { var mol = new QueryAtomContainer(null); Assert.IsTrue(Smarts.Parse(mol, "C[C@H](O)CC")); Assert.AreEqual("C[C@H1](O)CC", Smarts.Generate(mol)); }
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; } } }
public void BondFalse() { var mol = new QueryAtomContainer(null); Assert.IsTrue(Smarts.Parse(mol, "C!~C")); Assert.AreEqual("C!~C", Smarts.Generate(mol)); }
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)); }
public void RoundTripStereo() { var mol = new QueryAtomContainer(); Smarts.Parse(mol, "O1.[S@]=1(C)CC"); Assert.AreEqual("O=[S@@](C)CC", Smarts.Generate(mol)); }
public void AromaticBond() { var mol = new QueryAtomContainer(); Assert.IsTrue(Smarts.Parse(mol, "[#6]:[#6]")); Assert.AreEqual("[#6]:[#6]", Smarts.Generate(mol)); }
public static IAtomContainer MolFromSmarts(string smarts) { var mol = CDK.Builder.NewAtomContainer(); Smarts.Parse(mol, smarts, SmartsFlaver.Daylight); return(mol); }
public void BondStereoCisThenTransUnspecWithNbrComplex() { var mol = new QueryAtomContainer(); Assert.IsTrue(Smarts.Parse(mol, "C/?C=C(C)\\C=C\\O")); Assert.AreEqual("C/?C=C(C)/C=C/O", Smarts.Generate(mol)); }
public void RingClosureExprs3() { var mol = new QueryAtomContainer(); Assert.IsTrue(Smarts.Parse(mol, "C1-,=CCCC1")); Assert.AreEqual("C1CCCC-,=1", Smarts.Generate(mol)); }
public void BondStereoUnspec() { var mol = new QueryAtomContainer(); Assert.IsTrue(Smarts.Parse(mol, "C/C=C/?\\?C")); Assert.AreEqual("C/C=C!/!\\C", Smarts.Generate(mol)); }
public void CompGroupingOnAgent() { var mol = new QueryAtomContainer(); Assert.IsTrue(Smarts.Parse(mol, ">(c1ccccc1[O-].[Na+])>")); Assert.AreEqual(">(c1c(cccc1)[O-].[Na+])>", Smarts.Generate(mol)); }
public void AtomStereoOrUnspec() { var mol = new QueryAtomContainer(); Assert.IsTrue(Smarts.Parse(mol, "C[C@?H](O)CC")); Assert.AreEqual("C[CH1@?](O)CC", Smarts.Generate(mol)); }
public void ReactionWithMaps() { var mol = new QueryAtomContainer(); 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)); }
public void CompGrouping() { var mol = new QueryAtomContainer(); Assert.IsTrue(Smarts.Parse(mol, "([Na+].[Cl-]).c1ccccc1")); Assert.AreEqual("c1ccccc1.([Na+].[Cl-])", Smarts.Generate(mol)); }
public void NotTripleBond() { var mol = new QueryAtomContainer(); Assert.IsTrue(Smarts.Parse(mol, "C!#C")); Assert.AreEqual("C!#C", Smarts.Generate(mol)); }
public void Reaction() { var mol = new QueryAtomContainer(); Assert.IsTrue(Smarts.Parse(mol, "c1ccccc1[NH2]>>c1ccccc1N(~O)~O")); Assert.AreEqual("c1c(cccc1)[NH2]>>c1c(cccc1)N(~O)~O", Smarts.Generate(mol)); }
static IAtomContainer Sma(string smarts) { var query = new QueryAtomContainer(null); Smarts.Parse(query, smarts); return(query); }
public void BondInRing() { var mol = new QueryAtomContainer(); Assert.IsTrue(Smarts.Parse(mol, "C@C")); Assert.AreEqual("C@C", Smarts.Generate(mol)); }
static Expr GetBondExpr(string sma, SmartsFlaver flav) { var mol = new AtomContainer(); Assert.IsTrue(Smarts.Parse(mol, sma, flav)); return(GetBondExpr(mol.Bonds[0])); }
public void BondStereoCisThenTransWithNbr() { var mol = new QueryAtomContainer(); Assert.IsTrue(Smarts.Parse(mol, "C/C=C(C)\\C=C\\C")); Assert.AreEqual("C/C=C(C)\\C=C\\C", Smarts.Generate(mol)); }
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)); }
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)); }
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])]")); }
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)); }
public void TrailingOperator() { var mol = new AtomContainer(); Assert.IsFalse(Smarts.Parse(mol, "[a#6,]")); Assert.IsFalse(Smarts.Parse(mol, "[a#6;]")); Assert.IsFalse(Smarts.Parse(mol, "[a#6&]")); Assert.IsFalse(Smarts.Parse(mol, "[a#6!]")); }
public void LeadingBondOperator() { var mol = new AtomContainer(); Assert.IsFalse(Smarts.Parse(mol, "*,-*")); Assert.IsFalse(Smarts.Parse(mol, "*;-*")); Assert.IsFalse(Smarts.Parse(mol, "*&-*")); Assert.IsTrue(Smarts.Parse(mol, "*!-*")); }
public void RingSmallestInvalid() { var mol = new AtomContainer(); Assert.IsTrue(Smarts.Parse(mol, "[r0]")); // not in ring Assert.IsFalse(Smarts.Parse(mol, "[r1]")); Assert.IsFalse(Smarts.Parse(mol, "[r2]")); Assert.IsTrue(Smarts.Parse(mol, "[r3]")); }
public void LeadingOperator() { var mol = new AtomContainer(); Assert.IsFalse(Smarts.Parse(mol, "[,a#6]")); Assert.IsFalse(Smarts.Parse(mol, "[;a#6]")); Assert.IsFalse(Smarts.Parse(mol, "[&a#6]")); Assert.IsTrue(Smarts.Parse(mol, "[!a#6]")); }
public void TrailingBondOperator() { var mol = new AtomContainer(); Assert.IsFalse(Smarts.Parse(mol, "*-,*")); Assert.IsFalse(Smarts.Parse(mol, "*-;*")); Assert.IsFalse(Smarts.Parse(mol, "*-&*")); Assert.IsFalse(Smarts.Parse(mol, "*-!*")); }