All Classes Namespaces Functions Variables Pages
PDBFile Class Reference

PDBFile parses a Protein Data Bank (PDB) file and constructs a Topology and a set of atom positions from it. More...

Inheritance diagram for PDBFile:

## Public Member Functions

def | __init__
| Load a PDB file. More...
def | getTopology
| Get the Topology of the model. More...
def | getNumFrames
| Get the number of frames stored in the file. More...
def | getPositions
| Get the atomic positions. More...

## Static Public Member Functions

def | writeFile
| Write a PDB file containing a single model. More...
def | writeHeader
| Write out the header for a PDB file. More...
def | writeModel
| Write out a model to a PDB file. More...
def | writeFooter
| Write out the footer for a PDB file. More...

## Public Attributes

| topology
| The Topology read from the PDB file. More...
| positions
| The atom positions read from the PDB file. More...

## Detailed Description

PDBFile parses a Protein Data Bank (PDB) file and constructs a Topology and a set of atom positions from it.

This class also provides methods for creating PDB files. To write a file containing a single model, call writeFile(). You also can create files that contain multiple models. To do this, first call writeHeader(), then writeModel() once for each model in the file, and finally writeFooter() to complete the file.

## Constructor & Destructor Documentation

def __init__ | ( |  | self,
|  |  | file
| ) |  |

Load a PDB file.

The atom positions and Topology can be retrieved by calling getPositions() and getTopology().

Parameters

  file | (string) the name of the file to load

## Member Function Documentation

def getNumFrames | ( |  | self | ) |

Get the number of frames stored in the file.

References PDBFile._positions, and GromacsGroFile._positions.

def getPositions | ( |  | self,
|  |  | asNumpy = `False`,
|  |  | frame = `0`
| ) |  |

Get the atomic positions.

Parameters

  asNumpy | (boolean=False) if true, the values are returned as a numpy array instead of a list of Vec3s
  frame | (int=0) the index of the frame for which to get positions

References AmberInpcrdFile._numpyPositions, PDBFile._numpyPositions, GromacsGroFile._numpyPositions, PDBFile._positions, and GromacsGroFile._positions.

def getTopology | ( |  | self | ) |

Get the Topology of the model.

References Modeller.topology, PDBFile.topology, AmberPrmtopFile.topology, and GromacsTopFile.topology.

def writeFile | ( |  | topology,
|  |  | positions,
|  |  | file = `sys.stdout`,
|  |  | keepIds = `False`
| ) |  |

static

Write a PDB file containing a single model.

Parameters

  topology | (Topology) The Topology defining the model to write
  positions | (list) The list of atomic positions to write
  file | (file=stdout) A file to write to
  keepIds | (bool=False) If True, keep the residue and chain IDs specified in the Topology rather than generating new ones. Warning: It is up to the caller to make sure these are valid IDs that satisfy the requirements of the PDB format. Otherwise, the output file will be invalid.

def writeFooter | ( |  | topology,
|  |  | file = `sys.stdout`
| ) |  |

static

Write out the footer for a PDB file.

Parameters

  topology | (Topology) The Topology defining the molecular system being written
  file | (file=stdout) A file to write the file to

def writeHeader | ( |  | topology,
|  |  | file = `sys.stdout`
| ) |  |

static

Write out the header for a PDB file.

Parameters

  topology | (Topology) The Topology defining the molecular system being written
  file | (file=stdout) A file to write the file to

def writeModel | ( |  | topology,
|  |  | positions,
|  |  | file = `sys.stdout`,
|  |  | modelIndex = `None`,
|  |  | keepIds = `False`
| ) |  |

static

Write out a model to a PDB file.

Parameters

  topology | (Topology) The Topology defining the model to write
  positions | (list) The list of atomic positions to write
  file | (file=stdout) A file to write the model to
  modelIndex | (int=None) If not None, the model will be surrounded by MODEL/ENDMDL records with this index
  keepIds | (bool=False) If True, keep the residue and chain IDs specified in the Topology rather than generating new ones. Warning: It is up to the caller to make sure these are valid IDs that satisfy the requirements of the PDB format. Otherwise, the output file will be invalid.

## Member Data Documentation

positions

The atom positions read from the PDB file.

If the file contains multiple frames, these are the positions in the first frame.

Referenced by AmberInpcrdFile.getPositions().

topology

The Topology read from the PDB file.

Referenced by DesmondDMSFile.getTopology(), PDBFile.getTopology(), and PDBxFile.getTopology().

The documentation for this class was generated from the following file:

- pdbfile.py