You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
When depicting a molecule with a data substance group, the substance group label will sometimes overlap with an atom/atom label.
To Reproduce
Read a molblock with a data substance group:
from rdkit import Chem
from rdkit.Chem.Draw import IPythonConsole
from rdkit.Chem import Draw
IPythonConsole.ipython_useSVG=True
IPythonConsole.molSize = 400,400
mol = Chem.MolFromMolBlock("""
Mrv2114 09132120172D
0 0 0 0 0 999 V3000
M V30 BEGIN CTAB
M V30 COUNTS 8 8 1 0 1
M V30 BEGIN ATOM
M V30 1 C -0.5878 0.8085 0 0
M V30 2 C -1.9434 0.078 0 0
M V30 3 C -1.9884 -1.4614 0 0
M V30 4 C -0.6778 -2.2702 0 0
M V30 5 C 0.6778 -1.5394 0 0
M V30 6 C 0.7228 -0.0001 0 0
M V30 7 N -0.5428 2.3478 0 0
M V30 8 O 1.9884 -2.3479 0 0
M V30 END ATOM
M V30 BEGIN BOND
M V30 1 2 1 2
M V30 2 1 2 3
M V30 3 2 3 4
M V30 4 1 4 5
M V30 5 2 5 6
M V30 6 1 6 1
M V30 7 1 1 7
M V30 8 1 5 8
M V30 END BOND
M V30 BEGIN SGROUP
M V30 1 DAT 0 ATOMS=(1 7) FIELDNAME=UV FIELDINFO=nm -
M V30 FIELDDISP=" 0.0000 0.0000 DRU ALL 0 0" -
M V30 MRV_FIELDDISP=0 FIELDDATA=340
M V30 END SGROUP
M V30 END CTAB
M END
""")
mol
Result:
A similar issue occurs when reading from cxsmiles -- here are a few examples:
Expected behavior
The substance group labels should not overlap with atoms. Here is an example of what that could look like:
Additional context
I believe this issue is happening because the location of the sgroup label relative to an atom in the sgroup is determined by the FIELDDISP property (see here), which is often looks something like 0.0000 0.0000 DR ALL 0 0 if the molecule was generated by CXSmiles or an sdf exported from marvin. If that property is removed (which I think can't be done in python), RDKit will default to calculating the placement of the label and we will get something like the images above.
Configuration (please complete the following information):
RDKit version: 2021_09
OS: MacOS Big Sur 11.5
Are you using conda? No
The text was updated successfully, but these errors were encountered:
Describe the bug
When depicting a molecule with a data substance group, the substance group label will sometimes overlap with an atom/atom label.
To Reproduce
Read a molblock with a data substance group:
Result:
A similar issue occurs when reading from cxsmiles -- here are a few examples:
Expected behavior
The substance group labels should not overlap with atoms. Here is an example of what that could look like:
Additional context
I believe this issue is happening because the location of the sgroup label relative to an atom in the sgroup is determined by the FIELDDISP property (see here), which is often looks something like
0.0000 0.0000 DR ALL 0 0
if the molecule was generated by CXSmiles or an sdf exported from marvin. If that property is removed (which I think can't be done in python), RDKit will default to calculating the placement of the label and we will get something like the images above.Configuration (please complete the following information):
The text was updated successfully, but these errors were encountered: