Package cinfony :: Module pybel
[frames] | no frames]

Module pybel

source code


pybel - A Cinfony module for accessing OpenBabel from CPython

Global variables:
  ob - the underlying SWIG bindings for OpenBabel
  informats - a dictionary of supported input formats
  outformats - a dictionary of supported output formats
  descs - a list of supported descriptors
  fps - a list of supported fingerprint types
  forcefields - a list of supported forcefields

Classes
  Outputfile
Represent a file to which *output* is to be sent.
  Molecule
Represent a Pybel Molecule.
  Atom
Represent a Pybel atom.
  Fingerprint
A Molecular Fingerprint.
  Smarts
A Smarts Pattern Matcher
  MoleculeData
Store molecule data in a dictionary-type object
Functions
 
readfile(format, filename)
Iterate over the molecules in a file.
source code
 
readstring(format, string)
Read in a molecule from a string.
source code
Variables
  informats = {'acr': 'ACR format', 'adfout': 'ADF output format...
A dictionary of supported input formats
  outformats = {'adf': 'ADF cartesian input format', 'alc': 'Alc...
A dictionary of supported output formats
  descs = ['LogP', 'MR', 'TPSA']
A list of supported descriptors
  fps = ['FP2', 'FP3', 'FP4']
A list of supported fingerprint types
  forcefields = ['uff', 'mmff94', 'ghemical']
A list of supported forcefields
  operations = ['Gen3D']
A list of supported operations
Function Details

readfile(format, filename)

source code 
Iterate over the molecules in a file.

Required parameters:
   format - see the informats variable for a list of available
            input formats
   filename

You can access the first molecule in a file using the next() method
of the iterator:
    mol = readfile("smi", "myfile.smi").next()
    
You can make a list of the molecules in a file using:
    mols = list(readfile("smi", "myfile.smi"))
    
You can iterate over the molecules in a file as shown in the
following code snippet:
>>> atomtotal = 0
>>> for mol in readfile("sdf", "head.sdf"):
...     atomtotal += len(mol.atoms)
...
>>> print atomtotal
43

readstring(format, string)

source code 
Read in a molecule from a string.

Required parameters:
   format - see the informats variable for a list of available
            input formats
   string

Example:
>>> input = "C1=CC=CS1"
>>> mymol = readstring("smi", input)
>>> len(mymol.atoms)
5


Variables Details

informats

A dictionary of supported input formats

Value:
{'acr': 'ACR format',
 'adfout': 'ADF output format',
 'alc': 'Alchemy format',
 'arc': 'Accelrys/MSI Biosym/Insight II CAR format',
 'bgf': 'MSI BGF format',
 'box': 'Dock 3.5 Box format',
 'bs': 'Ball and Stick format',
 'c3d1': 'Chem3D Cartesian 1 format',
...

outformats

A dictionary of supported output formats

Value:
{'adf': 'ADF cartesian input format',
 'alc': 'Alchemy format',
 'bgf': 'MSI BGF format',
 'box': 'Dock 3.5 Box format',
 'bs': 'Ball and Stick format',
 'c3d1': 'Chem3D Cartesian 1 format',
 'c3d2': 'Chem3D Cartesian 2 format',
 'cac': 'CAChe MolStruct format',
...