Implementation of RnaData. More...
#include <rna_data_impl.hh>
Classes | |
class | keyvec |
Public Types | |
typedef RnaData::arc_prob_matrix_t | arc_prob_matrix_t |
type for matrix of arc probabilities | |
Public Member Functions | |
RnaDataImpl (RnaData *self, const RnaData &rna_dataA, const RnaData &rna_dataB, const Alignment::edges_t &alignment, double p_expA, double p_expB) | |
Construct as consensus of two aligned RNAs. | |
RnaDataImpl (RnaData *self, double p_bpcut, size_t max_bp_span) | |
Almost empty constructor. | |
void | init_from_fixed_structure (const RnaStructure &structure, const PFoldParams &pfoldparams) |
initialize from fixed structure | |
void | init_from_rna_ensemble (const RnaEnsemble &rna_ensemble, const PFoldParams &pfoldparams) |
initialize from rna ensemble | |
std::istream & | read_pp_sequence (std::istream &in) |
read sequence section of pp-format | |
std::istream & | read_pp_arc_probabilities (std::istream &in) |
read section of base pair probabilities of pp-format | |
std::ostream & | write_pp_sequence (std::ostream &out) const |
write section of base pair probabilities of pp-format | |
std::ostream & | write_pp_arc_probabilities (std::ostream &out, double p_outbpcut, bool stacking) const |
write section of base pair probabilities of pp-format | |
void | init_as_consensus_dot_plot (const Alignment::edges_t &edges, const RnaData &rna_dataA, const RnaData &rna_dataB, double p_expA, double p_expB, double f_penalty, bool stacking) |
Initialize as consensus of two aligned RNAs. | |
double | consensus_probability (double pA, double pB, size_t sizeA, size_t sizeB, double p_expA, double p_expB, double p_penalty) const |
Consensus probability. | |
void | drop_worst_bps (size_t keep) |
Drop base pairs with lowest probability. | |
Public Attributes | |
RnaData * | self_ |
MultipleAlignment | sequence_ |
the sequence | |
double | p_bpcut_ |
cutoff probabilitiy for base pair | |
size_t | max_bp_span_ |
arc_prob_matrix_t | arc_probs_ |
arc_prob_matrix_t | arc_2_probs_ |
bool | has_stacking_ |
whether stacking probabilities are available |
Implementation of RnaData.
LocARNA::RnaDataImpl::RnaDataImpl | ( | RnaData * | self, |
const RnaData & | rna_dataA, | ||
const RnaData & | rna_dataB, | ||
const Alignment::edges_t & | alignment, | ||
double | p_expA, | ||
double | p_expB | ||
) |
LocARNA::RnaDataImpl::RnaDataImpl | ( | RnaData * | self, |
double | p_bpcut, | ||
size_t | max_bp_span | ||
) |
Almost empty constructor.
self | pointer to corresponding RnaData object |
p_bpcut | cutoff probability |
double LocARNA::RnaDataImpl::consensus_probability | ( | double | pA, |
double | pB, | ||
size_t | sizeA, | ||
size_t | sizeB, | ||
double | p_expA, | ||
double | p_expB, | ||
double | p_penalty | ||
) | const |
Consensus probability.
pA | probability A |
pB | probability B |
sizeA | number of rows in sequence A |
sizeB | number of rows in sequence B |
p_expA | background probability A |
p_expB | background probability B |
p_penalty | penalty probability for base pairs with probability below cutoff |
The penalty probability p_penalty has to be chosen carefully: Assuming 0 probability for base pairs below of the threshold geometric mean would result in 0 as consensus probability; thus we assume p_penalty in this case, however too high p_penalty leads to the accumulation of many base pairs with small probabilities.
Reasonably, p_penalty must be a small fraction of p_cutoff_.
void LocARNA::RnaDataImpl::drop_worst_bps | ( | size_t | keep | ) |
Drop base pairs with lowest probability.
keep | the maximum number of base pairs to keep |
void LocARNA::RnaDataImpl::init_as_consensus_dot_plot | ( | const Alignment::edges_t & | edges, |
const RnaData & | rna_dataA, | ||
const RnaData & | rna_dataB, | ||
double | p_expA, | ||
double | p_expB, | ||
double | f_penalty, | ||
bool | stacking | ||
) |
Initialize as consensus of two aligned RNAs.
edges | alignment edges |
rna_dataA | rna data A |
rna_dataB | rna data B |
p_expA | background probability A |
p_expB | background probability B |
f_penalty | factor for penalty probability: p_penalty = p_bpcut*f_penalty, |
stacking | if true, stacking consensus is computed |
void LocARNA::RnaDataImpl::init_from_fixed_structure | ( | const RnaStructure & | structure, |
const PFoldParams & | pfoldparams | ||
) |
initialize from fixed structure
structure | fixed structure |
pfoldparams | pfold parameters; only stacking is used |
void LocARNA::RnaDataImpl::init_from_rna_ensemble | ( | const RnaEnsemble & | rna_ensemble, |
const PFoldParams & | pfoldparams | ||
) |
initialize from rna ensemble
rna_ensemble | rna ensemble |
pfoldparams | folding parameters. if stacking, initialize stacking terms; if noLP, drop lonely pairs |
std::istream & LocARNA::RnaDataImpl::read_pp_arc_probabilities | ( | std::istream & | in | ) |
read section of base pair probabilities of pp-format
in | input stream |
Reads only base pairs with probabilities greater than p_bpcut_; reads stacking only if has_stacking_
std::istream & LocARNA::RnaDataImpl::read_pp_sequence | ( | std::istream & | in | ) |
read sequence section of pp-format
in | input stream |
this section comprises sequence/multiple alignment (possibly including sequence anchor annotation)
std::ostream & LocARNA::RnaDataImpl::write_pp_arc_probabilities | ( | std::ostream & | out, |
double | p_outbpcut, | ||
bool | stacking | ||
) | const |
write section of base pair probabilities of pp-format
Write arc probabilities.
out | ouput stream |
p_outbpcut | cutoff probabilitiy |
stacking | whether to write stacking probabilities; if stacking but !has_stacking_, no stacking terms are written but flag #STACKS is written to output |
Write only base pairs with probabilities greater than p_outbpcut
Writes arc and stacking probabilities to stream; filters by probability threshold p_outbpcut
std::ostream & LocARNA::RnaDataImpl::write_pp_sequence | ( | std::ostream & | out | ) | const |
write section of base pair probabilities of pp-format
out | ouput stream |
sparse array for all probabilities that a pair (i,j) and its immediately inner pair (i+1,j-1) are formed simultaneously above threshold; analogous to arc_probs_
sparse array for all arc probabilities above threshold; the array is used when reading in the probabilities and for merging probs during pp-output