LocARNA-1.9.2
src/LocARNA/rna_data.hh
00001 #ifndef LOCARNA_RNA_DATA_HH
00002 #define LOCARNA_RNA_DATA_HH
00003 
00004 #ifdef HAVE_CONFIG_H
00005 #include <config.h>
00006 #endif
00007 
00008 #include <iosfwd>
00009 #include "aux.hh"
00010 #include "sparse_matrix.hh"
00011 
00012 extern "C" {
00013 #include <ViennaRNA/data_structures.h>
00014 }
00015 
00016 namespace LocARNA {
00017 
00018     class MultipleAlignment;
00019     class Sequence;
00020     class Alignment;
00021     class RnaEnsemble;
00022     class RnaDataImpl;
00023     class PFoldParams;
00024     class SequenceAnnotation;
00025     class RnaStructure;
00026 
00043     class RnaData {
00044     protected:
00045         friend class RnaDataImpl;
00046         friend class ExtRnaDataImpl;
00047         RnaDataImpl
00048             *pimpl_; 
00049 
00050     public:
00052         typedef SparseMatrix<double> arc_prob_matrix_t;
00053 
00054         typedef size_t size_type; 
00055 
00068         RnaData(const RnaEnsemble &rna_ensemble,
00069                 double p_bpcut,
00070                 double max_bps_length_ratio,
00071                 const PFoldParams &pfoldparams);
00072 
00104         RnaData(const std::string &filename,
00105                 double p_bpcut,
00106                 double max_bps_length_ratio,
00107                 const PFoldParams &pfoldparams);
00108 
00128         RnaData(const RnaData &rna_dataA,
00129                 const RnaData &rna_dataB,
00130                 const Alignment &alignment,
00131                 double p_expA,
00132                 double p_expB,
00133                 bool only_local = false);
00134 
00135     protected:
00142         explicit RnaData(double p_bpcut, size_t max_bp_span);
00143 
00144     private:
00148         RnaData(const RnaData &);
00149 
00150     public:
00154         virtual ~RnaData();
00155 
00156     private:
00160         RnaData &
00161         operator=(const RnaData &);
00162 
00163     public:
00168         const Sequence &
00169         sequence() const;
00170 
00175         const MultipleAlignment &
00176         multiple_alignment() const;
00177 
00182         size_type
00183         length() const;
00184 
00189         double
00190         arc_cutoff_prob() const;
00191 
00200         double
00201         arc_prob(pos_type i, pos_type j) const;
00202 
00215         std::string
00216         mea_structure(double gamma = 1.) const;
00217 
00225         vrna_plist_t *
00226         plist() const;
00227 
00228     protected:
00230         typedef arc_prob_matrix_t::const_iterator arc_probs_const_iterator;
00231 
00237         arc_probs_const_iterator
00238         arc_probs_begin() const;
00239 
00245         arc_probs_const_iterator
00246         arc_probs_end() const;
00247 
00248     public:
00257         double
00258         joint_arc_prob(pos_type i, pos_type j) const;
00259 
00270         double
00271         stacked_arc_prob(pos_type i, pos_type j) const;
00272 
00273         // some computed probabilities (for convenience)
00283         double
00284         prob_paired_upstream(pos_type i) const;
00285 
00295         double
00296         prob_paired_downstream(pos_type i) const;
00297 
00304         double
00305         prob_unpaired(pos_type i) const;
00306 
00307         // IO
00319         std::ostream &
00320         write_pp(std::ostream &out, double p_outbpcut = 0) const;
00321 
00329         std::ostream &
00330         write_size_info(std::ostream &out) const;
00331 
00337         bool
00338         has_stacking() const;
00339 
00345         void
00346         set_anchors(const SequenceAnnotation &anchors);
00347 
00348     protected:
00359         virtual void
00360         init_from_fixed_structure(const RnaStructure &structure,
00361                                   const PFoldParams &pfoldparams);
00362 
00376         virtual void
00377         init_from_rna_ensemble(const RnaEnsemble &rna_ensemble,
00378                                const PFoldParams &pfoldparams);
00379 
00401         bool
00402         read_autodetect(const std::string &filename,
00403                         const PFoldParams &pfoldparams);
00404 
00413         virtual bool
00414         inloopprobs_ok() const {
00415             return true;
00416         }
00417 
00441         virtual void
00442         read_pp(const std::string &filename);
00443 
00451         virtual std::istream &
00452         read_pp(std::istream &in);
00453 
00477         void
00478         read_old_pp(const std::string &filename);
00479 
00497         void
00498         read_ps(const std::string &filename);
00499 
00500     }; // end class RnaData
00501 }
00502 
00503 #endif // LOCARNA_RNA_DATA_HH
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Friends