This commit is contained in:
Tim Lorsbach
2026-04-15 12:23:29 +02:00
parent dd0f7eaf05
commit 349877b5e3
6 changed files with 90 additions and 15 deletions

View File

@ -171,12 +171,19 @@ class FormatConverter(object):
try:
Chem.Kekulize(mol)
except Exception:
mc = Chem.Mol(mol.ToBinary())
mol = Chem.Mol(mol.ToBinary())
if not mc.GetNumConformers():
Chem.rdDepictor.Compute2DCoords(mc)
if not mol.GetNumConformers():
Chem.rdDepictor.Compute2DCoords(mol)
pass
drawer = rdMolDraw2D.MolDraw2DCairo(*mol_size)
opts = drawer.drawOptions()
opts.clearBackground = False
drawer.DrawMolecule(mol)
drawer.FinishDrawing()
return drawer.GetDrawingText()
@staticmethod
def normalize(smiles):