Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bridgehead nitrogen stereo flipped on hydrogen removal #7342

Open
mcs07 opened this issue Apr 9, 2024 · 0 comments
Open

Bridgehead nitrogen stereo flipped on hydrogen removal #7342

mcs07 opened this issue Apr 9, 2024 · 0 comments
Labels

Comments

@mcs07
Copy link
Contributor

mcs07 commented Apr 9, 2024

Describe the bug

I noticed an interesting stereo-related issue when neutralizing a protonated atom, specifically when the atom continues to be a chiral center after the hydrogen is removed and the charge reduced.

To Reproduce

Taking quinine as an example molecule:

>>> from rdkit import Chem
>>>
>>> mol1 = Chem.MolFromSmiles("C=C[C@H]1C[N@@]2CC[C@H]1CC2[C@H](O)c1ccnc2ccc(OC)cc12")
>>> mol2 = Chem.MolFromSmiles("C=C[C@H]1C[N@@H+]2CC[C@H]1CC2[C@H]([O-])c1ccnc2ccc(OC)cc12")

mol1 is the neutral molecule and mol2 is a different protomer where the bridgehead nitrogen has a positive charge and an additional hydrogen. If we remove the hydrogen and reduce the formal charge, [N@@H+] has changed to [N@] in the resulting SMILES.

>>> mol2_n = mol2.GetAtomWithIdx(4)
>>> print(f"Element: {mol2_n.GetSymbol()} Charge: {mol2_n.GetFormalCharge():+} Hydrogens: {mol2_n.GetTotalNumHs()} ChiralTag: {mol2_n.GetChiralTag()}")
Element: N Charge: +1 Hydrogens: 1 ChiralTag: CHI_TETRAHEDRAL_CCW
>>> mol2_n.SetNumExplicitHs(0)
>>> mol2_n.SetNoImplicit(True)
>>> mol2_n.SetFormalCharge(0)
>>> Chem.SanitizeMol(mol2)
rdkit.Chem.rdmolops.SanitizeFlags.SANITIZE_NONE
>>> print(f"Element: {mol2_n.GetSymbol()} Charge: {mol2_n.GetFormalCharge():+} Hydrogens: {mol2_n.GetTotalNumHs()} ChiralTag: {mol2_n.GetChiralTag()}")
Element: N Charge: +0 Hydrogens: 0 ChiralTag: CHI_TETRAHEDRAL_CCW
>>> Chem.MolToSmiles(mol2)
'C=C[C@H]1C[N@]2CC[C@H]1CC2[C@H]([O-])c1ccnc2ccc(OC)cc12'

In this specific case, I know I can "fix" this by manually flipping CHI_TETRAHEDRAL_CCW to CHI_TETRAHEDRAL_CW, but I don't understand enough about how the CW/CCW accounting works for trivalent bridgehead nitrogens (for either the RDKit ChiralTag or the SMILES @/@@) to know if this is generally what should always be done.

>>> mol2_n.SetChiralTag(Chem.CHI_TETRAHEDRAL_CW)
>>> Chem.MolToSmiles(mol2)
'C=C[C@H]1C[N@@]2CC[C@H]1CC2[C@H]([O-])c1ccnc2ccc(OC)cc12'

I'm opening this as a bug report issue rather than a discussion because I think this situation may not be handled correctly internally to rdMolHash HetAtomTautomer/HetAtomProtomer and within the rdMolStandardize Uncharger:

>>> from rdkit.Chem import rdMolHash
>>> from rdkit.Chem.MolStandardize import rdMolStandardize
>>>
>>> rdMolHash.MolHash(mol1, rdMolHash.HashFunction.HetAtomTautomer)
'C=C[C@H]1C[N@@]2CC[C@H]1CC2[C@H]([O])[C]1[CH][CH][N][C]2[CH][CH][C](OC)[CH][C]21_1_0'
>>> rdMolHash.MolHash(mol2, rdMolHash.HashFunction.HetAtomTautomer)
'C=C[C@H]1C[N@]2CC[C@H]1CC2[C@H]([O])[C]1[CH][CH][N][C]2[CH][CH][C](OC)[CH][C]21_1_0'
>>>
>>> Chem.MolToSmiles(rdMolStandardize.Uncharger().uncharge(mol1))
'C=C[C@H]1C[N@@]2CC[C@H]1CC2[C@H](O)c1ccnc2ccc(OC)cc12'
>>> Chem.MolToSmiles(rdMolStandardize.Uncharger().uncharge(mol2))
'C=C[C@H]1C[N@]2CC[C@H]1CC2[C@H](O)c1ccnc2ccc(OC)cc12'

Expected behavior

rdMolHash and Uncharger should give the same output for mol1 and mol2.

Screenshots

Screenshot 2024-04-09 at 11 44 43 AM

Configuration (please complete the following information):

  • RDKit version: 2024.03.1
  • OS: Centos 7
  • Python version (if relevant): Python 3.10
  • Are you using conda? No
  • If you are not using conda: how did you install the RDKit? Source install
@mcs07 mcs07 added the bug label Apr 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant