io Package

io Package

This package is supposed to contain routines for manipulating data in external files. Currently only PDB files are supproted.

For better support for various biotechnological file formats consider using biopython library. Biopython may be obtained at http://biopython.org .

pdb Module

This module is an attempt to grant very basic access to PDB files containing MD trajectories. Currently it provides one function: readnext(), which returns next line as a tokenized tuple of values, depending on the type of the PDB record.

Currently supported tokens: “MODEL”, “ATOM”, “CRYST1”, “ENDMDL”, “TER”

If token is not supported then function returns tuple with two values. First is token and the second is string “NOT SUPPORTED YET”

This module will be eventually expanded in the future.

class pydmga.io.pdb.PDBRecord(tuple)

simple class to represent PDB entry

it is created on the basic of some tuple, so the simplest way is to pass to it readnext() result

as_ball()

if this entry has coordinates and radius then it returns tuple (x,y,z,r), if not then None

as_coords()

if this entry has coordinates then it returns tuple (x,y,z), if not then None

as_particle()

if this entry has coordinates then it returns tuple (id,x,y,z,r), if not then None

type()

returns type of the record, i.e. the first column in PDB file

pydmga.io.pdb.readnext(file, accept_tokens=['MODEL', 'ATOM', 'CRYST1', 'ENDMDL', 'TER'])

it can read normally formatted PDB (that is, the ones compliant with the docs (e.g. http://deposit.rcsb.org/adit/docs/pdb_atom_format.html)

Parameters:
  • file – file to read from
  • accept_tokens – tells which tokens to parse and return, other tokens will be omitted automatically, default = [“MODEL”, “ATOM”, “CRYST1”, “ENDMDL”, “TER”]
Returns:

tuple representing given token

Exception :

StopIteration when EOF approached

Warning :

Currently supported tokens: “MODEL”, “ATOM”, “CRYST1”, “ENDMDL”, “TER”

Warning :

If token is not supported then function returns tuple with two values. First is token and the second is string “NOT SUPPORTED YET”