LocARNA-1.8.11
Public 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 alphabet_typestring_alphabet () const
 
const Alphabet< char > & alphabet () 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 Attributes

matrix_t base_probs_
 matrix of base probabilities
 
matrix_t base_nonstruct_probs_
 matrix of base probabilities in non-structural context
 
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...
 
alphabet_type basename_alphabet
 alphabet of base names
 
alphabet_type arcname_alphabet
 alphabet of arc names
 
Alphabet< char > 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
 
- Protected Types inherited from LocARNA::Ribosum
typedef Alphabet< std::string > alphabet_type
 type of alphabet
 
- Protected Member Functions inherited from LocARNA::Ribosum
std::istream & read_matrix (std::istream &in, matrix_t &mat, const alphabet_type &names) const
 
std::ostream & write_matrix (std::ostream &out, const matrix_t &mat, const alphabet_type &alph) const
 
 Ribosum ()
 Construct empty.
 
void read_ribosum (std::istream &in)
 
Alphabet< char > make_char_alphabet () const
 transform the basename alphabet to alphabet over characters
 
void set_basename_alphabet (const std::string a[])
 
void set_arcname_alphabet (const std::string a[])
 

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

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

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.
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
double LocARNA::RibosumFreq::base_prob ( char  i) const
inline

Get probability of a base

Parameters
inucleotide character
Returns
probability of nucleotide character
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
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
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.
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
const matrix_t& LocARNA::RibosumFreq::get_arcmatch_probs ( ) const
inline

Get arcmatch prob matrix @ return matrix of arc match probabilities

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
const matrix_t& LocARNA::RibosumFreq::get_base_probs ( ) const
inline

Get base prob matrix

Returns
matrix of probabilities of all bases/nucleotides
const matrix_t& LocARNA::RibosumFreq::get_basematch_probs ( ) const
inline

Get basematch prob matrix

Returns
matrix of probabilities of base matches
const matrix_t& LocARNA::RibosumFreq::get_basepair_probs ( ) const
inline

Get base pair prob matrix

Returns
matrix of probabilities of base pairs
void LocARNA::RibosumFreq::print_basematch_scores_corrected ( std::ostream &  out) const

Print the corrected score of base matches.

See also
basematch_score_corrected()
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
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()
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

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

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