[Apologies this is coming so late, i thought I had sent it, but apparently
I only saved it as a draft]

Matt already piped up with an answer that works; I'll provide a bit more
context.

On Tue, Feb 18, 2014 at 5:05 PM, Elizabeth Wylie <ewyli...@gmail.com> wrote:

> Hello All,
>
> I have a series of 'aromatic' compounds in SMILES provided from a large
> database. These may or may not be nonsensical compounds, but I'm running
> into issues finding SMARTS expressions that can match an aromatic boron
> atom.
>
> example:
> In [1]: from rdkit import Chem
>
> In [2]: s = "Cb1c2sccc2cnn#1"
>
>
>
> In [3]: m = Chem.MolFromSmiles(s)
>
>
>
> In [4]: t = Chem.MolFromSmarts('B')
>
>

"B" in a SMARTS, like any capitol letter for a member of the organic
subset, implies: "Aliphatic Boron".


> In [5]: m.HasSubstructMatch(t)
>
>
> Out[5]: False
>
> In [6]: t = Chem.MolFromSmarts('[b]')
>
>
> [09:54:18] SMARTS Parse Error: syntax error for input: [b]
>

That's a bug in the SMARTS parser; I'll fix it.

The general rule for SMARTS is that if you want to match aromatic and
aliphatic elements you should use the atomic number. So for your case,
possible SMARTS are:
"B": matches aliphatic B
"[#5]": matches any B
"[#5;a]": matches aromatic B
"[#5;A]": matches aliphatic B.

quick demonstration of that:
In [8]:
Chem.MolFromSmiles('c1ccccb1').HasSubstructMatch(Chem.MolFromSmarts('[#5;a]'))
Out[8]: True

In [9]:
Chem.MolFromSmiles('c1ccccb1').HasSubstructMatch(Chem.MolFromSmarts('[#5;A]'))
Out[9]: False

In [10]:
Chem.MolFromSmiles('c1ccccb1').HasSubstructMatch(Chem.MolFromSmarts('[#5]'))
Out[10]: True


Hope this helps,
-greg
------------------------------------------------------------------------------
Managing the Performance of Cloud-Based Applications
Take advantage of what the Cloud has to offer - Avoid Common Pitfalls.
Read the Whitepaper.
http://pubads.g.doubleclick.net/gampad/clk?id=121054471&iu=/4140/ostg.clktrk
_______________________________________________
Rdkit-discuss mailing list
Rdkit-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/rdkit-discuss

Reply via email to