Hi RDKit Community,

I've observed that hydrogens are not recognised as dummy atoms when trying to 
do substructure matching.


Is there a way to make them so? Ideally without adding explicitHs.


-----


smi = 'CCOCCOCCCO'
mol = Chem.MolFromSmiles(smi)

#with dummy atom
q1s = 'CCOCCOCCCO*'
q1m = Chem.MolFromSmiles(q1s)
q1 = Chem.AdjustQueryProperties(q1m)     # MolToSmarts gives 
[#6]-[#6]-[#8]-[#6]-[#6]-[#8]-[#6]-[#6]-[#6]-[#8]-*
mol.HasSubstructMatch(q1)
>FALSE

#without dummy atom
q2s = 'CCOCCOCCCO'
q2m = Chem.MolFromSmiles(q2s)
q2 = Chem.AdjustQueryProperties(q2m)    # MolToSmarts gives 
[#6]-[#6]-[#8]-[#6]-[#6]-[#8]-[#6]-[#6]-[#6]-[#8]
mol.HasSubstructMatch(q2)
>TRUE



Thanks!
Adelene




Doctoral Researcher
Environmental Cheminformatics
UNIVERSITÉ DU LUXEMBOURG

Campus Belval | Luxembourg Centre for Systems Biomedicine
6, avenue du Swing, L-4367 Belvaux
T +356 46 66 44 67 18
https://adelenel.ai









_______________________________________________
Rdkit-discuss mailing list
Rdkit-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/rdkit-discuss

Reply via email to