# Class residue

- Defined in File model.hpp

## Inheritance Relationships

### Derived Types

- `public cif::mm::monomer` (Class monomer)

- `public cif::mm::sugar` (Class sugar)

## Class Documentation

class residue

  The class residue is a collection of atoms forming a molecule.

  This class is used to store ligand e.g. Derived classes are monomer and sugar.

  Subclassed by cif::mm::monomer, cif::mm::sugar

  Public Functions

  inline residue(structure &structure, const std::string &compoundID, const std::string &asymID, int seqID, const std::string &authAsymID, const std::string &authSeqID, const std::string &pdbInsCode)

    Construct a new residue object based on key items.

  residue(structure &structure, const std::vector<atom> &atoms)

    Construct a new residue in structure with the atoms in atoms

  std::string get_entity_id() const

    Return the entity_id of this residue

  EntityType entity_type() const

    Return the entity type of this residue

  inline const std::string &get_asym_id() const

    Return the asym_id.

  inline int get_seq_id() const

    Return the seq_id.

  inline const std::string get_auth_asym_id() const

    Return the auth_asym_id.

  inline const std::string get_auth_seq_id() const

    Return the auth_seq_id.

  inline std::string get_pdb_ins_code() const

    Return the pdb_ins_code.

  inline const std::string &get_compound_id() const

    Return the compound_id.

  inline void set_compound_id(const std::string &id)

    Set the compound_id to id.

  inline structure *get_structure() const

    Return the structure this residue belongs to

  inline std::vector<atom> &atoms()

    Return a list of the atoms for this residue

  inline const std::vector<atom> &atoms() const

    Return a const list of the atoms for this residue

  void add_atom(atom &atom)

    Add atom atom to the atoms in this residue

  std::vector<atom> unique_atoms() const

    Unique atoms returns only the atoms without alternates and the first of each alternate atom id.

  atom get_atom_by_atom_id(const std::string &atomID) const

    Return the atom with atom_id atomID.

  std::vector<atom> get_atoms_by_id(const std::string &atomID) const

    Return the list of atoms having ID atomID.

    This includes all alternate atoms with this ID whereas get_atom_by_atom_id only returns the first unique atom

  bool is_entity() const

    Is this residue a single entity?

  inline bool is_water() const

    Is this residue a water molecule?

  bool has_alternate_atoms() const

    Return true if this residue has alternate atoms.

  bool has_alternate_atoms_for(const std::string &atomID) const

    Return true if this residue has alternate atoms for the atom atomID.

  std::set<std::string> get_alternate_ids() const

    Return the list of unique alt ID’s present in this residue.

  std::set<std::string> get_atom_ids() const

    Return the list of unique atom ID’s.

  std::tuple<point, float> center_and_radius() const

    Return a tuple containing the center location and the radius for the atoms of this residue.

  inline bool operator==(const residue &rhs) const

    Return true if this residue is equal to rhs.

  virtual atom create_new_atom(atom_type inType, const std::string &inAtomID, point inLocation)

    Create a new atom and add it to the list.

    Returns:

      newly created atom

  Friends

  friend class structure
  friend std::ostream &operator<<(std::ostream &os, const residue &res)

    Write the residue res to the std::ostream os.