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

Provides methods for the scoring of alignments. More...

#include <scoring.hh>

List of all members.

Public Types

typedef BasePairs__Arc Arc
 arc

Public Member Functions

 Scoring (const Sequence &seqA, const Sequence &seqB, const RnaData &rna_dataA, const RnaData &rna_dataB, const ArcMatches &arc_matches, const MatchProbs *match_probs, const ScoringParams &params, bool exp_scores=false)
 construct scoring object
void modify_by_parameter (score_t lambda)
void apply_unpaired_penalty ()
score_t lambda () const
 Get factor lambda for normalized alignment.
score_t basematch (size_type i, size_type j) const
 Score of a match of bases (without structure)
pf_score_t exp_basematch (size_type i, size_type j) const
 Boltzmann weight of score of a base match (without structure)
score_t arcmatch (const ArcMatch &am, bool stacked=false) const
 Score of arc match, support explicit arc match scores.
score_t arcmatch (const BasePairs__Arc &arcA, const BasePairs__Arc &arcB, bool stacked=false) const
 Score of arc match, given two arcs.
template<bool gapAorB>
score_t arcDel (const BasePairs__Arc &arc, bool stacked=false) const
 Very basic interface, score of aligning a basepair to gap.
pf_score_t exp_arcmatch (const ArcMatch &am) const
 Boltzmann weight of score of arc match.
score_t arcmatch_stacked (const ArcMatch &am) const
 Score of stacked arc match.
template<bool gapInA>
score_t gapX (size_type alignedToGap) const
score_t gapA (size_type posA) const
pf_score_t exp_gapA (size_type posA) const
 Boltzmann weight of score of deletion.
score_t gapB (size_type posB) const
pf_score_t exp_gapB (size_type posB) const
 Boltzmann weight of score of insertion.
score_t exclusion () const
 cost of an exclusion
score_t indel_opening () const
 cost to begin a new indel
score_t loop_indel_score (const score_t score) const
 multiply an score by the ratio of indel_loop/indel
score_t indel_opening_loop () const
 cost to begin a new indel
pf_score_t exp_indel_opening () const
 exp of cost to begin a new indel
pf_score_t exp_indel_opening_loop () const
 exp of cost to begin a new indel in loops
double prob_exp (size_type len) const
 Expected base pair probability.
bool stacking () const
 Query stacking flag.
bool is_stackable_arcA (const Arc &a) const
 Is arc of A stackable.
bool is_stackable_arcB (const Arc &a) const
 Is arc of B stackable.
bool is_stackable_am (const ArcMatch &am) const
 Is arc match stackable.

Detailed Description

Provides methods for the scoring of alignments.

Maintains and provides the scores for the alignment of two specific Rnas. Configurable via class ScoringParams, supports the classic LocARNA-score as well as the LocARNA MEA-Score. for "Classic Score" it supports * match/mismatch cost or RIBOSUM for bases * linear or affine gap cost * arc match scores build of arc probabilitiesmatch_probs and optionally base match contribution or RIBOSUM for the "MEA Score" it supports * base match/mismatch scores derived from base match probabilities * RIBOSUM for base and arc match contribution * arc match score contributions from arc probabilities * weighting of single score contributions

The scoring class supports only characters ACGU, gap -, and N for ribosum scoring. ALL other characters are treated as unknown characters and are basically ignored. In consequence, IUPAC codes are handled badly. Even more important, for ribosum scoring, sequences have to be upper case and Ts should be converted to Us!!!

Note:
The class implements two versions of the stacking score (controlled by ScoringParams flags stacking and new_stacking. The first flag lets the class derive the arc weights for stacked arcs from the conditional probability of the base pair (i,j) if (i+1,j-1) exists. The new_stacking flag adds a log odd contribution derived from the joint probability of (i,j) and (i+1,j-1) to the weight of (i,j).
Todo:
check proper use of unpaired penalty; e.g. is correction needed for arc match (like for lambda)??

Constructor & Destructor Documentation

LocARNA::Scoring::Scoring ( const Sequence seqA,
const Sequence seqB,
const RnaData rna_dataA,
const RnaData rna_dataB,
const ArcMatches arc_matches,
const MatchProbs match_probs,
const ScoringParams params,
bool  exp_scores = false 
)

construct scoring object

Parameters:
seqAfirst sequence
seqBsecond sequence
rna_dataAprobability data of first sequence
rna_dataBprobability data of second sequence
arc_matchesthe (significant) arc matches between the sequences
match_probspointer to base match probabilities (can be 0L for non-mea scores)
paramsa collection of parameters for scoring
exp_scoresonly if true, the results of the exp_* scoring functions are defined, otherwise precomputations can be ommitted.

Member Function Documentation

subtract the fixed unpaired_penalty from base match and base indel scores it is similar to method Please note that the base match and gap scores of ALL bases including the paired ones will be modified!

template<bool isA>
score_t LocARNA::Scoring::arcDel ( const BasePairs__Arc arc,
bool  stacked = false 
) const

Very basic interface, score of aligning a basepair to gap.

Note:
gapAorB whether deleting element in A or B (true for A)
Parameters:
arcthe base pair
stackedwhether the base pair is stacked
Returns:
score_t LocARNA::Scoring::arcmatch ( const ArcMatch am,
bool  stacked = false 
) const

Score of arc match, support explicit arc match scores.

Parameters:
amarc match
stackedis stacked? (optional parameter)
Returns:
Score of arc match am (potentially stacked)
Note:
This method supports explicit arc match scores. Such scores are required for the probabilistic mode of (m)locarna.
This method should be prefered over arcmatch(const Arc &arcA, const Arc &arcB, bool stacked=false) unless explicit arc match scores are not needed and the use of this method would be too inefficient.
score_t LocARNA::Scoring::arcmatch ( const BasePairs__Arc arcA,
const BasePairs__Arc arcB,
bool  stacked = false 
) const

Score of arc match, given two arcs.

Parameters:
arcAbase pair in A
arcBbase pair in B
stackedis stacked? (optional parameter)
Returns:
Score of arc match am (potentially stacked)
Note:
This method does not support explicit arc match scores, since this would require to know the arcmatch object.
Using this method is disallowed if arc_matches->explicit_scores()==true (This results in a run-time error if !NDEBUG).
score_t LocARNA::Scoring::arcmatch_stacked ( const ArcMatch am) const [inline]

Score of stacked arc match.

Parameters:
amarc match
Returns:
Score of arc match am when stacked
score_t LocARNA::Scoring::basematch ( size_type  i,
size_type  j 
) const [inline]

Score of a match of bases (without structure)

Parameters:
iposition in A
jposition in B
Returns:
score of base match i~j
pf_score_t LocARNA::Scoring::exp_arcmatch ( const ArcMatch am) const [inline]

Boltzmann weight of score of arc match.

Parameters:
amarc match
Returns:
Boltzmann weight of score of arc match am
pf_score_t LocARNA::Scoring::exp_basematch ( size_type  i,
size_type  j 
) const [inline]

Boltzmann weight of score of a base match (without structure)

Parameters:
iposition in A
jposition in B
Returns:
Boltzmann weight of score of base match i~j
pf_score_t LocARNA::Scoring::exp_gapA ( size_type  posA) const [inline]

Boltzmann weight of score of deletion.

Parameters:
posAposition in A
Returns:
Boltzmann weight of score of deletion of posA after posB
pf_score_t LocARNA::Scoring::exp_gapB ( size_type  posB) const [inline]

Boltzmann weight of score of insertion.

Parameters:
posBposition in B
Returns:
Boltzmann weight of score of insertion of posB after posA
score_t LocARNA::Scoring::gapA ( size_type  posA) const [inline]

Score of deletion

Parameters:
posAposition in A
Returns:
score of deletion of posA after posB
score_t LocARNA::Scoring::gapB ( size_type  posB) const [inline]

Score of insertion

Parameters:
posBposition in B
Returns:
score of insertion of posB after posA
score_t LocARNA::Scoring::gapX< false > ( size_type  alignedToGap) const [inline]

Score of deletion

Parameters:
alignedToGapposition in A or B
gapInAwhether symbol in A (true) or B (false) is aligned to gap
Returns:
score of deletion : posA <--> posB
bool LocARNA::Scoring::is_stackable_am ( const ArcMatch am) const

Is arc match stackable.

Parameters:
amArc match
Returns:
whether stackable
bool LocARNA::Scoring::is_stackable_arcA ( const Arc a) const

Is arc of A stackable.

Parameters:
aArc
Returns:
whether stackable
bool LocARNA::Scoring::is_stackable_arcB ( const Arc a) const

Is arc of B stackable.

Parameters:
aArc
Returns:
whether stackable
score_t LocARNA::Scoring::lambda ( ) const [inline]

Get factor lambda for normalized alignment.

Returns:
lambda
void LocARNA::Scoring::modify_by_parameter ( score_t  lambda)

modify scoring by a parameter lambda. Used in the computational of normalized local alignment by fractional programming in the form of the Dinkelbach algorithm. The modification is destructive. modify_by_parameter(0) results in unmodified scoring. Repeated modifications are valid. The Outcome is *undefined* when the Scoring object is used to obtain exponentiated scores (methods exp_...) as in partition function alignment.

Parameters:
lambdathe parameter
double LocARNA::Scoring::prob_exp ( size_type  len) const

Expected base pair probability.

Parameters:
lenlength of RNA sequence
Returns:
expected base pair probability for sequence length
Note:
influences computation of weights for base pairs
bool LocARNA::Scoring::stacking ( ) const [inline]

Query stacking flag.

Returns:
flag, whether stacking is used (old or new stacking terms)

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