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

prepareMolForDrawing() incorrectly adds chiral Hs if no ring info is present #3392

Closed
greglandrum opened this issue Sep 3, 2020 · 0 comments
Labels
Milestone

Comments

@greglandrum
Copy link
Member

greglandrum commented Sep 3, 2020

Configuration:

  • RDKit Version: all

Description:

In [11]: m = Chem.MolFromSmiles('C[C@H](F)Cl')

In [12]: Draw.PrepareMolForDrawing(m).Debug()
Atoms:
	0 6 C chg: 0  deg: 1 exp: 1 imp: 3 hyb: 4 arom?: 0 chi: 0
	1 6 C chg: 0  deg: 3 exp: 4 imp: 0 hyb: 4 arom?: 0 chi: 2
	2 9 F chg: 0  deg: 1 exp: 1 imp: 0 hyb: 4 arom?: 0 chi: 0
	3 17 Cl chg: 0  deg: 1 exp: 1 imp: 0 hyb: 4 arom?: 0 chi: 0
Bonds:
	0 1->0 order: 1 dir: 1 conj?: 0 aromatic?: 0
	1 1->2 order: 1 conj?: 0 aromatic?: 0
	2 1->3 order: 1 conj?: 0 aromatic?: 0

In [13]: m2 = Chem.MolFromSmiles('C[C@H](F)Cl',sanitize=False)

In [14]: m2.UpdatePropertyCache()

In [15]: Draw.PrepareMolForDrawing(m2).Debug()
Atoms:
	0 6 C chg: 0  deg: 1 exp: 1 imp: 3 hyb: 0 arom?: 0 chi: 0
	1 6 C chg: 0  deg: 4 exp: 4 imp: 0 hyb: 0 arom?: 0 chi: 2
	2 9 F chg: 0  deg: 1 exp: 1 imp: 0 hyb: 0 arom?: 0 chi: 0
	3 17 Cl chg: 0  deg: 1 exp: 1 imp: 0 hyb: 0 arom?: 0 chi: 0
	4 1 H chg: 0  deg: 1 exp: 1 imp: 0 hyb: 0 arom?: 0 chi: 0
Bonds:
	0 0->1 order: 1 conj?: 0 aromatic?: 0
	1 1->2 order: 1 conj?: 0 aromatic?: 0
	2 1->3 order: 1 conj?: 0 aromatic?: 0
	3 1->4 order: 1 dir: 1 conj?: 0 aromatic?: 0

In [16]: 

This is due to the messed up logic in this line of code:
https://github.com/rdkit/rdkit/blob/master/Code/GraphMol/MolDraw2D/MolDraw2DUtils.cpp#L36

@greglandrum greglandrum added the bug label Sep 3, 2020
@greglandrum greglandrum added this to the 2020_03_6 milestone Sep 3, 2020
greglandrum added a commit to greglandrum/rdkit that referenced this issue Sep 3, 2020
a bit of code modernization too
greglandrum added a commit that referenced this issue Sep 19, 2020
a bit of code modernization too
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