Skip to content

Commit

Permalink
Update visualisation of molecules to 2D
Browse files Browse the repository at this point in the history
  • Loading branch information
Julicancode authored Jul 9, 2024
1 parent 193a55d commit 1344e49
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/konnektor/visualization/widget.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,13 @@ def get_node_connectivities(cg: LigandNetwork) -> list[int]:

# some code borrowed from pen:
# https://iwatobipen.wordpress.com/2020/03/30/draw-scaffold-tree-as-network-with-molecular-image-rdkit-cytoscape/
def mol2svg(mol: Chem.Mol) -> str:
def mol2svg(mol: Chem.Mol, twoD=True) -> str:
try:
Chem.rdmolops.Kekulize(mol)
except:
pass
if twoD:
Chem.rdDepictor.Compute2DCoords(mol)
drawer = rdMolDraw2D.MolDraw2DSVG(350, 300)
rdMolDraw2D.PrepareAndDrawMolecule(drawer,
mol) # , legend=mol.GetProp("_Name"))
Expand Down

0 comments on commit 1344e49

Please sign in to comment.