LocARNA-2.0.0
ribofit.hh
1 #ifndef LOCARNA_RIBOFIT_HH
2 #define LOCARNA_RIBOFIT_HH
3 
4 #ifdef HAVE_CONFIG_H
5 #include <config.h>
6 #endif
7 
8 #include <cstdlib>
9 #include <string>
10 #include <fstream>
11 #include <math.h>
12 
13 #include "sequence.hh"
14 #include "alphabet.hh"
15 #include "matrix.hh"
16 
17 namespace LocARNA {
18 
25  class Ribofit {
26  public:
29 
33  explicit Ribofit(std::array<char, 4> alphabet) : alphabet_(alphabet) {}
34 
36  virtual ~Ribofit(){};
37 
47  virtual double
48  basematch_score(char i, char j, double identity) const = 0;
49 
61  virtual double
62  arcmatch_score(char i, char j, char k, char l, double identity)
63  const = 0;
64 
65  const base_alphabet_type &
66  alphabet() const {
67  return alphabet_;
68  }
69 
76  const matrix_t &
77  get_basematch_scores(double identity, matrix_t &basematch_scores) const;
78 
79 
80  protected:
83 
84  };
85 
86  class Ribofit_will2014 : public Ribofit {
87 #include "ribofit_will2014.ihh"
88 
89  public:
93  Ribofit_will2014() : Ribofit(will2014_nucleotides) {}
94 
99 
100  protected:
110  double
111  basematch_score(char i, char j, double identity) const {
112  return will2014_bmscore(alphabet_.idx(i), alphabet_.idx(j),
113  identity);
114  }
115 
127  double
128  arcmatch_score(char i, char j, char k, char l, double identity) const {
129  return will2014_amscore(alphabet_.idx(i), alphabet_.idx(j),
130  alphabet_.idx(k), alphabet_.idx(l),
131  identity);
132  }
133  };
134 
135 } // end namespace LocARNA
136 
137 #endif // LOCARNA_RIBOFIT_HH
size_type idx(const value_type &x) const
index of alphabet element
Definition: ribofit.hh:86
double arcmatch_score(char i, char j, char k, char l, double identity) const
ribofit arc match score for specific identity
Definition: ribofit.hh:128
Ribofit_will2014()
Construct.
Definition: ribofit.hh:93
~Ribofit_will2014()
destructor
Definition: ribofit.hh:98
double basematch_score(char i, char j, double identity) const
ribofit base match score for specific identity
Definition: ribofit.hh:111
Family of Ribofit matrices.
Definition: ribofit.hh:25
virtual double arcmatch_score(char i, char j, char k, char l, double identity) const =0
ribofit arc match score for specific identity
Matrix< double > matrix_t
type of a matrix
Definition: ribofit.hh:27
const matrix_t & get_basematch_scores(double identity, matrix_t &basematch_scores) const
Get base match scores.
Definition: ribofit.cc:11
virtual double basematch_score(char i, char j, double identity) const =0
ribofit base match score for specific identity
virtual ~Ribofit()
virtual destructor
Definition: ribofit.hh:36
Ribofit(std::array< char, 4 > alphabet)
Construct.
Definition: ribofit.hh:33
base_alphabet_type alphabet_
alphabet of base names as characters
Definition: ribofit.hh:82
Definition: aligner.cc:15