# `residue`

Biomolecular residue class.

Code author: Todd Dolinsky

Code author: Nathan Baker

class pdb2pqr.residue.Residue(atoms)

  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)

    Initialize the class

    Parameters:

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

  add_atom(atom)

    Add the atom object to the residue.

    Parameters:

      atom – atom-like object, e.g., `HETATM` or `ATOM`

  property 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)

    Return type:

      charge

  get_atom(name)

    Retrieve a residue atom based on its name.

    Parameters:

      resname (str) – name of the residue to retrieve

    Returns:

      residue

    Return type:

      structures.Atom

  get_moveable_names(pivot)

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

    Parameters:

      - residue (Residue) – the residue to use

      - pivot (str) – the pivot atomname

    Returns:

      names of atoms further away than pivot atom

    Return type:

      [str]

  has_atom(name)

    Return True if atom in residue.

    Parameters:

      name (str) – atom name in question

    Returns:

      True if atom in residue

    Return type:

      bool

  static letter_code()

    Default letter code for residue.

    Returns:

      letter code for residue

    Return type:

      str

  pick_dihedral_angle(conflict_names, oldnum=None)

    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

    Returns:

      new dihedral angle number

    Return type:

      int

  remove_atom(atomname)

    Remove an atom from the residue object.

    Parameters:

      atomname (str) – the name of the atom to be removed

  rename_atom(oldname, newname)

    Rename an atom to a new name.

    Parameters:

      - oldname (str) – old atom name

      - newname (str) – new atom name

  rename_residue(name)

    Rename the residue.

    Parameters:

      name (str) – the new name of the residue

  reorder()

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

  classmethod rotate_tetrahedral(atom1, atom2, angle)

    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)

    Set the chain ID.

    Parameters:

      value (str) – new chain_id value

  set_donors_acceptors()

    Set the donors and acceptors within the residue.

  set_res_seq(value)

    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()

    Update the is_n_terms and is_c_term flags.