LocARNA-2.0.0
Public Member Functions | Protected Member Functions | Protected Attributes | Friends | List of all members
LocARNA::RibosumFreq Class Reference

Represents ribosum similarity matrices including raw frequencies. More...

#include <ribosum.hh>

Inheritance diagram for LocARNA::RibosumFreq:
Inheritance graph
[legend]
Collaboration diagram for LocARNA::RibosumFreq:
Collaboration graph
[legend]

Public Member Functions

 RibosumFreq (const std::string &filename)
 
double base_prob (char i) const
 
double base_nonstruct_prob (char i) const
 
const matrix_tget_base_probs () const
 
const matrix_tget_base_nonstruct_probs () const
 
double basepair_prob (char i, char j) const
 
const matrix_tget_basepair_probs () const
 
double basematch_prob (char i, char j) const
 
const matrix_tget_basematch_probs () const
 
double arcmatch_prob (char i, char j, char k, char l) const
 
const matrix_tget_arcmatch_probs () const
 
double base_unpaired_prob (char i) const
 probability that a nucleotide/base occurs unpaired More...
 
double basematch_score_corrected (char i, char j) const
 Get corrected score for a base match. More...
 
void print_basematch_scores_corrected (std::ostream &out) const
 Print the corrected score of base matches. More...
 
void read_matrix (std::istream &in, const std::string &header, matrix_t &mat, size_t xdim, size_t ydim)
 
void write_ICC_code (std::ostream &out, const std::string &ribname) const
 
std::ostream & write_matrix (std::ostream &out, const std::string &name, const Matrix< double > &mat) const
 
- Public Member Functions inherited from LocARNA::Ribosum
 Ribosum (const std::string &filename)
 
virtual ~Ribosum ()
 virtual destructor
 
const matrix_tget_basematch_scores () const
 Get base match scores. More...
 
const matrix_tget_arcmatch_scores () const
 
const base_alphabet_typestring_alphabet () const
 
const char_alphabet_typealphabet () const
 
const std::string & get_name () const
 
double basematch_score (char i, char j) const
 Get base match score. More...
 
double arcmatch_score (char i, char j, char k, char l) const
 Get arc match score. More...
 

Protected Member Functions

void write_CC_matrix (std::ostream &out, const std::string &ribname, const std::string &matname, int x, int y, const Ribosum::matrix_t &m) const
 
- Protected Member Functions inherited from LocARNA::Ribosum
template<size_t N>
std::istream & read_matrix (std::istream &in, matrix_t &mat, const Alphabet< std::string, N > &names) const
 
template<size_t N>
std::ostream & write_matrix (std::ostream &out, const matrix_t &mat, const Alphabet< std::string, N > &alph) const
 
 Ribosum ()
 Construct empty.
 
void read_ribosum (std::istream &in)
 
char_alphabet_type make_char_alphabet () const
 transform the basename alphabet to alphabet over characters
 
void set_basename_alphabet (const std::array< std::string, 4 > &a)
 
void set_arcname_alphabet (const std::array< std::string, 16 > &a)
 

Protected Attributes

matrix_t base_probs_
 matrix of base probabilities
 
matrix_t base_nonstruct_probs_
 
matrix_t basepair_probs_
 matrix of base pair probabilities
 
matrix_t basematch_probs_
 matrix of base match probabilties
 
matrix_t arcmatch_probs_
 matrix of arc match probabilities
 
- Protected Attributes inherited from LocARNA::Ribosum
std::string name_
 name of ribosum
 
matrix_t bm_
 scores for base matches, 4x4 matrix
 
matrix_t am_
 16x16 matrix More...
 
base_alphabet_type basename_alphabet_
 alphabet of base names
 
arc_alphabet_type arcname_alphabet_
 alphabet of arc names
 
char_alphabet_type char_basename_alphabet_
 alphabet of base names as characters
 

Friends

std::ostream & operator<< (std::ostream &out, const RibosumFreq &ribosum)
 

Additional Inherited Members

- Public Types inherited from LocARNA::Ribosum
typedef Matrix< double > matrix_t
 type of a matrix
 
typedef Alphabet< std::string, 4 > base_alphabet_type
 type of alphabet
 
typedef Alphabet< char, 4 > char_alphabet_type
 type of alphabet
 
typedef Alphabet< std::string, 16 > arc_alphabet_type
 type of alphabet
 

Detailed Description

Represents ribosum similarity matrices including raw frequencies.

Extension of the ribosum class that maintains additional "raw" information in particular frequencies of bases, basematches, basepairs, and arcmatches

Constructor & Destructor Documentation

◆ RibosumFreq()

LocARNA::RibosumFreq::RibosumFreq ( const std::string &  filename)
explicit

Construct from file

Parameters
filenameName of input file
Note
The file has to be in an extended ribosum file format including frequencies.

Member Function Documentation

◆ arcmatch_prob()

double LocARNA::RibosumFreq::arcmatch_prob ( char  i,
char  j,
char  k,
char  l 
) const
inline

Get the probability of an arcmatch

Parameters
ileft nucleotide character of first base pair
jright nucleotide character of first base pair
kleft nucleotide character of second base pair
lright nucleotide character of second base pair
Returns
probability of matching a
probability for matching an arc of nucleotides i and j with an arc of nucleotides k and l.

◆ base_nonstruct_prob()

double LocARNA::RibosumFreq::base_nonstruct_prob ( char  i) const
inline

Get probability of a base occuring in a non-structural match

Parameters
inucleotide character
Returns
probability of nucleotide character in non-structural matches

◆ base_prob()

double LocARNA::RibosumFreq::base_prob ( char  i) const
inline

Get probability of a base

Parameters
inucleotide character
Returns
probability of nucleotide character

◆ base_unpaired_prob()

double LocARNA::RibosumFreq::base_unpaired_prob ( char  i) const

probability that a nucleotide/base occurs unpaired

Parameters
inucleotide character
Returns
probability that nucleotide is unpaired

◆ basematch_prob()

double LocARNA::RibosumFreq::basematch_prob ( char  i,
char  j 
) const
inline

Get the probability of a base match

Parameters
ileft nucleotide character
jright nucleotide character
Returns
probability of match of nucleotides i and j

◆ basematch_score_corrected()

double LocARNA::RibosumFreq::basematch_score_corrected ( char  i,
char  j 
) const

Get corrected score for a base match.

Parameters
ifirst nucleotide character
jsecond nucleotide character
Returns
corrected score that i and j are matched
Note
the score is computed as log odd of frequencies for seeing i and j matched without incident structure divided by the background to see i and j without incident structure.
The arguments are characters of the alphabet/nucleotides.
Currently, not tabellized. Thus, we have some computational overhead.

◆ basepair_prob()

double LocARNA::RibosumFreq::basepair_prob ( char  i,
char  j 
) const
inline

Get probability of a basepair

Parameters
ileft nucleotide character
jright nucleotide character
Returns
probability of base pair of nucleotides i and j

◆ get_arcmatch_probs()

const matrix_t& LocARNA::RibosumFreq::get_arcmatch_probs ( ) const
inline

Get arcmatch prob matrix @ return matrix of arc match probabilities

◆ get_base_nonstruct_probs()

const matrix_t& LocARNA::RibosumFreq::get_base_nonstruct_probs ( ) const
inline

Get base nonstruct prob matrix

Returns
matrix of probabilities of all bases/nucleotides in nonstructural matches

◆ get_base_probs()

const matrix_t& LocARNA::RibosumFreq::get_base_probs ( ) const
inline

Get base prob matrix

Returns
matrix of probabilities of all bases/nucleotides

◆ get_basematch_probs()

const matrix_t& LocARNA::RibosumFreq::get_basematch_probs ( ) const
inline

Get basematch prob matrix

Returns
matrix of probabilities of base matches

◆ get_basepair_probs()

const matrix_t& LocARNA::RibosumFreq::get_basepair_probs ( ) const
inline

Get base pair prob matrix

Returns
matrix of probabilities of base pairs

◆ print_basematch_scores_corrected()

void LocARNA::RibosumFreq::print_basematch_scores_corrected ( std::ostream &  out) const

Print the corrected score of base matches.

See also
basematch_score_corrected()

◆ read_matrix()

void LocARNA::RibosumFreq::read_matrix ( std::istream &  in,
const std::string &  header,
matrix_t mat,
size_t  xdim,
size_t  ydim 
)

Read one matrix in ribosum input

Parameters
ininput stream
headerheader string
[out]matmatrix object to be read into
xdimfirst dimension of matrix
ydimsecond dimension of matrix

◆ write_ICC_code()

void LocARNA::RibosumFreq::write_ICC_code ( std::ostream &  out,
const std::string &  ribname 
) const

Write the ribosum matrices as C++ code

Parameters
outoutput stream
ribnameName of ribosum
Note
this is used to precompile ribosum matrices, such that their parameters can be linked to the code and we do not have to depend on data files.
See also
write_HH_code()

◆ write_matrix()

std::ostream & LocARNA::RibosumFreq::write_matrix ( std::ostream &  out,
const std::string &  name,
const Matrix< double > &  mat 
) const

Write single matrix to output stream

Parameters
outoutput stream
namename of matrix
matmatrix
Returns
output stream after writing

Friends And Related Function Documentation

◆ operator<<

std::ostream& operator<< ( std::ostream &  out,
const RibosumFreq ribosum 
)
friend

Output operator

Parameters
outoutput stream
ribosumRibosum to be written to stream
Returns
output stream after writing

Member Data Documentation

◆ base_nonstruct_probs_

matrix_t LocARNA::RibosumFreq::base_nonstruct_probs_
protected

matrix of base probabilities in non-structural context


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