Mercurial > repos > pablocarb > synbiodesign
diff rpviz/smile2picture.py @ 16:fe78fd6b315a draft
planemo upload commit 87db86a34f2d92eb2c9756bf9ee53ae2970554d5
author | pablocarb |
---|---|
date | Tue, 11 Jun 2019 11:42:40 -0400 |
parents | |
children |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/rpviz/smile2picture.py Tue Jun 11 11:42:40 2019 -0400 @@ -0,0 +1,26 @@ +# -*- coding: utf-8 -*- +""" +Created on Fri May 31 13:29:59 2019 + +@author: anael +""" + +from __future__ import print_function +from rdkit import Chem +from rdkit.Chem import rdDepictor +from rdkit.Chem.Draw import rdMolDraw2D + + +def picture(smile): + image={} + for i in smile : + mol = Chem.MolFromSmiles(smile[i]) + rdDepictor.Compute2DCoords(mol) + drawer = rdMolDraw2D.MolDraw2DSVG(200,200) + drawer.DrawMolecule(mol) + drawer.FinishDrawing() + svg = drawer.GetDrawingText() + image[i]=svg.split("?>\n")[1] + return(image) + +