comparison rpviz/smile2picture.py @ 16:fe78fd6b315a draft

planemo upload commit 87db86a34f2d92eb2c9756bf9ee53ae2970554d5
author pablocarb
date Tue, 11 Jun 2019 11:42:40 -0400
parents
children
comparison
equal deleted inserted replaced
15:785b6253af1f 16:fe78fd6b315a
1 # -*- coding: utf-8 -*-
2 """
3 Created on Fri May 31 13:29:59 2019
4
5 @author: anael
6 """
7
8 from __future__ import print_function
9 from rdkit import Chem
10 from rdkit.Chem import rdDepictor
11 from rdkit.Chem.Draw import rdMolDraw2D
12
13
14 def picture(smile):
15 image={}
16 for i in smile :
17 mol = Chem.MolFromSmiles(smile[i])
18 rdDepictor.Compute2DCoords(mol)
19 drawer = rdMolDraw2D.MolDraw2DSVG(200,200)
20 drawer.DrawMolecule(mol)
21 drawer.FinishDrawing()
22 svg = drawer.GetDrawingText()
23 image[i]=svg.split("?>\n")[1]
24 return(image)
25
26