pybel |

`pybel - A Python module for accessing OpenBabel
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`

Modules
`` |  |
Image math | openbabel os | ImageTk tempfile | Tkinter

Classes
`` |  | __builtin__.object Atom Fingerprint Molecule MoleculeData Outputfile Smarts
class Atom(__builtin__.object)
`` | `Represent a Pybel atom. Required parameter: OBAtom -- an Open Babel OBAtom Attributes: atomicmass, atomicnum, cidx, coords, coordidx, exactmass, formalcharge, heavyvalence, heterovalence, hyb, idx, implicitvalence, isotope, partialcharge, spin, type, valence, vector. (refer to the Open Babel library documentation for more info). The original Open Babel atom can be accessed using the attribute: OBAtom`
| Methods defined here: __init__(self, OBAtom) __str__(self) Properties defined here: atomicmass get = atomicmass(self) atomicnum get = atomicnum(self) cidx get = cidx(self) coordidx get = coordidx(self) coords get = coords(self) exactmass get = exactmass(self) formalcharge get = formalcharge(self) heavyvalence get = heavyvalence(self) heterovalence get = heterovalence(self) hyb get = hyb(self) idx get = idx(self) implicitvalence get = implicitvalence(self) isotope get = isotope(self) partialcharge get = partialcharge(self) spin get = spin(self) type get = type(self) valence get = valence(self) vector get = vector(self) Data and other attributes defined here: __dict__ = <dictproxy object> `dictionary for instance variables (if defined)` __weakref__ = <attribute '__weakref__' of 'Atom' objects> `list of weak references to the object (if defined)`
class Fingerprint(__builtin__.object)
`` | `A Molecular Fingerprint. Required parameters: fingerprint -- a vector calculated by OBFingerprint.FindFingerprint() Attributes: fp -- the underlying fingerprint object bits -- a list of bits set in the Fingerprint Methods: The "|" operator can be used to calculate the Tanimoto coeff. For example, given two Fingerprints 'a', and 'b', the Tanimoto coefficient is given by: tanimoto = a | b`
| Methods defined here: __init__(self, fingerprint) __or__(self, other) __str__(self) Properties defined here: bits get = bits(self) Data and other attributes defined here: __dict__ = <dictproxy object> `dictionary for instance variables (if defined)` __weakref__ = <attribute '__weakref__' of 'Fingerprint' objects> `list of weak references to the object (if defined)`
class Molecule(__builtin__.object)
`` | `Represent a Pybel Molecule. Required parameter: OBMol -- an Open Babel OBMol or any type of cinfony Molecule Attributes: atoms, charge, conformers, data, dim, energy, exactmass, formula, molwt, spin, sssr, title, unitcell. (refer to the Open Babel library documentation for more info). Methods: addh(), calcfp(), calcdesc(), draw(), localopt(), make3D(), removeh(), write() The underlying Open Babel molecule can be accessed using the attribute: OBMol`
| Methods defined here: __init__(self, OBMol) __iter__(self) `Iterate over the Atoms of the Molecule. This allows constructions such as the following: for atom in mymol: print(atom)` __str__(self) addh(self) `Add hydrogens.` calcdesc(self, descnames=[]) `Calculate descriptor values. Optional parameter: descnames -- a list of names of descriptors If descnames is not specified, all available descriptors are calculated. See the descs variable for a list of available descriptors.` calcfp(self, fptype='FP2') `Calculate a molecular fingerprint. Optional parameters: fptype -- the fingerprint type (default is "FP2"). See the fps variable for a list of of available fingerprint types.` draw(self, show=True, filename=None, update=False, usecoords=False) `Create a 2D depiction of the molecule. Optional parameters: show -- display on screen (default is True) filename -- write to file (default is None) update -- update the coordinates of the atoms to those determined by the structure diagram generator (default is False) usecoords -- don't calculate 2D coordinates, just use the current coordinates (default is False) OASA is used for 2D coordinate generation and depiction. Tkinter and Python Imaging Library are required for image display.` localopt(self, forcefield='mmff94', steps=500) `Locally optimize the coordinates. Optional parameters: forcefield -- default is "mmff94". See the forcefields variable for a list of available forcefields. steps -- default is 500 If the molecule does not have any coordinates, make3D() is called before the optimization. Note that the molecule needs to have explicit hydrogens. If not, call addh().` make3D(self, forcefield='mmff94', steps=50) `Generate 3D coordinates. Optional parameters: forcefield -- default is "mmff94". See the forcefields variable for a list of available forcefields. steps -- default is 50 Once coordinates are generated, hydrogens are added and a quick local optimization is carried out with 50 steps and the MMFF94 forcefield. Call localopt() if you want to improve the coordinates further.` removeh(self) `Remove hydrogens.` write(self, format='smi', filename=None, overwrite=False) `Write the molecule to a file or return a string. Optional parameters: format -- see the informats variable for a list of available output formats (default is "smi") filename -- default is None overwite -- if the output file already exists, should it be overwritten? (default is False) If a filename is specified, the result is written to a file. Otherwise, a string is returned containing the result. To write multiple molecules to the same file you should use the Outputfile class.` Properties defined here: atoms get = atoms(self) charge get = charge(self) conformers get = conformers(self) data get = data(self) dim get = dim(self) energy get = energy(self) exactmass get = exactmass(self) formula get = formula(self) molwt get = molwt(self) spin get = spin(self) sssr get = sssr(self) title get = _gettitle(self) set = _settitle(self, val) unitcell get = unitcell(self) Data and other attributes defined here: __dict__ = <dictproxy object> `dictionary for instance variables (if defined)` __weakref__ = <attribute '__weakref__' of 'Molecule' objects> `list of weak references to the object (if defined)`
class MoleculeData(__builtin__.object)
`` | `Store molecule data in a dictionary-type object Required parameters: obmol -- an Open Babel OBMol Methods and accessor methods are like those of a dictionary except that the data is retrieved on-the-fly from the underlying OBMol. Example: >>> mol = readfile("sdf", 'head.sdf').next() >>> data = mol.data >>> print(data) {'Comment': 'CORINA 2.61 0041 25.10.2001', 'NSC': '1'} >>> print(len(data), data.keys(), data.has_key("NSC")) 2 ['Comment', 'NSC'] True >>> print(data['Comment']) CORINA 2.61 0041 25.10.2001 >>> data['Comment'] = 'This is a new comment' >>> for k,v in data.iteritems(): ... print(k, "-->", v) Comment --> This is a new comment NSC --> 1 >>> del data['NSC'] >>> print(len(data), data.keys(), data.has_key("NSC")) 1 ['Comment'] False`
| Methods defined here: __contains__(self, key) __delitem__(self, key) __getitem__(self, key) __init__(self, obmol) __iter__(self) __len__(self) __repr__(self) __setitem__(self, key, value) clear(self) has_key(self, key) items(self) iteritems(self) keys(self) update(self, dictionary) values(self) Data and other attributes defined here: __dict__ = <dictproxy object> `dictionary for instance variables (if defined)` __weakref__ = <attribute '__weakref__' of 'MoleculeData' objects> `list of weak references to the object (if defined)`
class Outputfile(__builtin__.object)
`` | `Represent a file to which *output* is to be sent. Although it's possible to write a single molecule to a file by calling the write() method of a molecule, if multiple molecules are to be written to the same file you should use the Outputfile class. Required parameters: format - see the outformats variable for a list of available output formats filename Optional parameters: overwrite -- if the output file already exists, should it be overwritten? (default is False) Methods: write(molecule) close()`
| Methods defined here: __init__(self, format, filename, overwrite=False) close(self) `Close the Outputfile to further writing.` write(self, molecule) `Write a molecule to the output file. Required parameters: molecule` Data and other attributes defined here: __dict__ = <dictproxy object> `dictionary for instance variables (if defined)` __weakref__ = <attribute '__weakref__' of 'Outputfile' objects> `list of weak references to the object (if defined)`
class Smarts(__builtin__.object)
`` | `A Smarts Pattern Matcher Required parameters: smartspattern Methods: findall(molecule) Example: >>> mol = readstring("smi","CCN(CC)CC") # triethylamine >>> smarts = Smarts("[#6][#6]") # Matches an ethyl group >>> print(smarts.findall(mol)) [(1, 2), (4, 5), (6, 7)] The numbers returned are the indices (starting from 1) of the atoms that match the SMARTS pattern. In this case, there are three matches for each of the three ethyl groups in the molecule.`
| Methods defined here: __init__(self, smartspattern) `Initialise with a SMARTS pattern.` findall(self, molecule) `Find all matches of the SMARTS pattern to a particular molecule. Required parameters: molecule` Data and other attributes defined here: __dict__ = <dictproxy object> `dictionary for instance variables (if defined)` __weakref__ = <attribute '__weakref__' of 'Smarts' objects> `list of weak references to the object (if defined)`

Functions
`` |  | readfile(format, filename) `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) `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`

Data
`` |  | descs = ['LogP', 'MR', 'TPSA'] forcefields = ['uff', 'mmff94', 'ghemical'] fps = ['FP2', 'FP3', 'FP4'] informats = {'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', 'c3d2': 'Chem3D Cartesian 2 format', 'caccrt': 'Cacao Cartesian format', ...} oasa = None operations = ['Gen3D'] outformats = {'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', 'caccrt': 'Cacao Cartesian format', 'cache': 'CAChe MolStruct format', ...}