[Feature] Changes required for non public tenants (#370)

Co-authored-by: Tim Lorsbach <tim@lorsba.ch>
Reviewed-on: enviPath/enviPy#370
This commit is contained in:
2026-04-22 06:08:39 +12:00
parent b508511cd6
commit 8498e59fa1
13 changed files with 249 additions and 88 deletions

View File

@ -88,6 +88,10 @@ class FormatConverter(object):
def from_smiles(smiles):
return Chem.MolFromSmiles(smiles)
@staticmethod
def from_molfile(molfile: str):
return Chem.MolFromMolBlock(molfile)
@staticmethod
def to_smiles(mol, canonical=False):
return Chem.MolToSmiles(mol, canonical=canonical)
@ -171,12 +175,17 @@ 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):