LocARNA-1.9.2
src/LocARNA/mcc_matrices.hh
00001 #ifndef LOCARNA_MCC_MATRICES_HH
00002 #define LOCARNA_MCC_MATRICES_HH
00003 
00004 #ifdef HAVE_CONFIG_H
00005 #include <config.h>
00006 #endif
00007 
00008 #include <assert.h>
00009 
00010 #define PUBLIC // for Vienna
00011 
00012 extern "C" {
00013 #include <ViennaRNA/params.h> // import pf_paramT definition
00014 }
00015 
00016 namespace LocARNA {
00017 
00018     class McC_matrices_base {
00019     protected:
00026         vrna_fold_compound_t *vc_;
00027 
00031         explicit
00032         McC_matrices_base(vrna_fold_compound_t *vc);
00033 
00034     public:
00040         virtual ~McC_matrices_base();
00041 
00044         size_t
00045         iidx(size_t i, size_t j) const {
00046             assert(1 <= i);
00047             assert(i <= j);
00048             assert(j <= vc_->length);
00049 
00050             return vc_->iindx[i] - j;
00051         }
00052 
00055         size_t
00056         jidx(size_t i, size_t j) const {
00057             assert(1 <= i);
00058             assert(i <= j);
00059             assert(j <= vc_->length);
00060 
00061             return vc_->jindx[j] + i;
00062         }
00063 
00072         FLT_OR_DBL
00073         bppm(size_t i, size_t j) const {
00074             return vc_->exp_matrices->probs[iidx(i, j)];
00075         }
00076 
00085         FLT_OR_DBL
00086         qb(size_t i, size_t j) const {
00087             return vc_->exp_matrices->qb[iidx(i, j)];
00088         }
00089 
00098         FLT_OR_DBL
00099         qm(size_t i, size_t j) const {
00100             return vc_->exp_matrices->qm[iidx(i, j)];
00101         }
00102 
00106         vrna_exp_param_t *
00107         exp_params() const {
00108             return vc_->exp_params;
00109         }
00110 
00116         FLT_OR_DBL
00117         scale(size_t i) const {
00118             return vc_->exp_matrices->scale[i];
00119         }
00120 
00126         FLT_OR_DBL
00127         expMLbase(size_t i) const {
00128             return vc_->exp_matrices->expMLbase[i];
00129         }
00130 
00135         FLT_OR_DBL
00136         kT() const {
00137             return vc_->exp_params->kT;
00138         }
00139 
00147         FLT_OR_DBL
00148         q1k(size_t k) const {
00149             return vc_->exp_matrices->q1k[k];
00150         }
00151 
00159         FLT_OR_DBL
00160         qln(size_t l) const {
00161             return vc_->exp_matrices->qln[l];
00162         }
00163 
00172         int
00173         pair(size_t c, size_t d) const {
00174             assert(vc_);
00175             assert(vc_->exp_params);
00176             return vc_->exp_params->model_details.pair[c][d];
00177         }
00178     };
00179 
00184     class McC_matrices_t : public McC_matrices_base {
00185     public:
00191         explicit
00192         McC_matrices_t(vrna_fold_compound_t *vc);
00193 
00197         virtual ~McC_matrices_t();
00198 
00207         char
00208         ptype(size_t i, size_t j) const {
00209             return vc_->ptype[jidx(i, j)];
00210         }
00211 
00220         char
00221         rev_ptype(size_t i, size_t j) const {
00222             return vc_->exp_params->model_details.rtype[(size_t)ptype(i, j)];
00223         }
00224 
00232         short
00233         S1(size_t i) const {
00234             return vc_->sequence_encoding[i];
00235         }
00236 
00237         char *
00238         sequence() const {
00239             return vc_->sequence;
00240         }
00241     };
00242 
00245     class McC_ali_matrices_t : public McC_matrices_base {
00246     public:
00252         explicit
00253         McC_ali_matrices_t(vrna_fold_compound_t *vc);
00254 
00258         virtual ~McC_ali_matrices_t();
00259 
00268         short
00269         pscore(size_t i, size_t j) const {
00270             return vc_->pscore[jidx(i, j)];
00271         }
00272 
00281         short
00282         S(size_t s, size_t i) const {
00283             return vc_->S[s][i];
00284         }
00285 
00294         short
00295         S3(size_t s, size_t i) const {
00296             return vc_->S3[s][i];
00297         }
00298 
00307         short
00308         S5(size_t s, size_t i) const {
00309             return vc_->S5[s][i];
00310         }
00311 
00320         short
00321         a2s(size_t s, size_t i) const {
00322             return vc_->a2s[s][i];
00323         }
00324 
00325         char *
00326         Ss(size_t s) const {
00327             return vc_->Ss[s];
00328         }
00329     };
00330 
00331 } // end namespace LocARNA
00332 
00333 #endif // LOCARNA_MCC_MATRICES_HH
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Friends