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

The serialization of porphyrin to mol format introduces some double bonds with bond stereo 3/either #7306

Open
rvianello opened this issue Mar 27, 2024 · 1 comment
Assignees
Labels
Milestone

Comments

@rvianello
Copy link
Contributor

Describe the bug
Loading a structure containing a porphyrin into an RDKit molecule instance and rewriting it to mol format introduces some double bonds with bond stereo 3/either

To Reproduce

In [1]: from rdkit import Chem

In [2]: print(Chem.MolToMolBlock(Chem.MolFromMolFile('./input.mol')))

input.zip

Configuration (please complete the following information):

  • RDKit version: current tip of the master branch (I presume the issue may also affect the 2024.03.1 beta)
  • OS: Fedora 39
  • If you are not using conda: how did you install the RDKit? from source code
@rvianello rvianello added the bug label Mar 27, 2024
@greglandrum
Copy link
Member

greglandrum commented Jun 7, 2024

Here's what's happening:
The ring bonds are all aromatic, so the fact that the stereochemistry is known is not used and they are unspecified.
The molecule is kekulized before writing it to a mol block and the writer then happily marks each of the new double bonds that are in the larger ring as unknown.

The solution is to modify the mol block writer to keep track of which bonds were originally aromatic and not write stereo tags for them. It's an easy fix.

@greglandrum greglandrum self-assigned this Jun 7, 2024
@greglandrum greglandrum added this to the 2024_03_4 milestone Jun 7, 2024
greglandrum added a commit to greglandrum/rdkit that referenced this issue Jun 9, 2024
Do not cross bonds which were previously aromatic
rvianello added a commit to rvianello/rdkit that referenced this issue Jun 17, 2024
commit 295eb87
Merge: 7e1f881 d6171aa
Author: Riccardo Vianello <riccardo.vianello@gmail.com>
Date:   Mon Jun 17 00:33:21 2024 +0200

    Merge branch 'master' into fix/github7306

commit 7e1f881
Author: greg landrum <greg.landrum@gmail.com>
Date:   Sun Jun 9 07:21:07 2024 +0200

    revert one of the test changes

commit ddb982b
Author: greg landrum <greg.landrum@gmail.com>
Date:   Sun Jun 9 05:52:45 2024 +0200

    Fixes rdkit#7306

    Do not cross bonds which were previously aromatic
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

2 participants