LocARNA-1.9.2
|
00001 #ifndef LOCARNA_RNA_DATA_IMPL_HH 00002 #define LOCARNA_RNA_DATA_IMPL_HH 00003 00004 #ifdef HAVE_CONFIG_H 00005 #include <config.h> 00006 #endif 00007 00008 #include <iosfwd> 00009 #include "rna_data.hh" 00010 #include "sequence.hh" 00011 00012 namespace LocARNA { 00013 00014 class MultipleAlignment; 00015 class RnaEnsemble; 00016 class PFoldParams; 00017 // template<class T> class SparseVector<T>; 00018 00022 class RnaDataImpl { 00023 public: 00025 typedef RnaData::arc_prob_matrix_t arc_prob_matrix_t; 00026 00027 RnaData *self_; 00028 00030 MultipleAlignment sequence_; 00031 00033 double p_bpcut_; 00034 size_t max_bp_span_; 00035 00041 arc_prob_matrix_t arc_probs_; 00042 00050 arc_prob_matrix_t arc_2_probs_; 00051 00053 bool has_stacking_; 00054 00065 RnaDataImpl(RnaData *self, 00066 const RnaData &rna_dataA, 00067 const RnaData &rna_dataB, 00068 const Alignment::edges_t &alignment, 00069 double p_expA, 00070 double p_expB); 00071 00078 RnaDataImpl(RnaData *self, double p_bpcut, size_t max_bp_span); 00079 00080 // ---------------------------------------- 00081 // METHODS 00082 00093 void 00094 init_from_fixed_structure(const RnaStructure &structure, 00095 const PFoldParams &pfoldparams); 00096 00104 void 00105 init_from_rna_ensemble(const RnaEnsemble &rna_ensemble, 00106 const PFoldParams &pfoldparams); 00107 00117 std::istream & 00118 read_pp_sequence(std::istream &in); 00119 00128 std::istream & 00129 read_pp_arc_probabilities(std::istream &in); 00130 00138 std::ostream & 00139 write_pp_sequence(std::ostream &out) const; 00140 00155 std::ostream & 00156 write_pp_arc_probabilities(std::ostream &out, 00157 double p_outbpcut, 00158 bool stacking) const; 00159 00171 void 00172 init_as_consensus_dot_plot(const Alignment::edges_t &edges, 00173 const RnaData &rna_dataA, 00174 const RnaData &rna_dataB, 00175 double p_expA, 00176 double p_expB, 00177 double f_penalty, 00178 bool stacking); 00179 00209 double 00210 consensus_probability(double pA, 00211 double pB, 00212 size_t sizeA, 00213 size_t sizeB, 00214 double p_expA, 00215 double p_expB, 00216 double p_penalty) const; 00217 00218 template <class KEY> 00219 class keyvec { 00220 public: 00221 typedef std::pair<KEY, arc_prob_matrix_t::value_t> kvpair_t; 00222 00223 typedef std::vector<kvpair_t> vec_t; 00224 00225 // compare for min heap 00226 static bool 00227 comp(const kvpair_t &x, const kvpair_t &y) { 00228 return x.second > y.second; 00229 } 00230 }; 00231 00237 void 00238 drop_worst_bps(size_t keep); 00239 00240 }; // end class RnaDataImpl 00241 00242 } // end namespace LocARNA 00243 00244 #endif // LOCARNA_RNA_DATA_IMPL_HH