CIRpy icon indicating copy to clipboard operation
CIRpy copied to clipboard

Suggestion of code sample: get SMILES of list of molecules

Open Glxblt76 opened this issue 5 years ago • 0 comments

Dear CIRpy developers, I would like to give you a code sample that could be useful for many people and could be provided in some form in the basic documentation (or even integrated as a function). This simple code gets a list of molecule names in a text file and outputs their SMILES in the command prompt.

#!/usr/bin/python
# -*- coding: Latin-1 -*-
# ----- Get SMILES from list of names -----
# 

import cirpy

with open("names.txt") as file:
    data = file.readlines()
    for molecule in data:
        name   = molecule.rstrip("\n\r")
        SMILES = cirpy.resolve(name, 'smiles')
        print name, SMILES

Glxblt76 avatar May 31 '19 04:05 Glxblt76