rdkit / rdkit

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

`AssignBondOrdersFromTemplate` does not copy bond stereochemistry information of terminal imine #6873

Open nielskm opened 8 months ago

nielskm commented 8 months ago

terminal-imine.pdb.txt

Assigning bond orders to the attached PDB with SMILES:[H]/N=C\CC(=O)N1CC[C@@H](C)[C@@H](N(C)c2ncnc3[nH]ccc23)C1 removes the stereochemistry of the C=N bond in the terminal imine group.

To Reproduce

from rdkit.Chem import AddHs, MolFromPDBFile, MolFromSmiles
from rdkit.Chem.rdmolfiles import MolToSmiles

smiles = "[H]/N=C\CC(=O)N1CC[C@@H](C)[C@@H](N(C)c2ncnc3[nH]ccc23)C1"
mol = MolFromPDBFile("terminal-imine.pdb", removeHs=False)
refmol = AddHs(MolFromSmiles(smiles))

result_mol = AssignBondOrdersFromTemplate(refmol, mol)

result_smiles = MolToSmiles(result_mol)

Expected behavior The result_smiles from the code above should have the stereochemistry information from the original SMILES.

Configuration (please complete the following information):

Additional context I need the stereochemistry information to be assigned in order to use the OpenFF Toolkit Molecule class (constructed with Molecule.from_rdkit). If I add b2.SetStereo(b.GetStereo()) to the AssignBondOrdersFromStereo function, this problem dissapears. But the SMILES produced by RDKit still lack the isomer information.

mattwthompson commented 2 weeks ago

Are you sure that SMILES fully defines the stereochemistry? OEChem thinks the nitrogen in the non-aromatic ring is a stereocenter

image


# problematic atom is ..................... *
smiles = "[H]/N=C\CC(=O)N1CC[C@@H](C)[C@@H](N(C)c2ncnc3[nH]ccc23)C1"