RNAMake
Public Member Functions | List of all members
Residue Class Reference

#include <residue.h>

Public Member Functions

 Residue (ResidueType const &rtype, String const &name, int const &num, String const &chain_id, String const &i_code)
 
 Residue (Residue const &r)
 
 Residue (String const &s, ResidueTypeSet const &rts)
 
 ~Residue ()
 
void setup_atoms (AtomOPs &)
 
AtomOP const & get_atom (String const &name) const
 
int connected_to (Residue const &res, float cutoff=3.0) const
 
void new_uuid ()
 
Beads get_beads () const
 
String to_str () const
 
String to_pdb_str (int &acount)
 
String to_pdb_str (int &, int, String const &) const
 
void to_pdb (String const)
 
bool operator== (const Residue &r) const
 
void num (int nnum)
 
void chain_id (String const &nchain_id)
 
void uuid (Uuid const &uuid)
 
String const & name () const
 
String const & chain_id () const
 
String const & i_code () const
 
int const & num () const
 
String const & short_name () const
 
AtomOPs const & atoms () const
 
Uuid const & uuid () const
 

Detailed Description

Store residue information from pdb file, stores all Atom objects that belong to residue. Implementation is designed to be extremely lightweight.

To get an example instance of Residue please include:
#include "instances/structure_instances.hpp"

Example of Common Usage:

//grabbing example instance
#include "instances/structure_instances.hpp"
auto r = instances::residue();
//simply getting name of residue, etc: A,G,C or U
std::cout << r->name() << std::endl; //OUTPUT: "G"
//getting a specific atom from residue
auto a = r->get_atom("C1'");
std::cout << a->coords() << std::endl; //OUTPUT: "-23.806 -50.289 86.732"
auto beads = r->get_beads();
std::cout << beads[0]->btype() << " " << beads[0]->center() << std::endl;
//OUTPUT: "1 24.027 -48.5001111111 86.368"
//get PDB formatted String (can also write to file with r->to_pdb("test.pdb") )
std::cout << r->to_pdb_str() << std::endl; //OUTPUT -->
ATOM 1 O5' G A 103 -26.469 -47.756 84.669 1.00 0.00
ATOM 2 C5' G A 103 -25.050 -47.579 84.775 1.00 0.00
ATOM 3 C4' G A 103 -24.521 -48.156 86.068 1.00 0.00
ATOM 4 O4' G A 103 -24.861 -49.568 86.118 1.00 0.00
ATOM 5 C3' G A 103 -23.009 -48.119 86.281 1.00 0.00
ATOM 6 O3' G A 103 -22.548 -46.872 86.808 1.00 0.00
.
.
.

Constructor & Destructor Documentation

Residue::Residue ( ResidueType const &  rtype,
String const &  name,
int const &  num,
String const &  chain_id,
String const &  i_code 
)
inline

Standard constructor for Bead object.

Parameters
rtyperesidue type, dictates residue topology and information
namename of residue i.e. "GUA", "CYT", etc
numresidue num
chain_idthe id of the chain i.e. "A", "B", only one character
i_coderesidue insertion code, usually nothing ("")
Residue::Residue ( Residue const &  r)
inline

Copy constructor

Parameters
rResidue object copying from
Residue::Residue ( String const &  s,
ResidueTypeSet const &  rts 
)
inline

Construction from String, used in reading data from files

Parameters
sstring generated from to_str()
See also
to_str()
Residue::~Residue ( )
inline

Empty deconstructor

Member Function Documentation

AtomOPs const& Residue::atoms ( ) const
inline

getter for the internal atom vector

void Residue::chain_id ( String const &  nchain_id)
inline

setter for nchain id

Parameters
chain_idnew chain id
String const& Residue::chain_id ( ) const
inline

getter the chain_id

int Residue::connected_to ( Residue const &  res,
float  cutoff = 3.0 
) const
inline

Determine if another residue is connected to this residue, returns 0 if res is not connected to self, returns 1 if connection is going from 5' to 3' and returns -1 if connection is going from 3' to 5'

Parameters
resanother residue
cutoffdistance to be considered connected, default: 3 Angstroms
AtomOP const& Residue::get_atom ( String const &  name) const
inline

get atom object by its name

Parameters
namename of atom

examples:

auto a = r->get_atom("C1'");
std::cout << a->coords() << std::endl;
//OUTPUT -23.806 -50.289 86.732
Beads Residue::get_beads ( ) const

Generates steric beads required for checking for steric clashes between motifs. Each residues has three beads modeled after the typical three bead models used in coarse grain modeling. The three beads are:

#include "instances/structure_instances.hpp"
auto r = instances::residue();
auto beads = r->get_beads();
//Test instance is the first residue in a chain with no phosphate so it has
//only two beads
std::cout << beads.size() << std::endl;
//OUTPUT 2
std::cout << beads[0].btype() == BeadType::SUGAR << std::endl;
//OUTPUT 1
String const& Residue::i_code ( ) const
inline

getter for the residue insertion code

String const& Residue::name ( ) const
inline

getter for the name of the residue, i.e. "A", "G" etc

void Residue::new_uuid ( )
inline

give residue a new unique indentifier code. There is probably no reason why you should call this unless writing a new, motif structure.

void Residue::num ( int  nnum)
inline

setter for residue num

Parameters
nnumnew residue num
int const& Residue::num ( ) const
inline

getter for the residue num

bool Residue::operator== ( const Residue r) const
inline

equal operator checks whether the unique indentifier is the same

Parameters
ranother residue to check if its the same
void Residue::setup_atoms ( AtomOPs &  atoms)

put atoms in correct positon in internal atom list, also corrects some named atom names to their correct name

Parameters
atomslist of atom objects that are to be part of this residue
String const& Residue::short_name ( ) const
inline

getter for the one letter residue type

void Residue::to_pdb ( String const  fname)

writes a PDB string formmated verision of this Residue object to file

Parameters
filenameof output PDB file
String Residue::to_pdb_str ( int &  acount)
inline

wrapper for to_pdb_str(int &, int, String const &) when one does not care about renumbering atoms and residue

String Residue::to_pdb_str ( int &  acount,
int  rnum,
String const &  chain_id 
) const

returns pdb formatted string of residue's coordinate information

Parameters
acountcurrent atom index, default: 1
rnumstarting residue number
chain_idthe chain id of the chain, i.e. "A", "B" etc
#include "instances/structure_instances.hpp"
auto r = instances::residue();
//get PDB formatted String (can also write to file with r->to_pdb("test.pdb") )
std::cout << r->to_pdb_str() << std::endl; //OUTPUT -->
ATOM 1 O5' G A 103 -26.469 -47.756 84.669 1.00 0.00
ATOM 2 C5' G A 103 -25.050 -47.579 84.775 1.00 0.00
ATOM 3 C4' G A 103 -24.521 -48.156 86.068 1.00 0.00
ATOM 4 O4' G A 103 -24.861 -49.568 86.118 1.00 0.00
ATOM 5 C3' G A 103 -23.009 -48.119 86.281 1.00 0.00
ATOM 6 O3' G A 103 -22.548 -46.872 86.808 1.00 0.00
.
.
.
String Residue::to_str ( ) const

stringifes residue object

#include "instances/structure_instances.hpp"
auto r = instances::residue();
std::cout << r->to_str() << std::endl;
//OUTPUT
GUA,G,103,A,,N,N,N,O5' -26.469 -47.756 84.669,C5' -25.05 -47.579 84.775,C4' -24.521 -48.156
86.068,O4' -24.861 -49.568 86.118,C3' -23.009 -48.119 86.281,O3' -22.548 -46.872 86.808,C1'
-23.806 -50.289 86.732,C2' -22.812 -49.259 87.269,O2' -23.167 -48.903 88.592,N1 -19.538 -52.485
85.025,C2 -19.717 -51.643 86.097,N2 -18.624 -51.354 86.809,N3 -20.884 -51.124 86.445,C4 -21.881
-51.521 85.623,C5 -21.811 -52.356 84.527,C6 -20.546 -52.91 84.164,O6 -20.273 -53.677 83.228,N7
-23.063 -52.513 83.947,C8 -23.858 -51.786 84.686,N9 -23.21 -51.159 85.722,
void Residue::uuid ( Uuid const &  uuid)
inline

setter for the residue unique indentifier, do not do this without really knowing what you are doing

Parameters
uuidnew residue unique indentifier
Uuid const& Residue::uuid ( ) const
inline

getter for residue unique indentifier


The documentation for this class was generated from the following files: