The libPDB library is intended to allow navigation through PDB files, as well as some manipulation. It’s written in OO-PHP, hence it’s easy to use but not terribly fast. For most projects in our lab, the speed is not a concern. Access to a specific residue or atom is very easy, as is enumeration. Several examples are shown below.

This library was written for a specific project and is by no means comprehensive. Only ATOM coordinates from PDB files are used; all other records are discarded. More functionality will be added as needed. If you need a specific functionality, please contact Luki for tips how to extend this library.

The most current version is available on NFS in ~luki/lib/libpdb.php, a copy is also available here.

Organization of PDB files

The library only uses ATOM coordinates from PDB files and discards everything else.

  • PDBFile: A PDB file is a collection of PDBChains; a PDBFile also keeps track of the PDB ID and filename, if available.
  • PDBChain: A PDB chain is a collection of PDBResidues; a chain also keeps track of its chain ID letter.
  • PDBResidue: A PDB residue is a collection of PDB Atoms; a residue also keeps track of its residue type.
  • PDBAtom: A PDB atom corresponds to the ATOM record in the PDB file, specifically the X, Y and Z coordinates and the B factor value.
  • Caveates / Known Issues

  • This library does not deal with alternative conformations; if multiple comformations are present, only the first one (A) will be used.
  • Missing residue atoms will not be rebuilt or verified.