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

Represents ribosum similarity matrices. More...

#include <ribosum.hh>

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

Public Types

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
 

Public Member Functions

 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

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

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 Ribosum &ribosum)
 

Detailed Description

Represents ribosum similarity matrices.

Reads ribosum data from file and provides access.

Constructor & Destructor Documentation

◆ Ribosum()

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

Construct from file

Parameters
filenamename of the input file

Member Function Documentation

◆ alphabet()

const char_alphabet_type& LocARNA::Ribosum::alphabet ( ) const
inline

Get the basename alphabet as alphabet over characters

Returns
basename alphabet

◆ arcmatch_score()

double LocARNA::Ribosum::arcmatch_score ( char  i,
char  j,
char  k,
char  l 
) const
inline

Get arc match score.

Parameters
ileft character of first arc
jright character of first arc
kleft character of second arc
lright character of second arc
Returns
ribosum score for matching an arc of nucleotides i and j with an arc of nucleotides k and l.

◆ basematch_score()

double LocARNA::Ribosum::basematch_score ( char  i,
char  j 
) const
inline

Get base match score.

Parameters
icharacter of first nucleotide
jcharacter of second nucleotide
Returns
ribosum score for matching nucleotides i and j.

◆ get_arcmatch_scores()

const matrix_t& LocARNA::Ribosum::get_arcmatch_scores ( ) const
inline

Get arc match scores

Returns
the matrix of arc match scores

◆ get_basematch_scores()

const matrix_t& LocARNA::Ribosum::get_basematch_scores ( ) const
inline

Get base match scores.

Returns
the matrix of base match scores

◆ get_name()

const std::string& LocARNA::Ribosum::get_name ( ) const
inline

Get name of ribosum

Returns
name of ribosum

◆ read_matrix()

template<size_t N>
std::istream & LocARNA::Ribosum::read_matrix ( std::istream &  in,
matrix_t mat,
const Alphabet< std::string, N > &  names 
) const
protected

Read matrix from input stream

Parameters
ininput stream
[out]matmatrix to be read
namesalphabet names provided as Alphabet (of strings)
Returns
input stream after reading

◆ read_ribosum()

void LocARNA::Ribosum::read_ribosum ( std::istream &  in)
protected

reads the standard ribosum file format

Parameters
ininput stream

◆ set_arcname_alphabet()

void LocARNA::Ribosum::set_arcname_alphabet ( const std::array< std::string, 16 > &  a)
inlineprotected

Set alphabet of base names

Parameters
aarray of strings of the arc names
Postcondition
arcname_alphabet is initialized

◆ set_basename_alphabet()

void LocARNA::Ribosum::set_basename_alphabet ( const std::array< std::string, 4 > &  a)
inlineprotected

Set alphabet of base names

Parameters
aarray of strings of the base names
Postcondition
basename_alphabet and char_basename_alphabet are initialized

◆ string_alphabet()

const base_alphabet_type& LocARNA::Ribosum::string_alphabet ( ) const
inline

Get the basename alphabet as alphabet over strings

Returns
alphabet of strings

◆ write_matrix()

template<size_t N>
std::ostream & LocARNA::Ribosum::write_matrix ( std::ostream &  out,
const matrix_t mat,
const Alphabet< std::string, N > &  alph 
) const
protected

Write matrix to output stream

Parameters
outoutput stream
matmatrix to be written
alphalphabet names provided as Alphabet (of strings)
Returns
output stream after writing

Friends And Related Function Documentation

◆ operator<<

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

Output operator

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

Member Data Documentation

◆ am_

matrix_t LocARNA::Ribosum::am_
protected

16x16 matrix

scores for basepair/arc matches,


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