LocARNA-1.9.2
src/LocARNA/ribofit.hh
00001 #ifndef LOCARNA_RIBOFIT_HH
00002 #define LOCARNA_RIBOFIT_HH
00003 
00004 #ifdef HAVE_CONFIG_H
00005 #include <config.h>
00006 #endif
00007 
00008 #include <cstdlib>
00009 #include <string>
00010 #include <fstream>
00011 #include <math.h>
00012 
00013 #include "sequence.hh"
00014 #include "alphabet.hh"
00015 #include "matrix.hh"
00016 
00017 namespace LocARNA {
00018 
00025     class Ribofit {
00026     public:
00027         typedef Matrix<double> matrix_t; 
00028 
00029     protected:
00031         Alphabet<char> alphabet_;
00032 
00033     public:
00037         explicit Ribofit(const char *alphabet) : alphabet_(alphabet, 4) {}
00038 
00040         virtual ~Ribofit(){};
00041 
00042     public:
00052         virtual double
00053         basematch_score(char i, char j, double identity) const = 0;
00054 
00066         virtual double
00067         arcmatch_score(char i, char j, char k, char l, double identity)
00068             const = 0;
00069 
00070         const Alphabet<char> &
00071         alphabet() const {
00072             return alphabet_;
00073         }
00074 
00081         const matrix_t &
00082         get_basematch_scores(double identity, matrix_t &basematch_scores) const;
00083     };
00084 
00085     class Ribofit_will2014 : public Ribofit {
00086 #include "ribofit_will2014.ihh"
00087 
00088     public:
00092         Ribofit_will2014() : Ribofit(will2014_nucleotides) {}
00093 
00097         ~Ribofit_will2014(){};
00098 
00099     protected:
00109         double
00110         basematch_score(char i, char j, double identity) const {
00111             return will2014_bmscore(alphabet_.idx(i), alphabet_.idx(j),
00112                                     identity);
00113         }
00114 
00126         double
00127         arcmatch_score(char i, char j, char k, char l, double identity) const {
00128             return will2014_amscore(alphabet_.idx(i), alphabet_.idx(j),
00129                                     alphabet_.idx(k), alphabet_.idx(l),
00130                                     identity);
00131         }
00132     };
00133 
00134 } // end namespace LocARNA
00135 
00136 #endif // LOCARNA_RIBOFIT_HH
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Friends