LocARNA-1.9.2
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Friends
Classes | Public Types | Public Member Functions | Public Attributes
LocARNA::RnaDataImpl Class Reference

Implementation of RnaData. More...

#include <rna_data_impl.hh>

List of all members.

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

RnaDataself_
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

Detailed Description

Implementation of RnaData.


Constructor & Destructor Documentation

LocARNA::RnaDataImpl::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.

Parameters:
selfpointer to corresponding RnaData object
rna_dataAdata of RNA A
rna_dataBdata of RNA B
alignmentpairwise alignment of A and B
p_expAbackground probability A
p_expBbackground probability B

<

Todo:
this constant should be configurable
LocARNA::RnaDataImpl::RnaDataImpl ( RnaData self,
double  p_bpcut,
size_t  max_bp_span 
)

Almost empty constructor.

Parameters:
selfpointer to corresponding RnaData object
p_bpcutcutoff probability

Member Function Documentation

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.

Parameters:
pAprobability A
pBprobability B
sizeAnumber of rows in sequence A
sizeBnumber of rows in sequence B
p_expAbackground probability A
p_expBbackground probability B
p_penaltypenalty probability for base pairs with probability below cutoff
Note:
Essentially the consensus base pair probabilities are geometric means of the combined single base pair probabilties. This is maintained by weighting the pairwise consensus computations with the respective numbers of sequences.

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_.

Returns:
consensus probability
void LocARNA::RnaDataImpl::drop_worst_bps ( size_t  keep)

Drop base pairs with lowest probability.

Parameters:
keepthe 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.

Parameters:
edgesalignment edges
rna_dataArna data A
rna_dataBrna data B
p_expAbackground probability A
p_expBbackground probability B
f_penaltyfactor for penalty probability: p_penalty = p_bpcut*f_penalty,
See also:
consensus_probability()
Parameters:
stackingif true, stacking consensus is computed
void LocARNA::RnaDataImpl::init_from_fixed_structure ( const RnaStructure structure,
const PFoldParams pfoldparams 
)

initialize from fixed structure

Parameters:
structurefixed structure
pfoldparamspfold parameters; only stacking is used
Note:
this strictly sets the probability of all base pairs in structure to 1.0. It does not care for constraints like noLP or maxBPspan; this has to be handled by the caller!
void LocARNA::RnaDataImpl::init_from_rna_ensemble ( const RnaEnsemble rna_ensemble,
const PFoldParams pfoldparams 
)

initialize from rna ensemble

Parameters:
rna_ensemblerna ensemble
pfoldparamsfolding 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

Parameters:
ininput 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

Parameters:
ininput stream
Returns:
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.

Parameters:
outouput stream
p_outbpcutcutoff probabilitiy
stackingwhether to write stacking probabilities; if stacking but !has_stacking_, no stacking terms are written but flag #STACKS is written to output
Returns:
stream

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

Parameters:
outouput stream
Returns:
stream

Member Data Documentation

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_

Note:
arc_2_probs_ has entry (i,j) implies arc_probs_ has entry (i,j)

sparse array for all arc probabilities above threshold; the array is used when reading in the probabilities and for merging probs during pp-output

  • pointer to corresponding non-impl object

The documentation for this class was generated from the following files:
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Friends