Hi Markus,
I tried to put together a comprehensible explanation in his gist:
https://gist.github.com/ptosco/1088937ce332bd66c999a2a5fbc855b3
Please also refer to the following threads on the mailing list:
https://sourceforge.net/p/rdkit/mailman/message/29679834/
https://sourceforge.net/p/rdkit/mailman/message/36696340/
and to this blog post by Roger Sayle:
https://nextmovesoftware.com/blog/2013/02/27/explicit-and-implicit-hydrogens-taking-liberties-with-valence/
for further clarifications.
Cheers,
p.
On 05/11/2019 19:52, Markus Heller wrote:
Hi,
I’m trying to understand how to properly use explicit hydrogens in
substructure searches. Below is an example. I would like to find all
molecules that contain my query with hydrogens at the nitrogens, and I
thought I was on the right track … Why does the first query with the
explicit H not match m1?
Thanks
Markus
<code>
from rdkit import Chem
from rdkit.Chem.Draw import IPythonConsole
from rdkit.Chem import rdDepictor
rdDepictor.SetPreferCoordGen(True)
IPythonConsole.ipython_useSVG = True
m1 = Chem.MolFromSmiles('c1cn[nH]c1N')
m2 = Chem.MolFromSmiles('CNc1ccn[nH]1')
m3 = Chem.MolFromSmiles('Nc1ccnn(C)1')
# do not remove explicit H
params = Chem.SmilesParserParams()
params.removeHs=False
query = Chem.MolFromSmiles('c1cn[nH]c(N([H])([H]))1', params)
# first should be True, but all are False
m1.HasSubstructMatch(query)
m2.HasSubstructMatch(query)
m3.HasSubstructMatch(query)
# rebuild query with explicit H removed, not what I want
query = Chem.MolFromSmiles('c1cn[nH]c(N([H])([H]))1')
m1.HasSubstructMatch(query)
m2.HasSubstructMatch(query)
m3.HasSubstructMatch(query)
</code>
--
*Markus Heller, PhD*
Senior Scientist
Direct:604.827.1122 Main:604.827.1147
A027228F
2405 WesbrookMall,4th Floor,Vancouver,BCV6T 1Z3
Thisemail and any attachments theretomay
containconfidentialmaterialforthesoleuse of theintended
recipient.Anyreview,copying,or distribution of thisemail (or any
attachments thereto)by others is strictly prohibited. If youare not
theintended recipient,please contact thesenderimmediately and
permanently delete theoriginal and any copiesof thisemail and any
attachments thereto.
_______________________________________________
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