From PyMOLWiki
Jump to navigation Jump to search


Python programmers, who wish to extract information from O files, may find the OdbParser module useful. The module reads both binary and formatted O files, and is very simple to use. Try it! Simply import the module, and use the get() method:

$ python
Python 2.3.4 (#1, Mar 10 2006, 06:12:09)
[GCC 3.4.5 20051201 (Red Hat 3.4.5-2)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
 >>> import odbparser
 >>> db = odbparser.get("binary.o")

Now you have the O database as a Python dictionary 'db', with the datablock names as keys. For example, print out some information on the di-peptide from Baton:

 >>> print db["di_atom_name"]
('N', 'CA', 'C', 'O', 'CB', 'N', 'CA', 'C', 'O', 'CB')
 >>> print x["di_residue_type"]
('ALA', 'ALA')

Go to OdbParser for information about download, installation, etc.