1 #ifndef LOCARNA_ARC_MATCHES_HH 2 #define LOCARNA_ARC_MATCHES_HH 11 #include "scoring_fwd.hh" 14 #include "basepairs.hh" 23 class AnchorConstraints;
24 class TraceController;
25 class MatchController;
66 arcA()
const {
return *arcA_;}
74 arcB()
const {
return *arcB_;}
82 idx()
const {
return idx_;}
146 bool is_valid_arcmatch(
const Arc &
arcA,
const Arc &
arcB)
const;
178 init_inner_arc_matchs();
192 : arc_matches(arc_matches_)
212 return (ali>alj) || (ali==alj && bli>blj);
240 :i(i_), j(j_), k(k_), l(l_), score(score_)
268 const std::string &arcmatch_scores_file,
269 int probability_scale,
270 size_type max_length_diff,
271 size_type max_diff_at_am,
300 size_type max_length_diff,
301 size_type max_diff_at_am,
322 void read_arcmatch_scores(
const std::string &arcmatch_scores_file,
int probability_scale);
329 void write_arcmatch_scores(
const std::string &arcmatch_scores_file,
const Scoring &scoring)
const;
347 return maintain_explicit_scores;
356 make_scores_explicit(
const Scoring &scoring);
367 assert(maintain_explicit_scores);
368 return scores[am.
idx()];
373 return number_of_arcmatches;
378 assert(idx<number_of_arcmatches);
379 return arc_matches_vec[
idx];
387 const ArcMatchIdxVec &
389 return common_right_end_lists(i,j);
393 const ArcMatchIdxVec &
395 return common_left_end_lists(i,j);
419 void get_max_right_ends(size_type al,size_type bl,size_type *max_ar,size_type *max_br,
bool no_lonely_pairs)
const;
428 void get_min_right_ends(size_type al,size_type bl,size_type *min_ar,size_type *min_br)
const;
440 return inner_arcmatch_idxs[am.
idx()] < num_arc_matches();
450 return arcmatch(inner_arcmatch_idxs[am.
idx()]);
459 sort_right_adjacency_lists();
468 const_iterator
begin()
const {
return arc_matches_vec.begin();}
471 const_iterator
end()
const {
return arc_matches_vec.begin()+number_of_arcmatches;}
505 const std::string &arcmatch_scores_file,
506 int probability_scale,
512 arcmatch_scores_file,
520 build_arcmatch_index();
559 build_arcmatch_index();
564 typedef std::pair<size_type,size_type> idx_pair_t;
570 am_index_type am_index_;
577 build_arcmatch_index();
597 return number_of_arcmatches;
610 am_index_type::const_iterator it = am_index_.find(idx_pair_t(arcAIdx,arcBIdx));
611 if (am_index_.end() != it) {
614 return invalid_am_index();
628 return arc_matches_vec[am_index(arcA.
idx(),arcB.
idx())];
634 #endif // LOCARNA_ARC_MATCHES_HH represent sparsified data of RNA ensemble
Definition: rna_data.hh:42
Represents anchor constraints between two sequences.
Definition: anchor_constraints.hh:26
size_t left() const
Definition: basepairs.hh:72
size_type idx_type
arc match index
Definition: arc_matches.hh:38
const ArcMatch & am_index(const Arc &arcA, const Arc &arcB) const
Lookup arc match by pair of arcs.
Definition: arc_matches.hh:627
const MatchController & match_controller
allowed alignment traces by max-diff heuristics
Definition: arc_matches.hh:130
std::vector< int >::size_type size_type
size type
Definition: arc_matches.hh:37
const ArcMatch & inner_arc_match(const ArcMatch &am) const
Definition: arc_matches.hh:449
Matrix< ArcMatchIdxVec > common_right_end_lists
for each (i,j) maintain vector of the indices of the arc matchs that share the common right end (i...
Definition: arc_matches.hh:166
bool explicit_scores() const
true, if arc match scores are explicit (because they are read in from a list)
Definition: arc_matches.hh:346
ArcMatch(const Arc *arcA, const Arc *arcB, idx_type idx)
Definition: arc_matches.hh:54
size_type k
position k
Definition: arc_matches.hh:226
std::vector< score_t > scores
vector of scores (of arc matches with the same index)
Definition: arc_matches.hh:162
idx_type idx() const
Definition: arc_matches.hh:82
Definition: arc_matches.hh:220
std::vector< ArcMatch > ArcMatchVec
Vector of arc matches.
Definition: arc_matches.hh:86
ArcMatchesIndexed(const Sequence &seqA_, const Sequence &seqB_, const std::string &arcmatch_scores_file, int probability_scale, size_type max_length_diff, size_type max_diff_at_am, const MatchController &trace_controller, const AnchorConstraints &constraints)
construct with explicit arc match score list
Definition: arc_matches.hh:503
const Arc & arcA() const
Definition: arc_matches.hh:66
BasePairs__Arc Arc
arc
Definition: arc_matches.hh:115
const ArcMatchIdxVec & common_left_end_list(size_type i, size_type j) const
list of all arc matches that share the common left end (i,j)
Definition: arc_matches.hh:394
class ArcMatches with additional mapping
Definition: arc_matches.hh:483
size_type number_of_arcmatches
Definition: arc_matches.hh:159
std::vector< int >::size_type size_type
size type
Definition: arc_matches.hh:222
size_type j
position j
Definition: arc_matches.hh:225
Maintains the relevant arc matches and their scores.
Definition: arc_matches.hh:112
std::vector< ArcMatch::idx_type > ArcMatchIdxVec
Vector of arc match indices.
Definition: arc_matches.hh:89
const AnchorConstraints & constraints
for constraints
Definition: arc_matches.hh:132
tuple5(size_type i_, size_type j_, size_type k_, size_type l_, score_t score_)
Definition: arc_matches.hh:239
std::vector< int >::size_type size_type
size
Definition: arc_matches.hh:114
Definition: aligner.cc:17
ArcMatchesIndexed(const RnaData &rnadataA, const RnaData &rnadataB, double min_prob, size_type max_length_diff, size_type max_diff_at_am, const MatchController &trace_controller, const AnchorConstraints &constraints)
construct from single base pair probabilities.
Definition: arc_matches.hh:543
const ArcMatchIdxVec & common_right_end_list(size_type i, size_type j) const
list of all arc matches that share the common right end (i,j)
Definition: arc_matches.hh:388
bool exists_inner_arc_match(const ArcMatch &am) const
Definition: arc_matches.hh:439
BasePairs * bpsA
base pairs of RNA A
Definition: arc_matches.hh:121
ArcMatchVec arc_matches_vec
vector of all maintained arc matches
Definition: arc_matches.hh:153
Compare two arc match indices by lexicographically comparing their left ends.
Definition: arc_matches.hh:181
score_t get_score(const ArcMatch &am) const
Definition: arc_matches.hh:366
ArcMatchVec::const_iterator const_iterator
const iterator over arc matches
Definition: arc_matches.hh:465
const Arc & arcB() const
Definition: arc_matches.hh:74
size_type lenA
length of sequence A
Definition: arc_matches.hh:118
ArcMatchIdxVec inner_arcmatch_idxs
vector of indices of inner arc matches
Definition: arc_matches.hh:174
const ArcMatch::idx_type am_index(const size_type &arcAIdx, const size_type &arcBIdx) const
Lookup arc match index by pair of arc indices.
Definition: arc_matches.hh:609
const ArcMatch::idx_type invalid_am_index() const
the invalid arc match index
Definition: arc_matches.hh:590
size_type num_arc_matches() const
total number of arc matches
Definition: arc_matches.hh:372
BasePairs * bpsB
base pairs of RNA B
Definition: arc_matches.hh:122
size_type max_length_diff
for max-diff-am heuristics
Definition: arc_matches.hh:126
size_type max_diff_at_am
for max diff at arc matches heuristics
Definition: arc_matches.hh:128
const ArcMatch & arcmatch(size_type idx) const
get arc match by its index
Definition: arc_matches.hh:377
Represents a base pair.
Definition: basepairs.hh:40
score_t score
the score (as used below: score of arc match (i,j)~(k,l))
Definition: arc_matches.hh:228
lex_greater_left_ends(const ArcMatches &arc_matches_)
Definition: arc_matches.hh:191
const BasePairs & get_base_pairsA() const
returns the base pairs object for RNA A
Definition: arc_matches.hh:334
size_type l
position l
Definition: arc_matches.hh:227
Provides methods for the scoring of alignments.
Definition: scoring.hh:285
const_iterator end() const
end of arc matches vector
Definition: arc_matches.hh:471
BasePairs__Arc Arc
arc
Definition: arc_matches.hh:39
size_t idx() const
Definition: basepairs.hh:88
abstract class that declares the method is_valid_match()
Definition: trace_controller.hh:147
Describes sequence and structure ensemble of an RNA.
Definition: basepairs.hh:107
long int score_t
type of the locarna score as defined by the class Scoring
Definition: scoring_fwd.hh:13
"Sequence View" of multiple alignment as array of column vectors
Definition: sequence.hh:29
Represents a match of two base pairs (arc match)
Definition: arc_matches.hh:35
Matrix< ArcMatchIdxVec > common_left_end_lists
for each (i,j) maintain vector of the indices of the arc matchs that share the common left end (i...
Definition: arc_matches.hh:170
size_type lenB
length of sequence B
Definition: arc_matches.hh:119
size_type i
position i
Definition: arc_matches.hh:224
const_iterator begin() const
begin of arc matches vector
Definition: arc_matches.hh:468
const BasePairs & get_base_pairsB() const
returns the base pairs object for RNA B
Definition: arc_matches.hh:340
bool maintain_explicit_scores
whether scores are maintained explicitely or computed from pair probabilities
Definition: arc_matches.hh:150