1 #ifndef EXACT_MATCHER_HH 2 #define EXACT_MATCHER_HH 14 #include "trace_controller.hh" 15 #include "sparsification_mapper.hh" 18 #include "ext_rna_data.hh" 22 # include <ViennaRNA/fold_vars.h> 23 # include <ViennaRNA/utils.h> 24 # include <ViennaRNA/PS_dot.h> 25 # include <ViennaRNA/fold.h> 26 int PS_rna_plot(
char *
string,
char *structure,
char *file);
27 int PS_rna_plot_a(
char *
string,
char *structure,
char *file,
char *pre,
char *post);
28 float fold(
const char *sequence,
char *structure);
34 typedef std::vector<unsigned int> intVec;
35 typedef std::pair<unsigned int,unsigned int> intPair;
36 typedef std::pair<intPair, intPair> intPPair;
37 typedef const intPPair* intPPairPTR;
38 typedef std::vector<intPPair>::const_iterator IntPPairCITER;
55 SinglePattern(
const std::string& myId_,
const std::string& seqId_,
const intVec& mySinglePattern_)
56 :myId(myId_),seqId(seqId_),pattern(mySinglePattern_)
68 const std::string&
getmyId()
const {
return myId; };
74 const std::string&
getseqId()
const {
return seqId; };
80 const intVec&
getPat()
const {
return pattern; };
106 : id(myId),first(myFirstPat),second(mySecPat), structure(structure_), EPMscore(score_)
108 if (first.getPat().size() != second.getPat().size()){
109 std::cerr <<
"Error! PatternPair cannot be constructed due to different sizes of SinglePatterns!" << std::endl;
112 size = first.getPat().size();
118 insideBounds.clear();
125 const std::string&
getId()
const {
return id; };
152 void setOutsideBounds(intPPair myPPair);
161 void addInsideBounds(intPPair myPPair);
173 void setEPMScore(
int myScore);
199 std::string structure;
202 std::vector<intPPair> insideBounds;
203 intPPair outsideBounds;
230 :patternList(myPairMap.patternList),
231 patternOrderedMap(myPairMap.patternOrderedMap),
232 idMap(myPairMap.idMap) { minPatternSize = 100000;};
245 void add(
const std::string&
id,
248 const std::string& structure,
256 void add(
const SelfValuePTR value);
259 void makeOrderedMap();
262 void updateFromMap();
269 const PatternPair& getPatternPair(
const std::string&
id)
const;
276 const SelfValuePTR getPatternPairPTR(
const std::string&
id)
const;
282 const patListTYPE& getList()
const;
288 const orderedMapTYPE& getOrderedMap()
const;
294 orderedMapTYPE& getOrderedMap2();
300 const int size()
const;
312 int getMapEPMScore();
322 patListTYPE patternList;
323 orderedMapTYPE patternOrderedMap;
324 PatternIdMapTYPE idMap;
358 matchedEPMs(myLCSEPM),
373 void MapToPS(
const std::string& sequenceA,
const std::string& sequenceB,
PatternPairMap& myMap,
const std::string& file1,
const std::string& file2);
376 void calculateLCSEPM(
bool quiet);
379 std::pair<SequenceAnnotation,SequenceAnnotation>
383 void output_locarna(
const std::string& sequenceA,
const std::string& sequenceB,
const std::string& outfile);
386 void output_clustal(
const std::string& outfile_name);
390 struct HoleCompare2 {
391 bool operator()(
const intPPairPTR & h1,
const intPPairPTR & h2)
const {
393 if (h1->first.second - h1->first.first-1 < h2->first.second - h2->first.first-1){
396 if (h1->first.second - h1->first.first-1 == h2->first.second - h2->first.first-1){
397 if ((h1->first.first == h2->first.first) && (h1->first.second == h2->first.second) &&
398 (h1->second.first==h2->second.first) && (h1->second.second==h2->second.second))
406 typedef std::multimap<intPPairPTR,PatternPairMap::SelfValuePTR,HoleCompare2> HoleOrderingMapTYPE2;
407 typedef HoleOrderingMapTYPE2::const_iterator HoleMapCITER2;
410 void preProcessing ();
411 void calculateHoles3 (
bool quiet);
412 void calculatePatternBoundaries (
PatternPair* myPair);
413 void calculateTraceback2 (
const int i,
const int j,
const int k,
const int l,std::vector < std::vector<int> > holeVec);
414 int D_rec2 (
const int& i,
const int& j,
const int& k,
const int& l,std::vector < std::vector<int> >& D_h,
const bool debug);
416 int max3 (
int a,
int b,
int c)
419 return (tmp>c? tmp:c);
423 char* getStructure(
PatternPairMap& myMap,
bool firstSeq,
int length);
425 std::string intvec2str(
const std::vector<unsigned int>& V,
const std::string &delim){
426 std::stringstream oss;
427 copy(V.begin(), V.end(), std::ostream_iterator<unsigned int>(oss, delim.c_str()));
430 if (tmpstr.length()>0) tmpstr.erase(tmpstr.end()-1);
434 std::string upperCase(
const std::string &seq){
436 for(
unsigned int i= 0; i<seq.length(); i++)
441 std::vector< std::vector <std::vector<PatternPairMap::SelfValuePTR> > > EPM_Table2;
442 HoleOrderingMapTYPE2 holeOrdering2;
480 sparse_mapperA(sparse_mapperA_),
481 sparse_mapperB(sparse_mapperB_)
491 return sparse_mapperA;
496 return sparse_mapperB;
509 matidx_t
min_col_idx(index_t indexA, index_t indexB, matidx_t idx_i,
510 index_t left_endB = std::numeric_limits<index_t>::max())
const{
513 return sparse_mapperB.
idx_geq(indexB,min_col(i),left_endB);
526 index_t left_endB = std::numeric_limits<index_t>::max())
const{
529 return sparse_mapperB.
idx_after_leq(indexB,max_col(i),left_endB);
544 matpos_t
diag_pos_bef(index_t indexA, index_t indexB,pair_seqpos_t cur_pos_seq,
545 index_t left_endA = std::numeric_limits<index_t>::max(), index_t left_endB = std::numeric_limits<index_t>::max())
const{
547 bool debug_valid_mat_pos =
false;
549 if(debug_valid_mat_pos) std::cout <<
"first valid mat pos before with tc " << std::endl;
551 seqpos_t i = cur_pos_seq.first;
552 seqpos_t j = cur_pos_seq.second;
554 matidx_t idx_after_max_col;
567 matidx_t min_col = min_col_idx(indexA,indexB,cur_row,left_endB);
568 idx_after_max_col = idx_after_max_col_idx(indexA,indexB,cur_row,left_endB);
570 if(debug_valid_mat_pos) std::cout <<
"interval " << min_col <<
"," << idx_after_max_col << std::endl;
573 if(min_col<idx_after_max_col && min_col<=col_before){
585 assert(idx_after_max_col>0);
587 matidx_t max_col = idx_after_max_col-1;
590 matpos_t result = matpos_t(cur_row,std::min(max_col,col_before));
592 assert(is_valid_idx_pos(indexA,indexB,result));
607 const matpos_t &cur_pos)
const{
625 matpos_t idx_pos_diag, pair_seqpos_t seq_pos_to_be_matched)
const{
626 pair_seqpos_t pos_diag = pos_in_seq(idxA,idxB,idx_pos_diag);
627 return (pos_diag.first+1 == seq_pos_to_be_matched.first) && (pos_diag.second+1==seq_pos_to_be_matched.second);
650 matpos_t mat_pos)
const{
651 pair_seqpos_t seq_pos = pos_in_seq(idxA,idxB,mat_pos);
652 return is_valid(seq_pos.first,seq_pos.second);
686 bool first_insertion;
690 PairArcIdxVec am_to_do;
693 struct compare_el_pat_vec {
697 seqpos_t el1_pos1 = el1.first;
698 seqpos_t el1_pos2 = el1.second;
699 seqpos_t el2_pos1 = el2.first;
700 seqpos_t el2_pos2 = el2.second;
701 char el1_struc = el1.
third;
702 char el2_struc = el2.
third;
703 return (el1_pos1 < el2_pos1) || (el1_pos1==el2_pos1 && el1_pos2 < el2_pos2)
704 || (el1_pos1==el2_pos1 && el1_pos2 == el2_pos2 && el1_struc<el2_struc);
709 struct compare_el_am_to_do {
713 return (el1.first<el2.first) || ((el1.first==el2.first) && el1.second < el2.second);
723 cur_pos(matpos_t(0,0)),
725 first_insertion(true),
800 const PairArcIdx&
get_am(PairArcIdxVec::size_type idx)
const{
801 assert(idx<am_to_do.size());
802 return am_to_do[idx];
818 PairArcIdxVec::const_iterator
am_begin()
const {
return am_to_do.begin();}
824 PairArcIdxVec::const_iterator
am_end()
const {
return am_to_do.end();}
832 assert(idx<pat_vec.size());
846 pat_vec_t::const_iterator
begin()
const{
return pat_vec.begin();}
852 pat_vec_t::const_iterator
end()
const{
return pat_vec.end();}
860 assert(!pat_vec.empty());
861 return pair_seqpos_t(pat_vec.back().first,pat_vec.back().second);
870 void add(seqpos_t posA,seqpos_t posB,
char c){pat_vec.push_back(el_pat_vec(posA,posB,c));}
879 void overwrite(seqpos_t posA,seqpos_t posB,
char c,pat_vec_t::size_type pos){
880 if(pat_vec.size()<=pos){pat_vec.push_back(el_pat_vec(posA,posB,c));}
881 pat_vec.at(pos)=el_pat_vec(posA,posB,c);
900 const PairArcIdx &pair_arc_idx = PairArcIdx(a.
idx(),b.
idx());
902 am_to_do.push_back(pair_arc_idx);
910 PairArcIdx arc_idx = am_to_do.back();
919 void sort_patVec(){sort(pat_vec.begin(), pat_vec.end(),compare_el_pat_vec());}
925 sort(am_to_do.begin(), am_to_do.end(), compare_el_am_to_do());
933 pat_vec.insert(pat_vec.end(),epm_to_insert.
begin(),epm_to_insert.
end());
944 return std::includes(this->begin(),this->end(),
945 epm_to_test.
begin(),epm_to_test.
end(),
946 compare_el_pat_vec());
956 return std::includes(am_begin(),am_end(),
958 compare_el_am_to_do());
967 out <<
"_________________________________________________" << std::endl;
968 out <<
"epm with score " << this->score << std::endl;
970 for(pat_vec_t::const_iterator it=pat_vec.begin();it!=pat_vec.end();++it){
971 out << it->first <<
":" << it->second <<
" ";
975 for(pat_vec_t::const_iterator it=pat_vec.begin();it!=pat_vec.end();++it){
979 out <<
"am_to_do " << am_to_do << std::endl;
980 out <<
"tolerance left " << this->max_tol_left << std::endl;
982 out <<
"score " << score << std::endl;
983 out <<
"pos " << this->cur_pos.first <<
"," << this->cur_pos.second << std::endl;
984 out <<
"state " << this->state << std::endl;
986 out <<
"______________________________________________________" << std::endl;
1020 T1
max3(
const T1 &first,
const T1 &second,
const T1 &third){
1021 return max(
max(first,second),third);
1033 T1
max4(
const T1 &first,
const T1 &second,
const T1 &third,
const T1 &fourth){
1034 return max(
max3(first,second,third),fourth);
1062 typedef std::list<EPM> epm_cont_t;
1063 typedef epm_cont_t::iterator epm_it_t;
1064 typedef std::pair<score_t,epm_cont_t > el_map_am_to_do_t;
1068 typedef unordered_map<PairArcIdx,el_map_am_to_do_t,pair_of_size_t_hash>::type map_am_to_do_t;
1109 int difference_to_opt_score;
1112 long int max_number_of_EPMs;
1113 long int cur_number_of_EPMs;
1115 bool inexact_struct_match;
1116 score_t struct_mismatch_score;
1121 pair_seqpos_t pos_of_max;
1123 enum{in_LR,in_G_A,in_G_AB,in_L,in_F};
1125 const Arc pseudo_arcA;
1126 const Arc pseudo_arcB;
1161 return Dmat(a.
idx(),b.
idx());
1174 return Dmat(a.
idx(),b.
idx());
1177 bool nucleotide_match(seqpos_t pos_seqA, seqpos_t pos_seqB)
const {
1178 assert(pos_seqA>=1 && pos_seqA<=seqA.
length() &&
1179 pos_seqB>=1 && pos_seqB<=seqB.
length());
1180 return (seqA[pos_seqA]==seqB[pos_seqB]);
1183 bool seq_matching(ArcIdx idxA, ArcIdx idxB, matpos_t cur_mat_pos, pair_seqpos_t cur_seq_pos)
const {
1184 seqpos_t i = cur_seq_pos.first;
1185 seqpos_t j = cur_seq_pos.second;
1187 return sparse_trace_controller.
pos_unpaired(idxA,idxB,cur_mat_pos) &&
1188 nucleotide_match(i,j);
1198 void initialize_gap_matrices();
1213 void init_mat(
ScoreMatrix &mat,
const Arc &a,
const Arc &b,
1226 pair_seqpos_t compute_LGLR(
const Arc &a,
const Arc &b,
bool suboptimal);
1240 infty_score_t compute_matrix_entry(
const Arc &a,
const Arc &b,matpos_t mat_pos,
1241 matpos_t mat_pos_diag,
bool matrixLR,
bool suboptimal);
1256 infty_score_t seq_str_matching(
const Arc &a,
const Arc &b, matpos_t mat_pos_diag,
1257 pair_seqpos_t seq_pos_to_be_matched,
score_t add_score,
bool matrixLR,
1271 score_t score_for_seq_match();
1281 infty_score_t score_for_am(
const Arc &a,
const Arc &b)
const;
1294 score_t score_for_stacking(
const Arc &a,
const Arc &b,
1295 const Arc &inner_a,
const Arc &inner_b);
1304 void add_foundEPM(
EPM &cur_epm,
bool count_EPMs);
1307 if(this->difference_to_opt_score != -1)
return true;
1309 if(cur_number_of_EPMs>=max_number_of_EPMs+1)
return false;
1320 void find_start_pos_for_tb(
bool suboptimal,
score_t difference_to_opt_score=-1,
bool count_EPMs=
false);
1322 bool check_num_EPMs(){
1323 double valid_deviation = 0.8;
1324 return (cur_number_of_EPMs>=max_number_of_EPMs*valid_deviation && cur_number_of_EPMs<=max_number_of_EPMs);
1349 void trace_LGLR_heuristic(
const Arc &a,
const Arc &b,
EPM &cur_epm);
1365 bool trace_seq_str_matching_heuristic(
const Arc &a,
const Arc &b,
int &state,
1366 matpos_t &cur_mat_pos, matpos_t mat_pos_diag,
1367 pair_seqpos_t seq_pos_to_be_matched,
score_t add_score);
1393 void apply_filter(epm_cont_t &found_epms);
1407 void trace_LGLR_suboptimal(
const Arc &a,
const Arc &b,
score_t max_tol,
1408 epm_cont_t &found_epms,
bool recurse,
bool count_EPMs);
1430 void trace_seq_str_matching_subopt(
const Arc &a,
const Arc &b,
1431 score_t score_contr, matpos_t mat_pos_diag, pair_seqpos_t seq_pos_to_be_matched,
1432 const PairArcIdx &am, poss_L_LR &poss, epm_it_t cur_epm, epm_cont_t &found_epms,
1433 map_am_to_do_t &map_am_to_do,
bool count_EPMs);
1451 bool check_poss(
const Arc &a,
const Arc &b,
const poss_L_LR &pot_new_poss,
1452 poss_L_LR &poss, epm_it_t cur_epm, epm_cont_t &found_epms,
1453 map_am_to_do_t &am_to_do_for_cur_am,
bool count_EPMs);
1472 void store_new_poss(
const Arc &a,
const Arc &b,
bool last_poss,
1473 const poss_L_LR &new_poss, poss_L_LR &poss, epm_it_t cur_epm,
1474 epm_cont_t &found_epms, map_am_to_do_t &am_to_do_for_cur_am,
bool count_EPMs);
1491 void trace_G_suboptimal(
const Arc &a,
const Arc &b,
const poss_L_LR &pot_new_poss,
1492 poss_L_LR &poss, epm_it_t cur_epm, epm_cont_t &found_epms,
1493 map_am_to_do_t &map_am_to_do,
bool count_EPMs);
1505 bool is_valid_gap(
const Arc &a,
const Arc &b,
1506 const poss_L_LR &pot_new_poss);
1523 void preproc_fill_epm(map_am_to_do_t &am_to_do, epm_it_t cur_epm,
1524 epm_cont_t &found_epms,
bool count_EPMs,
score_t min_allowed_score=-1);
1544 void fill_epm(
const map_am_to_do_t &map_am_to_do, size_type vec_idx,
1545 std::vector<score_t> &max_tol_left_up_to_pos, std::vector<const EPM*> &epms_to_insert,
1546 score_t min_score, epm_it_t cur_epm, epm_cont_t &found_epms,
bool count_EPMs);
1552 void print_matrices(
const Arc &a,
const Arc &b, size_type offset_A, size_type offset_B,
bool suboptimal,
bool add_info);
1555 bool validate_epm(
const EPM &epm_to_test)
const;
1559 bool validate_epm_list(epm_cont_t &found_epms)
const;
1596 score_t difference_to_opt_score_,
1598 long int max_number_of_EPMs_,
1599 bool inexact_struct_match_,
1600 score_t struct_mismatch_score_,
1609 void compute_arcmatch_score();
1612 void test_arcmatch_score();
1620 void trace_EPMs(
bool suboptimal);
1628 #endif // EXACT_MATCHER_HH manage a set of EPMs (PatternPair)
Definition: exact_matcher.hh:209
represent sparsified data of RNA ensemble
Definition: rna_data.hh:42
matidx_t idx_after_leq(index_t index, seq_pos_t max_col, index_t left_end=std::numeric_limits< index_t >::max()) const
Definition: sparsification_mapper.hh:299
bool is_invalid() const
Definition: exact_matcher.hh:752
size_t left() const
Definition: basepairs.hh:72
score_t get_score() const
returns the score of the EPM
Definition: exact_matcher.hh:736
bool includes_am(const EPM &epm_to_test) const
Definition: exact_matcher.hh:955
const SparsificationMapper & get_sparse_mapperA() const
destructor
Definition: exact_matcher.hh:490
combines the TraceController with the Mapper for both sequences
Definition: exact_matcher.hh:453
size_t right() const
Definition: basepairs.hh:80
const int getScore() const
Definition: exact_matcher.hh:179
std::ostream & operator<<(std::ostream &out, AlignerRestriction r)
Definition: aligner_restriction.hh:113
TaintedInftyInt max(const TaintedInftyInt &x, const TaintedInftyInt &y)
Definition: infty_int.hh:617
bool includes(const EPM &epm_to_test) const
Definition: exact_matcher.hh:942
SparseTraceController::matpos_t matpos_t
a type for a position in a sparsified matrix
Definition: exact_matcher.hh:667
const int & getSize() const
Definition: exact_matcher.hh:131
EPM()
Constructor.
Definition: exact_matcher.hh:720
SparsificationMapper::ArcIdx ArcIdx
arc index
Definition: exact_matcher.hh:668
const int getEPMScore() const
Definition: exact_matcher.hh:185
SinglePattern(const std::string &myId_, const std::string &seqId_, const intVec &mySinglePattern_)
constructor
Definition: exact_matcher.hh:55
stores a Pattern in one sequence
Definition: exact_matcher.hh:44
void add_am(const Arc &a, const Arc &b)
Definition: exact_matcher.hh:889
const intVec & getPat() const
Definition: exact_matcher.hh:80
bool is_valid_idx_pos(index_t idxA, index_t idxB, matpos_t mat_pos) const
checks whether a matrix position is valid
Definition: exact_matcher.hh:649
matidx_t min_col_idx(index_t indexA, index_t indexB, matidx_t idx_i, index_t left_endB=std::numeric_limits< index_t >::max()) const
minimal column of trace in a row in the sparsified matrix
Definition: exact_matcher.hh:509
orderedMapTYPE::iterator orderedMapITER
iterator for the map
Definition: exact_matcher.hh:217
size_type pos_type
type of a sequence position
Definition: aux.hh:97
pos_type seq_pos_t
type for a sequence position
Definition: sparsification_mapper.hh:41
const SinglePattern & getFirstPat() const
Definition: exact_matcher.hh:137
pat_vec_t::size_type pat_vec_size() const
Definition: exact_matcher.hh:840
const Arc & arcA() const
Definition: arc_matches.hh:66
void set_score(score_t score_)
Definition: exact_matcher.hh:764
const score_t & get_max_tol_left() const
returns the maximal tolerance that is left for the EPM
Definition: exact_matcher.hh:745
size_t size_type
general size type
Definition: aux.hh:94
pair_seqpos_t pos_in_seq(index_t idxA, index_t idxB, const matpos_t &cur_pos) const
maps the matrix position cur_pos to the corresponding pair of positions in sequence A and B ...
Definition: exact_matcher.hh:606
std::pair< matidx_t, matidx_t > matpos_t
a type for a position in a sparsified matrix
Definition: exact_matcher.hh:463
std::pair< ArcIdx, ArcIdx > PairArcIdx
pair of arc indices
Definition: exact_matcher.hh:670
SparsificationMapper::seq_pos_t seqpos_t
a type for a sequence position
Definition: exact_matcher.hh:666
const std::vector< intPPair > & getInsideBounds() const
Definition: exact_matcher.hh:167
const matpos_t & get_cur_pos() const
returns the current matrix position of the EPM
Definition: exact_matcher.hh:742
pair_seqpos_t last_matched_pos()
Definition: exact_matcher.hh:859
virtual ~SinglePattern()
Destructor.
Definition: exact_matcher.hh:62
BasePairs__Arc Arc
arc class of BasePairs
Definition: exact_matcher.hh:664
unordered_map< std::string, SelfValuePTR >::type PatternIdMapTYPE
map type patternId -> pointer to PatternPair
Definition: exact_matcher.hh:221
bool get_first_insertion() const
returns whether it is the first insertion into the EPM
Definition: exact_matcher.hh:748
Maintains the relevant arc matches and their scores.
Definition: arc_matches.hh:112
std::list< SelfValuePTR > patListTYPE
list of patternPairs
Definition: exact_matcher.hh:218
void insert_epm(const EPM &epm_to_insert)
Definition: exact_matcher.hh:932
std::vector< PairArcIdx > PairArcIdxVec
a vector of pairs of arc indices
Definition: exact_matcher.hh:671
orderedMapTYPE::const_iterator orderedMapCITER
const iterator for the map
Definition: exact_matcher.hh:216
std::vector< ArcIdx > ArcIdxVec
vector of arc indices
Definition: sparsification_mapper.hh:39
Definition: aligner.cc:17
const int getMinPatternSize() const
Definition: exact_matcher.hh:318
PairArcIdxVec::const_iterator am_end() const
Definition: exact_matcher.hh:824
size_t index_t
type for an index
Definition: sparsification_mapper.hh:49
const std::string & getId() const
Definition: exact_matcher.hh:125
patListTYPE::iterator patListITER
iterator for the list of PatternPairs
Definition: exact_matcher.hh:219
Represents a 3-tuple.
Definition: tuples.hh:17
bool pos_unpaired(index_t idx, matidx_t pos) const
Definition: sparsification_mapper.hh:226
void overwrite(seqpos_t posA, seqpos_t posB, char c, pat_vec_t::size_type pos)
Definition: exact_matcher.hh:879
std::pair< seqpos_t, seqpos_t > pair_seqpos_t
a type for a pair of positions in the sequences
Definition: exact_matcher.hh:464
SparseTraceController::pair_seqpos_t pair_seqpos_t
pair of positions in sequence A and B
Definition: exact_matcher.hh:669
pat_vec_t::const_iterator begin() const
Definition: exact_matcher.hh:846
Represents the mapping for sparsification.
Definition: sparsification_mapper.hh:34
seq_pos_t get_pos_in_seq_new(index_t idx, matidx_t pos) const
Definition: sparsification_mapper.hh:205
virtual ~EPM()
destructor
Definition: exact_matcher.hh:729
is able to manage an EPM, consists of 2 singlepatterns, one in each RNA
Definition: exact_matcher.hh:92
PatternPair(const std::string &myId, const SinglePattern &myFirstPat, const SinglePattern &mySecPat, const std::string &structure_, int &score_)
Constructor.
Definition: exact_matcher.hh:105
const intPPair getOutsideBounds() const
Definition: exact_matcher.hh:158
void set_state(int state_)
Definition: exact_matcher.hh:770
Represents a 5-tuple.
Definition: tuples.hh:64
Definition: infty_int.hh:344
Computes exact pattern matchings (EPM) between two RNA sequences.
Definition: exact_matcher.hh:1048
pos_type matidx_t
type for a matrix position
Definition: sparsification_mapper.hh:40
bool matching_wo_gap(index_t idxA, index_t idxB, matpos_t idx_pos_diag, pair_seqpos_t seq_pos_to_be_matched) const
is a EPM without a gap in between possible
Definition: exact_matcher.hh:624
const Arc & arcB() const
Definition: arc_matches.hh:74
pos_type length() const
Length of multiple aligment.
Definition: multiple_alignment.hh:624
void set_first_insertion(bool first_insertion_)
Definition: exact_matcher.hh:788
PairArcIdx next_arcmatch()
Definition: exact_matcher.hh:909
const std::string & getmyId() const
Definition: exact_matcher.hh:68
std::vector< el_pat_vec > pat_vec_t
type for pattern vector
Definition: exact_matcher.hh:676
el_pat_vec pat_vec_at(pat_vec_t::size_type idx) const
Definition: exact_matcher.hh:831
T3 third
third value
Definition: tuples.hh:19
virtual ~PatternPair()
Destructor.
Definition: exact_matcher.hh:116
void add(seqpos_t posA, seqpos_t posB, char c)
Definition: exact_matcher.hh:870
patListTYPE::const_iterator patListCITER
const iterator for the list of PatternPairs
Definition: exact_matcher.hh:220
const SinglePattern & getSecPat() const
Definition: exact_matcher.hh:143
T1 max4(const T1 &first, const T1 &second, const T1 &third, const T1 &fourth)
Definition: exact_matcher.hh:1033
matpos_t diag_pos_bef(index_t indexA, index_t indexB, pair_seqpos_t cur_pos_seq, index_t left_endA=std::numeric_limits< index_t >::max(), index_t left_endB=std::numeric_limits< index_t >::max()) const
computes the first valid matrix position before a sequence position considering the trace controller ...
Definition: exact_matcher.hh:544
const SparsificationMapper & get_sparse_mapperB() const
returns reference to sparsification mapper for sequence B
Definition: exact_matcher.hh:495
void set_max_tol_left(score_t tol)
Definition: exact_matcher.hh:782
void store_am(const Arc &a, const Arc &b)
Definition: exact_matcher.hh:899
bool operator<(const BasePairs::LeftAdjEntry &e1, const BasePairs::LeftAdjEntry &e2)
Definition: basepairs.cc:83
T1 max3(const T1 &first, const T1 &second, const T1 &third)
Definition: exact_matcher.hh:1020
pat_vec_t::const_iterator end() const
Definition: exact_matcher.hh:852
const PairArcIdx & get_am(PairArcIdxVec::size_type idx) const
Definition: exact_matcher.hh:800
void print_epm(std::ostream &out, bool verbose) const
Definition: exact_matcher.hh:966
bool pos_unpaired(index_t idxA, index_t idxB, matpos_t pos) const
checks whether the matrix position pos can be unpaired in both sequences
Definition: exact_matcher.hh:636
PatternPairMap(const PatternPairMap &myPairMap)
Definition: exact_matcher.hh:229
Represents a base pair.
Definition: basepairs.hh:40
Controls the matrix cells valid for traces.
Definition: trace_controller.hh:177
computes the best chain of EPMs, the LCS-EPM
Definition: exact_matcher.hh:339
const std::string & getseqId() const
Definition: exact_matcher.hh:74
size_t idx() const
Definition: basepairs.hh:88
matidx_t idx_after_max_col_idx(index_t indexA, index_t indexB, matidx_t idx_i, index_t left_endB=std::numeric_limits< index_t >::max()) const
index after maximal column of trace in a row in the sparsified matrix
Definition: exact_matcher.hh:525
size_t ArcIdx
type of arc index
Definition: sparsification_mapper.hh:38
Describes sequence and structure ensemble of an RNA.
Definition: basepairs.hh:107
triple< seqpos_t, seqpos_t, char > el_pat_vec
type for elements of the pattern vector, <position in seq A, position in sequence B...
Definition: exact_matcher.hh:674
LCSEPM(const Sequence &seqA_, const Sequence &seqB_, const PatternPairMap &myPatterns, PatternPairMap &myLCSEPM)
Definition: exact_matcher.hh:350
void set_invalid()
sets the flag invalid for the EPM
Definition: exact_matcher.hh:791
PatternPair selfValueTYPE
PatternPair.
Definition: exact_matcher.hh:212
long int score_t
type of the locarna score as defined by the class Scoring
Definition: scoring_fwd.hh:13
PatternPair * SelfValuePTR
pointer to PatternPair
Definition: exact_matcher.hh:213
int get_state() const
return the current matrix state of the EPM
Definition: exact_matcher.hh:739
const std::string & get_struct() const
Definition: exact_matcher.hh:191
PairArcIdxVec::size_type number_of_am()
Definition: exact_matcher.hh:809
void set_cur_pos(matpos_t cur_pos_)
Definition: exact_matcher.hh:776
"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
PairArcIdxVec::const_iterator am_begin() const
Definition: exact_matcher.hh:818
a class for the representation of exact pattern matches (EPM)
Definition: exact_matcher.hh:661
std::multimap< int, SelfValuePTR, std::greater< int > > orderedMapTYPE
ordered map type
Definition: exact_matcher.hh:215
void clear_am_to_do()
deletes the list am_to_do
Definition: exact_matcher.hh:812
void sort_am_to_do()
Definition: exact_matcher.hh:924
matidx_t first_valid_mat_pos_before(index_t index, seq_pos_t pos, index_t left_end=std::numeric_limits< index_t >::max()) const
Definition: sparsification_mapper.hh:191
matidx_t idx_geq(index_t index, seq_pos_t min_col, index_t left_end=std::numeric_limits< index_t >::max()) const
Definition: sparsification_mapper.hh:268
void sort_patVec()
Definition: exact_matcher.hh:919
SparseTraceController(const SparsificationMapper &sparse_mapperA_, const SparsificationMapper &sparse_mapperB_, const TraceController &trace_controller_)
constructor
Definition: exact_matcher.hh:478