LocARNA-1.9.2
src/LocARNA/ext_rna_data_impl.hh
00001 #ifndef LOCARNA_EXT_RNA_DATA_IMPL_HH
00002 #define LOCARNA_EXT_RNA_DATA_IMPL_HH
00003 
00004 #ifdef HAVE_CONFIG_H
00005 #include <config.h>
00006 #endif
00007 
00008 #include <iosfwd>
00009 #include "ext_rna_data.hh"
00010 #include "sequence.hh"
00011 #include "sparse_vector.hh"
00012 
00013 namespace LocARNA {
00014 
00015     // class Sequence;
00016     // class RnaEnsemble;
00017     // class PFoldParams;
00018 
00022     class ExtRnaDataImpl {
00023     public:
00024         // ----------------------------------------
00025         // TYPES
00026 
00028         typedef SparseVector<double> arc_prob_vector_t;
00029 
00031         typedef RnaDataImpl::arc_prob_matrix_t arc_prob_matrix_t;
00032 
00034         typedef SparseMatrix<arc_prob_vector_t> arc_prob_vector_matrix_t;
00035 
00037         typedef SparseMatrix<arc_prob_matrix_t> arc_prob_matrix_matrix_t;
00038 
00039         // ----------------------------------------
00040         // ATTRIBUTES
00041 
00042         ExtRnaData *self_; 
00043 
00045         double p_bpilcut_;
00046 
00048         double p_uilcut_;
00049 
00051         arc_prob_matrix_matrix_t arc_in_loop_probs_;
00052 
00054         arc_prob_vector_matrix_t unpaired_in_loop_probs_;
00055 
00058         bool has_in_loop_probs_;
00059 
00060         // ----------------------------------------
00061         // CONSTRUCTORS
00062 
00073         ExtRnaDataImpl(ExtRnaData *self, double p_bpilcut, double p_uilcut);
00074 
00075         // ----------------------------------------
00076         // METHODS
00077 
00078     private:
00083         void
00084         init_fixed_unpaired_in_loop(size_t i,
00085                                     size_t j,
00086                                     const RnaStructure &structure);
00091         void
00092         init_fixed_basepairs_in_loop(size_t i,
00093                                      size_t j,
00094                                      const RnaStructure &structure);
00095 
00096     public:
00106         void
00107         init_from_fixed_structure(const RnaStructure &structure);
00108 
00118         void
00119         init_from_ext_rna_ensemble(const RnaEnsemble &rna_ensemble);
00120 
00131         std::istream &
00132         read_pp_in_loop_probabilities(std::istream &in);
00133 
00140         void
00141         read_pp_in_loop_probabilities_kwline(const std::string &line);
00142 
00149         void
00150         read_pp_in_loop_probabilities_line(const std::string &line);
00151 
00162         std::ostream &
00163         write_pp_in_loop_probabilities(std::ostream &out,
00164                                        double p_outbpcut,
00165                                        double p_outbpilcut,
00166                                        double p_outuilcut) const;
00167 
00179         std::ostream &
00180         write_pp_in_loop_probability_line(std::ostream &out,
00181                                           size_t i,
00182                                           size_t j,
00183                                           double p_bpcut,
00184                                           double p_ucut) const;
00194         std::ostream &
00195         write_pp_basepair_in_loop_probabilities(std::ostream &out,
00196                                                 const arc_prob_matrix_t &probs,
00197                                                 double p_cut) const;
00198 
00208         std::ostream &
00209         write_pp_unpaired_in_loop_probabilities(std::ostream &out,
00210                                                 const arc_prob_vector_t &probs,
00211                                                 double p_cut) const;
00212 
00218         void
00219         drop_worst_bps(size_t keep);
00220 
00227         void
00228         drop_worst_uil(size_t keep);
00229 
00235         void
00236         drop_worst_bpil(size_t keep);
00237 
00245         void
00246         drop_worst_bpil_precise(double ratio);
00247 
00248     }; // end ExtRnaDataImpl
00249 
00250 } // end namespace LocARNA
00251 
00252 #endif // LOCARNA_EXT_RNA_DATA_IMPL_HH
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Friends