Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Converts a SMILES string to a 2D picture
import sys
sys.path.append("/usr/local/lib/python2.7/site-packages/")
from rdkit import Chem
from rdkit.Chem import AllChem
from rdkit.Chem import Draw
from rdkit.sping import PIL
filename = sys.argv[1]
file = open(filename, "r+")
for line in file:
words = line.split()
name = words[0]
smiles = words[1]
m = Chem.MolFromSmiles(smiles)
Draw.MolToFile(m,name+".png")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment