code:
import numpy as np
from rdkit import Chem
from rdkit.Chem import Draw, AllChem, PandasTools, DataStructs
mol = Chem.MolFromSmiles('O=C1N([C@@H](C)C2CC2)CC3=CC(C4=C(C)N=C(NC(C)=O)S4)=CC(S(=O)(C)=O)=C31')
bi = {}
fp = AllChem.GetMorganFingerprintAsBitVect(mol, radius=3, bitInfo=bi)
fp_arr = np.zeros(1,)
DataStructs.ConvertToNumpyArray(fp, fp_arr)
fp_arr = np.nonzero(fp_arr)[0]
for ar in fp_arr:
img = Draw.DrawMorganBit(mol, ar, bi, useSVG=True)
img.save("submol.png")
I want to create an image using DrawMorganBit to know how Molecule's fingerprint bit was generated. (Using PyCharm instead of Jupyter Notebook) However, two problems have arisen: the kekulize problem and the image storage problem. I dont know what's causing the kekulize problem and how to save DrawMorganBit image
rdkit version 2022.3.4
Error
kekulize problem:
rdkit.Chem.rdchem.KekulizeException: Can't kekulize mol. Unkekulized atoms: 5 6 8 9 14
save problem:
AttributeError: 'str' object has no attribute 'save'