1 #ifndef LOCARNA_SCORING_HH 2 #define LOCARNA_SCORING_HH 13 #include "scoring_fwd.hh" 17 #include "sequence.hh" 123 const double exp_probA;
125 const double exp_probB;
127 const double temperature;
223 : basematch(basematch_),
224 basemismatch(basemismatch_),
226 indel_loop(indel_loop_),
227 indel_opening(indel_opening_),
228 indel_opening_loop(indel_opening_loop_),
231 unpaired_penalty(unpaired_penalty_),
232 struct_weight(struct_weight_),
233 tau_factor(tau_factor_),
234 exclusion(exclusion_),
235 exp_probA(exp_probA_),
236 exp_probB(exp_probB_),
239 new_stacking(new_stacking_),
240 mea_scoring(mea_scoring_),
241 alpha_factor(alpha_factor_),
242 beta_factor(beta_factor_),
243 gamma_factor(gamma_factor_),
244 probability_scale(probability_scale_)
330 bool exp_scores=
false 345 modify_by_parameter(
score_t lambda);
353 apply_unpaired_penalty();
368 std::vector<score_t> gapcost_tabA;
369 std::vector<score_t> gapcost_tabB;
371 std::vector<score_t> weightsA;
372 std::vector<score_t> weightsB;
374 std::vector<score_t> stack_weightsA;
376 std::vector<score_t> stack_weightsB;
385 std::vector<pf_score_t> exp_gapcost_tabA;
386 std::vector<pf_score_t> exp_gapcost_tabB;
392 precompute_sequence_identities();
402 score_t round2score(
double d)
const {
403 return (
score_t)((d<0) ? (d-0.5) : (d+0.5));
416 sigma_(
int i,
int j)
const;
432 precompute_exp_sigma();
436 precompute_gapcost();
440 precompute_exp_gapcost();
444 precompute_weights();
456 precompute_weights(
const RnaData &rna_data,
459 std::vector<score_t> &weights,
460 std::vector<score_t> &stack_weights);
472 probToWeight(
double p,
double prob_exp)
const;
479 ribosum_arcmatch_prob(
const Arc &arcA,
const Arc &arcB)
const;
495 riboX_arcmatch_score(
const Arc &arcA,
const Arc &arcB)
const;
499 boltzmann_weight(
score_t s)
const {
return exp(s/(
pf_score_t)params->temperature); }
504 subtract(std::vector<score_t> &v,
score_t x)
const;
524 return sigma_tab(i,j);
536 return exp_sigma_tab(i,j);
588 arcDel(
const BasePairs__Arc &arc,
bool gapAorB,
bool stacked=
false)
const;
598 return boltzmann_weight(arcmatch(am));
609 return arcmatch(am,
true);
622 return gapA(alignedToGap);
624 return gapB(alignedToGap);
635 assert(1<=posA && posA <= seqA.
length());
637 return gapcost_tabA[posA];
648 assert(1<=posA && posA <= seqA.
length());
649 return exp_gapcost_tabA[posA];
660 assert(1<=posB && posB <= seqB.
length());
662 return gapcost_tabB[posB];
673 assert(1<=posB && posB <= seqB.
length());
675 return exp_gapcost_tabB[posB];
700 return exp_indel_opening_score;
705 return exp_indel_opening_loop_score;
738 is_stackable_arcA(
const Arc &a)
const;
748 is_stackable_arcB(
const Arc &a)
const;
758 is_stackable_am(
const ArcMatch &am)
const;
764 #endif // LOCARNA_SCORING_HH represent sparsified data of RNA ensemble
Definition: rna_data.hh:42
const Ribofit * ribofit
Definition: scoring.hh:103
score_t gapA(size_type posA) const
Definition: scoring.hh:634
const score_t alpha_factor
weight for mea contribution "unstructured"
Definition: scoring.hh:140
const score_t basematch
Definition: scoring.hh:73
score_t basematch(size_type i, size_type j) const
Score of a match of bases (without structure)
Definition: scoring.hh:523
pf_score_t exp_arcmatch(const ArcMatch &am) const
Boltzmann weight of score of arc match.
Definition: scoring.hh:597
pf_score_t exp_gapB(size_type posB) const
Boltzmann weight of score of insertion.
Definition: scoring.hh:672
Family of Ribofit matrices.
Definition: ribofit.hh:25
const score_t exclusion
cost of one exclusion.
Definition: scoring.hh:121
pf_score_t exp_basematch(size_type i, size_type j) const
Boltzmann weight of score of a base match (without structure)
Definition: scoring.hh:535
Matrix< infty_score_t > ScoreMatrix
matrix of scores supporting infinity
Definition: scoring.hh:45
std::vector< pf_score_t > PFScoreVector
Vector of partition functions.
Definition: scoring.hh:41
const score_t indel_opening
cost per gap (for affine gap-cost). Use affine gap cost if non-zero.
Definition: scoring.hh:85
const score_t struct_weight
Definition: scoring.hh:112
Provides probabilities for each match.
Definition: match_probs.hh:42
const score_t indel_opening_loop
cost per gap for loops(for affine gap-cost). Use affine gap cost if non-zero.
Definition: scoring.hh:88
size_t size_type
general size type
Definition: aux.hh:94
pf_score_t exp_indel_opening_loop() const
exp of cost to begin a new indel in loops
Definition: scoring.hh:704
Matrix< double > ProbMatrix
matrix for storing probabilities
Definition: aligner_p.hh:24
score_t exclusion() const
cost of an exclusion
Definition: scoring.hh:679
ScoringParams(score_t basematch_, score_t basemismatch_, score_t indel_, score_t indel_loop_, score_t indel_opening_, score_t indel_opening_loop_, RibosumFreq *ribosum_, Ribofit *ribofit_, score_t unpaired_penalty_, score_t struct_weight_, score_t tau_factor_, score_t exclusion_, double exp_probA_, double exp_probB_, double temp_, bool stacking_, bool new_stacking_, bool mea_scoring_, score_t alpha_factor_, score_t beta_factor_, score_t gamma_factor_, score_t probability_scale_)
Definition: scoring.hh:200
const bool stacking
turn on/off stacking terms
Definition: scoring.hh:131
const bool new_stacking
turn on/off new stacking terms
Definition: scoring.hh:134
Maintains the relevant arc matches and their scores.
Definition: arc_matches.hh:112
pf_score_t exp_gapA(size_type posA) const
Boltzmann weight of score of deletion.
Definition: scoring.hh:647
score_t indel_opening() const
cost to begin a new indel
Definition: scoring.hh:684
Definition: aligner.cc:17
const score_t gamma_factor
weight for mea contribution "consensus"
Definition: scoring.hh:146
score_t arcmatch_stacked(const ArcMatch &am) const
Score of stacked arc match.
Definition: scoring.hh:608
const bool mea_scoring
turn on/off mea scoring
Definition: scoring.hh:137
double pf_score_t
type of partition functions
Definition: scoring_fwd.hh:26
const score_t indel_loop
cost per indel for loops (for linear or affine gap cost).
Definition: scoring.hh:82
score_t lambda() const
Get factor lambda for normalized alignment.
Definition: scoring.hh:360
pos_type length() const
Length of multiple aligment.
Definition: multiple_alignment.hh:624
const RibosumFreq * ribosum
Definition: scoring.hh:95
score_t gapX(size_type alignedToGap, bool gapInA) const
Definition: scoring.hh:620
const score_t basemismatch
constant cost of a base mismatch
Definition: scoring.hh:76
score_t gapB(size_type posB) const
Definition: scoring.hh:659
Parameters for scoring.
Definition: scoring.hh:65
std::vector< infty_score_t > ScoreVector
matrix of scores supporting infinity
Definition: scoring.hh:35
const score_t probability_scale
Definition: scoring.hh:156
BasePairs__Arc Arc
arc
Definition: scoring.hh:287
Represents a base pair.
Definition: basepairs.hh:40
Provides methods for the scoring of alignments.
Definition: scoring.hh:285
const score_t unpaired_penalty
penalty/cost for unpaired bases matched/mismatched/gapped
Definition: scoring.hh:106
score_t loop_indel_score(const score_t score) const
multiply an score by the ratio of indel_loop/indel
Definition: scoring.hh:689
const score_t indel
cost per indel (for linear or affine gap cost).
Definition: scoring.hh:79
Describes sequence and structure ensemble of an RNA.
Definition: basepairs.hh:107
bool stacking() const
Query stacking flag.
Definition: scoring.hh:727
long int score_t
type of the locarna score as defined by the class Scoring
Definition: scoring_fwd.hh:13
Represents ribosum similarity matrices including raw frequencies.
Definition: ribosum.hh:175
const score_t beta_factor
weight for mea contribution "structure"
Definition: scoring.hh:143
Matrix< pf_score_t > PFScoreMatrix
Matrix of partition functions.
Definition: scoring.hh:48
pf_score_t exp_indel_opening() const
exp of cost to begin a new indel
Definition: scoring.hh:699
"Sequence View" of multiple alignment as array of column vectors
Definition: sequence.hh:29
const score_t tau_factor
Definition: scoring.hh:118
score_t indel_opening_loop() const
cost to begin a new indel
Definition: scoring.hh:693
Represents a match of two base pairs (arc match)
Definition: arc_matches.hh:35