#
The `Residue` class: a single residue in a model or alignment

The `Residue` class holds information about a single residue in a sequence (see Sequence.residues).

Two `Residue` objects are considered equal if and only if they represent the same residue in the same sequence.

Example: examples/python/residues.py

      # Example for 'residue' objects

      from modeller import *
      from modeller.scripts import complete_pdb

      def analyze_seq(description, seq):
          """Simple 'analysis' of a sequence of residues, from a model or alignment"""
          numcys = 0
          for res in seq:
              if res.pdb_name == 'CYS':
                  numcys += 1
          print("%s contains %d residues, of which %d are CYS" \
                % (description, len(seq), numcys))

      env = environ()
      env.io.atom_files_directory = ['../atom_files']
      env.libs.topology.read(file='$(LIB)/top_heav.lib')
      env.libs.parameters.read(file='$(LIB)/par.lib')

      mdl = complete_pdb(env, "1fas")

      # 'mdl.residues' is a list of all residues in the model
      print("1-letter code of 1st residue: " + mdl.residues[0].code)
      print("PDB name of residue '10' in chain A: " + mdl.residues['10:A'].pdb_name)

      # Get the first aligned sequence from a file
      aln = alignment(env, file='../commands/toxin.ali')
      firstseq = aln[0]

      # Analyze all residues in the model, a subset, and all residues in the
      # alignment sequence
      analyze_seq("Model 1fas", mdl.residues)
      analyze_seq("First 10 residues of 1fas", mdl.residue_range('1:A', '10:A'))
      analyze_seq("Aligned sequence %s" % firstseq.code, firstseq.residues)

Subsections

- Residue.name — internal (CHARMM) residue type name
- Residue.pdb_name — PDB (IUPAC) type name
- Residue.code — One-letter residue type code
- Residue.hetatm — HETATM indicator
- Residue.index — internal integer index
- Residue.num — PDB-style residue number
- Residue.curvature — Mainchain curvature
- Residue.atoms — all atoms in the residue
- Residue.chain — chain object
- Residue.phi — Φ dihedral angle
- Residue.psi — Ψ dihedral angle
- Residue.omega — ω dihedral angle
- Residue.alpha — α dihedral angle
- Residue.chi1 — χ1 dihedral angle
- Residue.chi2 — χ2 dihedral angle
- Residue.chi3 — χ3 dihedral angle
- Residue.chi4 — χ4 dihedral angle
- Residue.chi5 — χ5 dihedral angle
- Residue.get_aligned_residue() — get aligned residue in another sequence
- Residue.add_leading_gaps() — add gap(s) before this residue
- Residue.add_trailing_gaps() — add gap(s) after this residue
- Residue.remove_leading_gaps() — remove gap(s) before this residue
- Residue.remove_trailing_gaps() — remove gap(s) after this residue
- Residue.get_leading_gaps() — get number of gaps before this residue
- Residue.get_trailing_gaps() — get number of gaps after this residue