#!/usr/bin/env python # coding: utf-8 # コマンドライン上で # # $ pip install -i https://pypi.anaconda.org/OpenEye/simple OpenEye-toolkits # # $ oecheminfo.py # In[1]: from openeye.oechem import * # In[4]: mol = OEGraphMol() # In[5]: OESmilesToMol(mol, "c1ccccc1") # In[8]: if OESmilesToMol(mol, "c1ccccc1"): # do something interesting with mol pass else: print ("SMILES string was invalid!") # In[9]: from __future__ import print_function from openeye.oechem import * mol = OEGraphMol() if not OEParseSmiles(mol, "C1=CC=CC=C1"): print ("SMILES string was invalid!") print("Number of aromatic atoms =", OECount(mol, OEIsAromaticAtom())) OEAssignAromaticFlags(mol) print("Number of aromatic atoms =", OECount(mol, OEIsAromaticAtom())) # In[10]: from __future__ import print_function from openeye.oechem import * mol = OEGraphMol() OESmilesToMol(mol, "c1ccccc1") print ("Number of benzene atoms:", mol.NumAtoms()) OESmilesToMol(mol, "c1ccccc1O") print ("Number of phenol atoms:", mol.NumAtoms()) # In[11]: from __future__ import print_function from openeye.oechem import * mol = OEGraphMol() OESmilesToMol(mol, "C1=CC=CC=C1") print ("Canonical isomeric SMILES is", OEMolToSmiles(mol)) # In[12]: from __future__ import print_function from openeye.oechem import * import sys for smi in sys.stdin: mol = OEGraphMol() smi = smi.strip() if OESmilesToMol(mol, smi): print (OEMolToSmiles(mol)) else: OEThrow.Warning("%s is an invalid SMILES!" % smi) # In[13]: from __future__ import print_function from openeye.oechem import * mol = OEGraphMol() OESmilesToMol(mol, "c1ccnc(c1)O") print (OECreateInChI(mol)) # In[ ]: