XML handling for biomolecular residue topology definitions.

Code author: Jens Erik Nielsen

Code author: Todd Dolinsky

Code author: Yong Huang

class pdb2pqr.definitions.Definition(aa_file, na_file, patch_file)[source]

Force field topology definitions.

The Definition class contains the structured definitions found in the files and several mappings for easy access to the information.

__init__(aa_file, na_file, patch_file)[source]

Initialize object.

  • aa_file (file) – file-like object with amino acid definitions
  • na_file (file) – file-like object with nucleic acid definitions
  • patch_file (file) – file-like object with patch definitions
add_patch(patch, refname, newname)[source]

Add a patch to a topology definition residue.

  • patch (Patch) – the patch object to add
  • refname (str) – the name of the object to add the patch to
  • newname (str) – the name of the new (patched) object
class pdb2pqr.definitions.DefinitionAtom(name=None, x=None, y=None, z=None)[source]

Store force field atom topology definitions.

__init__(name=None, x=None, y=None, z=None)[source]

Initialize class.

  • name (str) – atom name
  • x (float) – x-coordinate
  • y (float) – y-coordinate
  • z (float) – z-coordinate

Identify whether atom is in backbone.

Returns:true if atom name is in backbone, otherwise false
Return type:bool
class pdb2pqr.definitions.DefinitionHandler[source]

Handle definition XML file content.


Initialize self. See help(type(self)) for accurate signature.


Parse text data in XML.

Parameters:text (str) – text data to parse

End XML element parsing.


name (str) – element name

  • KeyError – for invalid atom or residue names
  • RuntimeError – for unexpected XML features or format
startElement(name, _)[source]

Start XML element parsing.

Parameters:name (str) – element name
class pdb2pqr.definitions.DefinitionResidue[source]

Force field toplogy representation for a residue.


Initialize the class

Parameters:atoms (list) – list of atom-like (HETATM or ATOM) objects to be stored

Get bonded atoms near a given atom.

Parameters:atomname (str) – name of specific atom
Returns:list of nearby bonded atom names
Return type:[str]
class pdb2pqr.definitions.Patch[source]

Residue patches for structure topologies.


Initialize self. See help(type(self)) for accurate signature.