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

Module pybel

source code


pybel - A Cinfony module for accessing Open Babel

Global variables:
  ob - the underlying SWIG bindings for Open Babel
  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, opt=None)
Iterate over the molecules in a file.
source code
 
readstring(format, string, opt=None)
Read in a molecule from a string.
source code
Variables
  informats = {'CONFIG': 'DL-POLY CONFIG', 'CONTCAR': 'VASP form...
A dictionary of supported input formats
  outformats = {'CONFIG': 'DL-POLY CONFIG', 'CONTCAR': 'VASP for...
A dictionary of supported output formats
  descs = ['abonds', 'atoms', 'bonds', 'cansmi', 'cansmiNS', 'db...
A list of supported descriptors
  fps = ['fp2', 'fp3', 'fp4', 'maccs']
A list of supported fingerprint types
  forcefields = ['gaff', 'ghemical', 'mmff94', 'mmff94s', 'uff']
A list of supported forcefields
  operations = ['0xout', 'addfilename', 'AddInIndex', 'AddPolarH...
A list of supported operations
  __package__ = 'cinfony'
Function Details

readfile(format, filename, opt=None)

source code 
Iterate over the molecules in a file.

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

Optional parameters:
   opt    - a dictionary of format-specific options
            For format options with no parameters, specify the
            value as None.

You can access the first molecule in a file using the next() method
of the iterator (or the next() keyword in Python 3):
    mol = readfile("smi", "myfile.smi").next() # Python 2
    mol = next(readfile("smi", "myfile.smi"))  # Python 3

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, opt=None)

source code 
Read in a molecule from a string.

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

Optional parameters:
   opt    - a dictionary of format-specific options
            For format options with no parameters, specify the
            value as None.

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


Variables Details

informats

A dictionary of supported input formats

Value:
{'CONFIG': 'DL-POLY CONFIG',
 'CONTCAR': 'VASP format',
 'HISTORY': 'DL-POLY HISTORY',
 'POSCAR': 'VASP format',
 'VASP': 'VASP format',
 'abinit': 'ABINIT Output Format',
 'acesout': 'ACES output format',
 'acr': 'ACR format',
...

outformats

A dictionary of supported output formats

Value:
{'CONFIG': 'DL-POLY CONFIG',
 'CONTCAR': 'VASP format',
 'POSCAR': 'VASP format',
 'VASP': 'VASP format',
 'acesin': 'ACES input format',
 'adf': 'ADF cartesian input format',
 'alc': 'Alchemy format',
 'ascii': 'ASCII format',
...

descs

A list of supported descriptors

Value:
['abonds',
 'atoms',
 'bonds',
 'cansmi',
 'cansmiNS',
 'dbonds',
 'formula',
 'HBA1',
...

operations

A list of supported operations

Value:
['0xout',
 'addfilename',
 'AddInIndex',
 'AddPolarH',
 'align',
 'canonical',
 'conformer',
 'energy',
...