1 #ifndef LOCARNA_ANCHOR_CONSTRAINTS_HH
2 #define LOCARNA_ANCHOR_CONSTRAINTS_HH
111 std::vector<std::string> seqCA,
113 std::vector<std::string> seqCB,
129 const std::string &seqCA,
131 const std::string &seqCB,
160 assert(i < ar_.size());
161 return ar_[i].first <= j && j <= ar_[i].second;
197 names_a_[ i0 ] < names_b_[ j0 ]
199 names_a_[ i1 ] > names_b_[ j1 ];
201 return !conflicts_anchor(i,j);
212 assert(1<=i); assert(i<=lenA_);
214 return adr_[i].first<=j && j<=adr_[i].second;
236 names_a_[ i0 ] < names_b_[ j0 ]
238 names_a_[ i1 ] > names_b_[ j1 ];
240 return !conflicts_anchor(i,j);
252 assert(1<=j); assert(j<=lenB_);
253 return air_[j].first<=i && i<=air_[j].second;
289 if (anchors_a_[i] > 0)
304 if (anchors_a_[i] > 0)
318 return is_anchored(lenA_,anchors_a_,i);
327 return is_anchored(lenB_,anchors_b_,i);
337 return is_named(lenA_,anchors_a_,i);
346 return is_named(lenB_,anchors_b_,i);
355 typedef std::map<std::string, size_type> name_tab_t;
356 typedef std::vector<int> int_vec_t;
357 typedef std::vector<size_type> size_vec_t;
358 typedef std::vector<std::string> name_vec_t;
359 typedef std::vector<range_t> range_vec_t;
378 int_vec_t anchors_a_;
381 int_vec_t anchors_b_;
411 size_vec_t max_anchored_left_a_;
417 size_vec_t min_anchored_right_a_;
423 size_vec_t max_named_leq_a_;
429 size_vec_t min_named_geq_a_;
432 size_vec_t max_anchored_left_b_;
435 size_vec_t min_anchored_right_b_;
438 size_vec_t max_named_leq_b_;
441 size_vec_t min_named_geq_b_;
454 return i==0 || i==len+1 || anchors[i]!=0;
469 return i==0 || i==len+1 || anchors[i]>0;
488 !(
static_cast<size_type>(anchors_a_[ max_anchored_left_a_[i] ]) < j
490 j <
static_cast<size_type>(anchors_a_[ min_anchored_right_a_[i] ])) ;
527 transform_input(name_tab_t &nameTab,
529 const std::vector<std::string> &seq,
553 init_tables(
const name_tab_t &nameTabA,
const name_tab_t &nameTabB);
565 void static init_anchored_tables(
size_type len,
566 const int_vec_t &anchors,
567 size_vec_t &max_anchored_left,
568 size_vec_t &min_anchored_right);
580 void static init_named_tables(
size_type len,
581 const int_vec_t &anchors,
582 size_vec_t &max_named_leq,
583 size_vec_t &min_named_geq);
600 init_anchors(int_vec_t &seq_tab,
601 name_vec_t &name_vec_tab,
602 const name_tab_t &nameTabA,
603 const name_tab_t &nameTabB);
608 only_dont_care(
const std::string &s);
Represents anchor constraints between two sequences.
Definition: anchor_constraints.hh:66
std::pair< size_type, size_type > size_pair_t
size pair
Definition: anchor_constraints.hh:69
std::string get_name_b(size_type j) const
get the name of position j in B
Definition: anchor_constraints.hh:264
bool allowed_del_unopt(size_type i, size_type j) const
is deletion allowed? (unoptimized)
Definition: anchor_constraints.hh:184
bool is_named_a(size_type i) const
Is position in A named?
Definition: anchor_constraints.hh:336
bool allowed_match(size_type i, size_type j) const
is match allowed
Definition: anchor_constraints.hh:158
size_type name_size() const
returns length/size of the names
Definition: anchor_constraints.hh:270
bool allowed_del(size_type i, size_type j) const
is deletion allowed?
Definition: anchor_constraints.hh:211
bool allowed_ins_unopt(size_type i, size_type j) const
is insertion allowed? (unoptimized)
Definition: anchor_constraints.hh:223
bool is_named_b(size_type i) const
Is position in B named?
Definition: anchor_constraints.hh:345
size_pair_t rightmost_anchor() const
Get rightmost anchor.
Definition: anchor_constraints.hh:287
size_pair_t leftmost_anchor() const
Get leftmost anchor.
Definition: anchor_constraints.hh:302
bool is_anchored_b(size_type i) const
Is position in B anchored?
Definition: anchor_constraints.hh:326
size_t size_type
size type
Definition: anchor_constraints.hh:68
bool allowed_ins(size_type i, size_type j) const
is insertion allowed?
Definition: anchor_constraints.hh:250
std::string get_name_a(size_type i) const
get the name of position i in A
Definition: anchor_constraints.hh:258
void print_debug()
write some debug information to stderr
size_pair_t range_t
type of range
Definition: anchor_constraints.hh:71
AnchorConstraints(size_type lenA, std::vector< std::string > seqCA, size_type lenB, std::vector< std::string > seqCB, bool strict)
Construct from sequence lengths and anchor names.
Definition: anchor_constraints.cc:12
bool empty() const
is the constraint declaration empty
Definition: anchor_constraints.hh:276
bool is_anchored_a(size_type i) const
Is position in A anchored?
Definition: anchor_constraints.hh:317
Definition: aligner.cc:15
size_t size_type
general size type
Definition: aux.hh:120