コマンドライン上で
$ pip install -i https://pypi.anaconda.org/OpenEye/simple OpenEye-toolkits
$ oecheminfo.py
from openeye.oechem import *
mol = OEGraphMol()
OESmilesToMol(mol, "c1ccccc1")
True
if OESmilesToMol(mol, "c1ccccc1"):
# do something interesting with mol
pass
else:
print ("SMILES string was invalid!")
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()))
Number of aromatic atoms = 0 Number of aromatic atoms = 6
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())
Number of benzene atoms: 6 Number of phenol atoms: 7
from __future__ import print_function
from openeye.oechem import *
mol = OEGraphMol()
OESmilesToMol(mol, "C1=CC=CC=C1")
print ("Canonical isomeric SMILES is", OEMolToSmiles(mol))
Canonical isomeric SMILES is c1ccccc1
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)
from __future__ import print_function
from openeye.oechem import *
mol = OEGraphMol()
OESmilesToMol(mol, "c1ccnc(c1)O")
print (OECreateInChI(mol))
InChI=1S/C5H5NO/c7-5-3-1-2-4-6-5/h1-4H,(H,6,7)