Recent site activity

PDB2PQR‎ > ‎Programmer's guide‎ > ‎

Adding user-defined functions to PDB2PQR

The extensions directory is a particularly useful feature of PDB2PQR, as it allows users to add their own desired functionality to PDB2PQR and use PDB2PQR's object-oriented hierarchy. All functions in the extensions directory are automatically loaded into PDB2PQR as command line options using the function's name, and are called after all other steps (optimization, atom addition, parameter assignment) have been completed. As a result any available functions are particularly useful for post-processing, or for analysis without any changes to the input structure by using the --clean flag.

Please see the PDB2PQR extensions documentation for a basic template for setting up a new script.

One of the advantages of using PDB2PQR in this fashion is the ability to use built-in PDB2PQR functions. While a full and more detailed API can be found in the pydoc documentation, some useful functions are listed below:

  • From protein.py:
    • Class Protein:
      printAtoms(atomlist, flag)
      Print a list of atoms
      getResidues()
      Return a list of residues
      numResidues()
      Return the number of residues
      numAtoms()
      Return the number of atoms
      getAtoms()
      Return a list of atom objects
      getChains()
      Return a list of chains
  • From structures.py:
    • Class Chain:
      getResidues()
      Return a list of residues in the chain
      numResidues()
      Return the number of residues in the chain
      numAtoms()
      Return the number of atoms in the chain
      getAtoms()
      Return a list of atom objects in the chain
    • Class Residue:
      numAtoms()
      Return the number of atoms in the residue
      addAtom(atom)
      Add the atom object to the residue
      removeAtom(name)
      Remove a specific atom from the residue
      renameAtom(old, new)
      Rename atom "old" with "new"
      getAtom(name)
      Return a specific atom from the residue
      hasAtom(name)
      Determine if the residue has the atom "name"
    • Class Atom:
      getCoords()
      Return the x/y/z coordinates of the atom
      isHydrogen()
      Determine if the atom is a hydrogen or not
      isBackbone()
      Determine whether the atom is from the backbone
  • From utilities.py:
    getAngle(c1, c2, c3)
    Get the angle between the three coordinate sets
    getDihedral(c1, c2, c3, c4)
    Get the dihedral angle from the four coordinates
    distance(c1, c2)
    Return the distance between the two coordinates
    add(c1, c2)
    Return c1 + c2
    subtract(c1, c2)
    Return c1 - c2
    cross(c1, c2)
    Return the cross product of c1 and c2
    dot(c1, c2)
    Return the dot product of c1 and c2
    normalize(c1)
    Normalize the c1 coordinates