Class structure

Class Documentation

class structure

A structure is the combination of polymers, ligand and sugar branches found in the mmCIF file. This will always contain one model, the first model is taken if not otherwise specified.

Public Functions

structure(file &p, size_t modelNr = 1, StructureOpenOptions options = {})

Read the structure from cif::file p.

structure(datablock &db, size_t modelNr = 1, StructureOpenOptions options = {})

Load the structure from already parsed mmCIF data in db.

structure(const structure&) = delete
structure &operator=(const structure&) = delete
~structure() = default
inline size_t get_model_nr() const

Return the model number.

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

Return a list of all the atoms in this structure.

EntityType get_entity_type_for_entity_id(const std::string entityID) const

Return the entity type for the entity with id entity_id.

EntityType get_entity_type_for_asym_id(const std::string asymID) const

Return the entity type for the asym with id asym_id.

inline const std::list<polymer> &polymers() const

Return the list of polymers.

inline std::list<polymer> &polymers()

Return the list of polymers.

polymer &get_polymer_by_asym_id(const std::string &asymID)

Return the polymer having asym ID asymID.

inline const polymer &get_polymer_by_asym_id(const std::string &asymID) const

< Return the polymer having asym ID asymID

inline const std::list<branch> &branches() const

Return the list of all branches.

inline std::list<branch> &branches()

Return the list of all branches.

branch &get_branch_by_asym_id(const std::string &asymID)

Return the branch having asym ID asymID.

const branch &get_branch_by_asym_id(const std::string &asymID) const

Return the branch having asym ID asymID.

inline const std::vector<residue> &non_polymers() const

Return the list of non-polymers, actually the list of ligands.

bool has_atom_id(const std::string &id) const

Return true if an atom with ID id exists in this structure.

atom get_atom_by_id(const std::string &id) const

Return the atom with ID id.

atom get_atom_by_label(const std::string &atomID, const std::string &asymID, const std::string &compID, int seqID, const std::string &altID = "")

Return the atom identified by the label_ values specified.

atom get_atom_by_position(point p) const

Return the atom closest to point p.

atom get_atom_by_position_and_type(point p, std::string_view type, std::string_view res_type) const

Return the atom closest to point p with atom type type in a residue of type res_type.

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

Create a non-poly residue based on atoms already present in this structure.

inline residue &get_residue(const std::string &asymID)

Get a non-poly residue for an asym with id asymID.

inline const residue &get_residue(const std::string &asymID) const

Get a non-poly residue for an asym with id asymID.

residue &get_residue(const std::string &asymID, int seqID, const std::string &authSeqID)

Get a residue for an asym with id asymID seq id seqID and authSeqID authSeqID.

inline const residue &get_residue(const std::string &asymID, int seqID, const std::string &authSeqID) const

Get a the single residue for an asym with id asymID seq id seqID and authSeqID authSeqID.

residue &get_residue(const std::string &asymID, const std::string &compID, int seqID, const std::string &authSeqID)

Get a residue for an asym with id asymID, compound id compID, seq id seqID and authSeqID authSeqID.

inline const residue &get_residue(const std::string &asymID, const std::string &compID, int seqID, const std::string &authSeqID) const

Get a residue for an asym with id asymID, compound id compID, seq id seqID and authSeqID authSeqID.

inline residue &get_residue(const atom &atom)

Get a the residue for atom atom.

inline const residue &get_residue(const atom &atom) const

Get a the residue for atom atom.

inline void remove_atom(atom &a)

Remove atom a.

void swap_atoms(atom a1, atom a2)

swap the labels for these atoms

void move_atom(atom a, point p)

move atom to a new location

void change_residue(residue &res, const std::string &newcompound, const std::vector<std::tuple<std::string, std::string>> &remappedAtoms)

Change residue res to a new compound ID optionally remapping atoms.

A new chem_comp entry as well as an entity is created if needed and if the list of remappedAtoms is not empty it is used to remap.

The array in remappedAtoms contains tuples of strings, both strings contain an atom_id. The first is the one in the current residue and the second is the atom_id that should be used instead. If the second string is empty, the atom is removed from the residue.

Parameters
  • res

  • newcompound

  • remappedAtoms

void remove_residue(const std::string &asym_id, int seq_id, const std::string &auth_seq_id)

Remove a residue, can be monomer or nonpoly.

Parameters
  • asym_id – The asym ID

  • seq_id – The sequence ID

  • auth_seq_id – The auth sequence ID

std::string create_non_poly_entity(const std::string &mon_id)

Create a new non-polymer entity, returns new ID.

Parameters

mon_id – The mon_id for the new nonpoly, must be an existing and known compound from CCD

Returns

The ID of the created entity

std::string create_non_poly(const std::string &entity_id, const std::vector<atom> &atoms)

Create a new NonPolymer struct_asym with atoms constructed from atoms, returns asym_id. This method assumes you are copying data from one cif file to another.

Parameters
  • entity_id – The entity ID of the new nonpoly

  • atoms – The array of atom_site rows containing the data.

Returns

The newly create asym ID

std::string create_non_poly(const std::string &entity_id, std::vector<row_initializer> atoms)

Create a new NonPolymer struct_asym with atoms constructed from info in atom_info, returns asym_id. This method creates new atom records filled with info from the info.

Parameters
  • entity_id – The entity ID of the new nonpoly

  • atoms – The array of sets of item data containing the data for the atoms.

Returns

The newly create asym ID

void create_water(row_initializer atom)

Create a new water with atom constructed from info in atom_info This method creates a new atom record filled with info from the info.

Parameters

atom – The set of item data containing the data for the atoms.

branch &create_branch()

Create a new and empty (sugar) branch.

void remove_branch(branch &branch)

Remove branch.

void remove_residue(residue &res)

Remove residue res.

Parameters

res – The residue to remove

void translate(point t)

Translate the coordinates of all atoms in the structure by t.

void rotate(quaternion t)

Rotate the coordinates of all atoms in the structure by q.

void translate_and_rotate(point t, quaternion q)

Translate and rotate the coordinates of all atoms in the structure by t and q.

void translate_rotate_and_translate(point t1, quaternion q, point t2)

Translate, rotate and translate again the coordinates of all atoms in the structure by t1 , q and t2.

void cleanup_empty_categories()

Remove all categories that have no rows left.

inline category &get_category(std::string_view name) const

Direct access to underlying data.

inline datablock &get_datablock() const

Direct access to underlying data.

void validate_atoms() const

Check if all atoms are part of either a polymer, a branch or one of the non-polymer residues.

template<typename ...Args>
inline atom &emplace_atom(Args&... args)

emplace a newly created atom using args

atom &emplace_atom(atom &&atom)

emplace the moved atom atom