As Pat pointed out, what's happening here is that you have an explicit H in
your SMARTS.
The RDKit has a function, MergeQueryHs(), to merge this into the query of
the atom it's connected to. Here's the application to your example:

In [2]:
s=Chem.MolFromSmarts('[#8]=[#6]-3-c1c2c(ccc1)cccc2-[#6](-[#7]-3-[#1])=[#8]')
   ...: x=Chem.MolFromSmiles('O=C3C1=C2C(=CC=C1)C=CC=C2C(N3[H])=O')
   ...: x.HasSubstructMatch(s)
Out[2]: False

In [4]: s2 = Chem.MergeQueryHs(s)

In [5]: x.HasSubstructMatch(s2)
Out[5]: True


-greg


On Wed, Mar 27, 2019 at 1:02 AM Li, Xiaobo [xiaoboli] <
xiaobo...@liverpool.ac.uk> wrote:

> Dear all,
>
>
> I have a molecule in Smiles
>
>
> O=C(C1=C2C(C=CC=C23)=CC=C1)N([H])C3=O (Copied from Chemdraw)
>
>
> then, using online converter to get Smarts (
> https://pubchem.ncbi.nlm.nih.gov/edit2/index.html)
>
>
> [#8]=[#6]-3-c1c2c(ccc1)cccc2-[#6](-[#7]-3-[#1])=[#8]
>
>
> But I got 'false' with following code
>
>
>
> s=Chem.MolFromSmarts('[#8]=[#6]-3-c1c2c(ccc1)cccc2-[#6](-[#7]-3-[#1])=[#8]')
> x=Chem.MolFromSmiles('O=C3C1=C2C(=CC=C1)C=CC=C2C(N3[H])=O')
> x.HasSubstructMatch(s)
>
>
> Then I tried this:
>
>
> s=Chem.MolFromSmarts('[#8]=[#6]-3-c1c2c(ccc1)cccc2-[#6](-[#7]-3-[#1])=[#8]')
> s
>
>
>
>
> Any suggestion?
>
>
> Thanks.
>
>
> Best regards,
>
>
> Xiaobo Li
>
>
>
>
>
>
>
>
>
>
> _______________________________________________
> Rdkit-discuss mailing list
> Rdkit-discuss@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/rdkit-discuss
>
_______________________________________________
Rdkit-discuss mailing list
Rdkit-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/rdkit-discuss

Reply via email to