Skip to content

Suggestion of code sample: get SMILES of list of molecules #6

Description

@Glxblt76

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

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions