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

DrawMorganBit errors when useSVG is False #3796

Closed
ncfirth opened this issue Feb 10, 2021 · 2 comments
Closed

DrawMorganBit errors when useSVG is False #3796

ncfirth opened this issue Feb 10, 2021 · 2 comments
Labels
Milestone

Comments

@ncfirth
Copy link

ncfirth commented Feb 10, 2021

I had a check and couldn't see any that matched this, but very sorry if it is a duplicate. I'm seeing an error that only pops up when I use useSVG=False in Chem.Draw.DrawMorganBit.

from rdkit import Chem
from rdkit.Chem import rdMolDescriptors

mol = Chem.MolFromSmiles('COC(COc1cncc2nnc(-c3ccc(C#N)cc3)n12)c1ccc(F)c(F)c1')

bi = {}
fp = rdMolDescriptors.GetMorganFingerprintAsBitVect(
    mol, 
    radius=2, 
    bitInfo=bi, 
    nBits=128
)
Chem.Draw.DrawMorganBit(mol, 107, bi, useSVG=True)

Output

Chem.Draw.DrawMorganBit(mol, 107, bi, useSVG=False)
RDKit ERROR: [11:00:26] non-ring atom 1 marked aromatic
---------------------------------------------------------------------------
AtomKekulizeException                     Traceback (most recent call last)
<ipython-input-3-1c8e096ed296> in <module>
----> 1 Chem.Draw.DrawMorganBit(mol, 107, bi, useSVG=False)

~/anaconda3/envs/chem/lib/python3.7/site-packages/rdkit/Chem/Draw/IPythonConsole.py in DrawMorganBit(mol, bitId, bitInfo, drawOptions, **kwargs)
    239   else:
    240     fn = Draw.DrawMorganBit
--> 241   return _DrawBit(fn, mol, bitId, bitInfo, drawOptions=drawOptions, **kwargs)
    242 
    243 

~/anaconda3/envs/chem/lib/python3.7/site-packages/rdkit/Chem/Draw/IPythonConsole.py in _DrawBit(fn, *args, **kwargs)
    211   if 'useSVG' not in kwargs:
    212     kwargs['useSVG'] = ipython_useSVG
--> 213   res = fn(*args, **kwargs)
    214   if kwargs['useSVG']:
    215     return SVG(res)

~/anaconda3/envs/chem/lib/python3.7/site-packages/rdkit/Chem/Draw/__init__.py in DrawMorganBit(mol, bitId, bitInfo, whichExample, **kwargs)
    659 def DrawMorganBit(mol, bitId, bitInfo, whichExample=0, **kwargs):
    660   atomId, radius = bitInfo[bitId][whichExample]
--> 661   return DrawMorganEnv(mol, atomId, radius, **kwargs)
    662 
    663 

~/anaconda3/envs/chem/lib/python3.7/site-packages/rdkit/Chem/Draw/__init__.py in DrawMorganEnv(mol, atomId, radius, molSize, baseRad, useSVG, aromaticColor, ringColor, centerColor, extraColor, drawOptions, **kwargs)
    825                       highlightAtomColors=menv.atomColors, highlightBonds=menv.highlightBonds,
    826                       highlightBondColors=menv.bondColors, highlightAtomRadii=menv.highlightRadii,
--> 827                       **kwargs)
    828   drawer.FinishDrawing()
    829   return drawer.GetDrawingText()

AtomKekulizeException: non-ring atom 1 marked aromatic
  • RDKit version: 2020.09.1
  • OS: Ubuntu 20.04.1 LTS
  • Python version: 3.7.9
  • Are you using conda? yes
  • If you are using conda, which channel did you install the rdkit from? rdkit
@ncfirth ncfirth added the bug label Feb 10, 2021
@greglandrum
Copy link
Member

This is almost certainly connected with #3543, so if you update to 2020.09.3 or newer it should go away.
I'm going to leave this open though, because we shouldn't even be trying to save PNG metadata in cases like this.

@greglandrum greglandrum added this to the 2020_09_5 milestone Feb 19, 2021
greglandrum added a commit to greglandrum/rdkit that referenced this issue Feb 19, 2021
greglandrum added a commit that referenced this issue Mar 1, 2021
* Fixes #3796

* skip new test when cairo is not installed
@LiuCMU
Copy link

LiuCMU commented Dec 1, 2022

I see that you used rdMolDescriptors.GetMorganFingerprintAsBitVect. Is this the same as AllChem.GetMorganFingerprintAsBitVect? Thanks!

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

3 participants