Python-Ref > Cheminformatics > OASA > Interfacing with OpenBabel
 
 

<-^^->
Klíčová slova
Moduly
Knihovní funkce

Interfacing with OpenBabel

How to convert pybel objects to OASA and back.
Expand/Shrink
Zdroj: (oasa2-1.py)
  1   from oasa import pybel_bridge
  2   
  3   mols = pybel_bridge.PybelConverter.read_text( "smi", "ClCCCCl")
  4   print mols
  5   mol = mols[0]
  6   print mol
stdout:
[<oasa.molecule.molecule object at 0xb40950>]
molecule, 5 atoms, 4 bonds
Doba běhu: 127.6 ms
Expand/Shrink
Zdroj: (oasa2-2.py)
  1   from oasa import pybel_bridge
  2   import pybel
  3   
  4   pybel_mol = pybel.readstring( "smi", "ClCCCCl")
  5   print pybel_mol, repr( pybel_mol)
  6   
  7   oasa_mol = pybel_bridge.PybelConverter.pybel_to_oasa_molecule( pybel_mol)
  8   print oasa_mol, repr( oasa_mol)
  9   
 10   pybel_mol2 = pybel_bridge.PybelConverter.oasa_to_pybel_molecule( oasa_mol)
 11   print pybel_mol2, repr( pybel_mol2)
stdout:
ClCCCCl	
 <pybel.Molecule object at 0xc80910>
molecule, 5 atoms, 4 bonds <oasa.molecule.molecule object at 0xa20c10>
ClCCCCl	
 <pybel.Molecule object at 0xc80bd0>
Doba běhu: 140.6 ms