Created
April 22, 2016 16:05
-
-
Save andersx/863d6368eb0134652271f7fc845eb626 to your computer and use it in GitHub Desktop.
Python2 script to convert a smilesstring to a IUPAC name using Cinfony.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env python2 | |
| from sys import argv, exit | |
| from cinfony import webel, pybel | |
| if len(argv) != 2: | |
| print "Usage: smi2name <SMILES>" | |
| exit(1) | |
| smiles_string = argv[1] | |
| mol = pybel.readstring("smi", smiles_string) | |
| name = webel.Molecule(mol).write("iupac") | |
| if len(name) > 0: | |
| print name | |
| else: | |
| print "ERROR: couldn't parse name for SMILES:", smiles_string |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment