rdkit / rdkit

The official sources for the RDKit library
BSD 3-Clause "New" or "Revised" License
2.52k stars 852 forks source link

RDKit drops hydrogens in or queries if one of the atoms is a dummy atom #6117

Open bp-kelley opened 1 year ago

bp-kelley commented 1 year ago
>>> smarts = "[*,#1]"
>>> pat = Chem.MolFromSmarts(smarts)
>>> Chem.MolToSmarts(pat)
'*'

This causes issues in hydrogen suppressed graphs (which is the default).

bp-kelley commented 1 year ago

Well, issue might be too strong a word, it causes a problem when trying to fix queries for hydrogen suppressed graphs since mergeQueryHs doesn't complain about merging hydrogens in ors. The query is correct for graphs with unsupressed hydrogens.

HalflingHelper commented 1 year ago

@bp-kelley Do you expect to just return [*,#1] from Chem.MolToSmarts(pat) then?

Alternatively is there a way to fix Hydrogen suppressed graphs such that returning * is ok?