1 #ifndef LOCARNA_ARC_MATCHES_HH
2 #define LOCARNA_ARC_MATCHES_HH
10 #include <unordered_map>
12 #include "scoring_fwd.hh"
15 #include "basepairs.hh"
23 class AnchorConstraints;
24 class TraceController;
25 class MatchController;
198 : arc_matches(arc_matches_) {}
218 return (ali > alj) || (ali == alj && bli > blj);
251 :
i(i_),
j(j_),
k(k_),
l(l_),
score(score_) {}
279 const std::string &arcmatch_scores_file,
280 int probability_scale,
336 int probability_scale);
443 bool no_lonely_pairs)
const;
540 const std::string &arcmatch_scores_file,
541 int probability_scale,
548 arcmatch_scores_file,
555 build_arcmatch_index();
594 build_arcmatch_index();
599 typedef std::pair<size_type, size_type> idx_pair_t;
602 typedef std::unordered_map<idx_pair_t, ArcMatch::idx_type>
606 am_index_type am_index_;
613 build_arcmatch_index();
645 am_index_type::const_iterator it =
646 am_index_.find(idx_pair_t(arcAIdx, arcBIdx));
647 if (am_index_.end() != it) {
Represents anchor constraints between two sequences.
Definition: anchor_constraints.hh:66
Represents a match of two base pairs (arc match)
Definition: arc_matches.hh:35
const Arc & arcB() const
Definition: arc_matches.hh:72
BasePairs__Arc Arc
arc
Definition: arc_matches.hh:39
ArcMatch(const Arc *arcA, const Arc *arcB, idx_type idx)
Definition: arc_matches.hh:53
idx_type idx() const
Definition: arc_matches.hh:82
std::vector< int >::size_type size_type
size type
Definition: arc_matches.hh:37
size_type idx_type
arc match index
Definition: arc_matches.hh:38
const Arc & arcA() const
Definition: arc_matches.hh:62
class ArcMatches with additional mapping
Definition: arc_matches.hh:514
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:644
const ArcMatch & am_index(const Arc &arcA, const Arc &arcB) const
Lookup arc match by pair of arcs.
Definition: arc_matches.hh:664
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:579
const ArcMatch::idx_type invalid_am_index() const
the invalid arc match index
Definition: arc_matches.hh:625
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:538
Definition: arc_matches.hh:188
bool operator()(const ArcMatch::idx_type &i, const ArcMatch::idx_type &j) const
Compare to arc matches.
Definition: arc_matches.hh:211
lex_greater_left_ends(const ArcMatches &arc_matches_)
Definition: arc_matches.hh:197
Definition: arc_matches.hh:226
size_type k
position k
Definition: arc_matches.hh:232
size_type j
position j
Definition: arc_matches.hh:231
tuple5(size_type i_, size_type j_, size_type k_, size_type l_, score_t score_)
Definition: arc_matches.hh:246
std::vector< int >::size_type size_type
size type
Definition: arc_matches.hh:228
size_type i
position i
Definition: arc_matches.hh:230
score_t score
Definition: arc_matches.hh:234
size_type l
position l
Definition: arc_matches.hh:233
Maintains the relevant arc matches and their scores.
Definition: arc_matches.hh:116
size_type num_arc_matches() const
total number of arc matches
Definition: arc_matches.hh:388
const BasePairs & get_base_pairsA() const
returns the base pairs object for RNA A
Definition: arc_matches.hh:349
const_iterator begin() const
begin of arc matches vector
Definition: arc_matches.hh:496
ArcMatches(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.cc:112
void get_min_right_ends(size_type al, size_type bl, size_type *min_ar, size_type *min_br) const
Definition: arc_matches.cc:358
Matrix< ArcMatchIdxVec > common_left_end_lists
Definition: arc_matches.hh:177
bool maintain_explicit_scores
Definition: arc_matches.hh:155
size_type max_diff_at_am
for max diff at arc matches heuristics
Definition: arc_matches.hh:131
BasePairs * bpsA
base pairs of RNA A
Definition: arc_matches.hh:124
Matrix< ArcMatchIdxVec > common_right_end_lists
Definition: arc_matches.hh:173
std::vector< score_t > scores
vector of scores (of arc matches with the same index)
Definition: arc_matches.hh:169
const AnchorConstraints & constraints
for constraints
Definition: arc_matches.hh:136
bool is_valid_arcmatch(const Arc &arcA, const Arc &arcB) const
Definition: arc_matches.cc:20
void make_scores_explicit(const Scoring &scoring)
Make arcmatch scores explicit.
Definition: arc_matches.cc:373
void write_arcmatch_scores(const std::string &arcmatch_scores_file, const Scoring &scoring) const
Definition: arc_matches.cc:285
const ArcMatch & inner_arc_match(const ArcMatch &am) const
Definition: arc_matches.hh:475
const BasePairs & get_base_pairsB() const
returns the base pairs object for RNA B
Definition: arc_matches.hh:355
bool exists_inner_arc_match(const ArcMatch &am) const
Definition: arc_matches.hh:465
void read_arcmatch_scores(const std::string &arcmatch_scores_file, int probability_scale)
Reads scores for arc matches.
Definition: arc_matches.cc:191
void init_inner_arc_matchs()
initialize the vector of inner arc match indices
Definition: arc_matches.cc:51
const MatchController & match_controller
Definition: arc_matches.hh:133
ArcMatchVec arc_matches_vec
vector of all maintained arc matches
Definition: arc_matches.hh:160
const_iterator end() const
end of arc matches vector
Definition: arc_matches.hh:502
size_type lenA
length of sequence A
Definition: arc_matches.hh:121
size_type lenB
length of sequence B
Definition: arc_matches.hh:122
ArcMatchVec::const_iterator const_iterator
const iterator over arc matches
Definition: arc_matches.hh:492
const ArcMatch & arcmatch(size_type idx) const
get arc match by its index
Definition: arc_matches.hh:394
void sort_right_adjacency_lists()
Definition: arc_matches.cc:77
size_type max_length_diff
for max-diff-am heuristics
Definition: arc_matches.hh:129
score_t get_score(const ArcMatch &am) const
Definition: arc_matches.hh:381
std::vector< int >::size_type size_type
size
Definition: arc_matches.hh:118
void get_max_right_ends(size_type al, size_type bl, size_type *max_ar, size_type *max_br, bool no_lonely_pairs) const
get the maximal right ends of any arc match with left ends (al,bl).
Definition: arc_matches.cc:314
ArcMatchIdxVec inner_arcmatch_idxs
vector of indices of inner arc matches
Definition: arc_matches.hh:180
bool explicit_scores() const
Definition: arc_matches.hh:362
BasePairs__Arc Arc
arc
Definition: arc_matches.hh:119
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:411
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:405
size_type number_of_arcmatches
Definition: arc_matches.hh:166
BasePairs * bpsB
base pairs of RNA B
Definition: arc_matches.hh:125
~ArcMatches()
clean up base pair objects
Definition: arc_matches.cc:14
Represents a base pair.
Definition: basepairs.hh:39
size_t idx() const
Definition: basepairs.hh:87
size_t left() const
Definition: basepairs.hh:67
Describes sequence and structure ensemble of an RNA.
Definition: basepairs.hh:108
abstract class that declares the method is_valid_match()
Definition: trace_controller.hh:175
represent sparsified data of RNA ensemble
Definition: rna_data.hh:44
Provides methods for the scoring of alignments.
Definition: scoring.hh:271
"Sequence View" of multiple alignment as array of column vectors
Definition: sequence.hh:17
Definition: aligner.cc:15
std::vector< ArcMatch::idx_type > ArcMatchIdxVec
Vector of arc match indices.
Definition: arc_matches.hh:91
std::vector< ArcMatch > ArcMatchVec
Vector of arc matches.
Definition: arc_matches.hh:88
size_t size_type
general size type
Definition: aux.hh:120
long int score_t
type of the locarna score as defined by the class Scoring
Definition: scoring_fwd.hh:13