# residue¶

Biomolecular residue class.

Code author: Todd Dolinsky

Code author: Nathan Baker

class pdb2pqr.residue.Residue(atoms)[source]

Residue class

Todo

Should this class have a member variable for dihedrals? Pylint complains!

The residue class contains a list of Atom objects associated with that residue and other helper functions.

__init__(atoms)[source]

Initialize the class

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

Add the atom object to the residue.

Parameters: atom – atom-like object, e.g., HETATM or ATOM
charge

Get the total charge of the residue.

In order to get rid of floating point rounding error, do a string transformation.

Returns: The charge of the residue (float) charge
get_atom(name)[source]

Retrieve a residue atom based on its name.

Parameters: resname (str) – name of the residue to retrieve residue structures.Atom
get_moveable_names(pivot)[source]

Return all atom names that are further away than the pivot atom.

Parameters: residue (Residue) – the residue to use pivot (str) – the pivot atomname names of atoms further away than pivot atom [str]
has_atom(name)[source]

Return True if atom in residue.

Parameters: name (str) – atom name in question True if atom in residue bool
static letter_code()[source]

Default letter code for residue.

Returns: letter code for residue str
pick_dihedral_angle(conflict_names, oldnum=None)[source]

Choose an angle number to use in debumping.

Instead of simply picking a random chiangle, this function uses a more intelligent method to improve efficiency. The algorithm uses the names of the conflicting atoms within the residue to determine which angle number has the best chance of fixing the problem(s). The method also insures that the same chiangle will not be run twice in a row.

Parameters: residue (Residue) – residue that is being debumped conflict_names ([str]) – list of atom names that are currently conflicts oldnum (int) – old dihedral angle number new dihedral angle number int
remove_atom(atomname)[source]

Remove an atom from the residue object.

Parameters: atomname (str) – the name of the atom to be removed
rename_atom(oldname, newname)[source]

Rename an atom to a new name.

Parameters: oldname (str) – old atom name newname (str) – new atom name
rename_residue(name)[source]

Rename the residue.

Parameters: name (str) – the new name of the residue
reorder()[source]

Reorder the atoms to start with N, CA, C, O if they exist.

classmethod rotate_tetrahedral(atom1, atom2, angle)[source]

Rotate about the atom1-atom2 bond by a given angle.

All atoms connected to atom2 will rotate.

Parameters: atom1 (structures.Atom) – first atom of the bond to rotate about atom2 (structures.Atom) – second atom of the bond to rotate about angle (float) – degrees to rotate
set_chain_id(value)[source]

Set the chain ID.

Parameters: value (str) – new chain_id value
set_donors_acceptors()[source]

Set the donors and acceptors within the residue.

set_res_seq(value)[source]

Change the residue sequence number.

Set the atom field res_seq and change the residue’s information. The icode field is no longer useful.

Parameters: value (int) – the new value of res_seq
update_terminus_status()[source]

Update the is_n_terms and is_c_term flags.