[Rdkit-discuss] Explicit H in substructure searches
Open-Source Cheminformatics and Machine Learning
Brought to you by:
glandrum
|
From: Markus H. <mh...@ad...> - 2019-11-05 18:52:17
|
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 Wesbrook Mall, 4th Floor, Vancouver, BC V6T 1Z3
This email and any attachments thereto may contain confidential material for the sole use of the intended recipient. Any review, copying, or distribution of this email (or any attachments thereto) by others is strictly prohibited. If you are not the intended recipient, please contact the sender immediately and permanently delete the original and any copies of this email and any attachments thereto.
|