SeqAn3  3.0.3
The Modern C++ library for sequence analysis.
gap_decorator.hpp
Go to the documentation of this file.
1 // -----------------------------------------------------------------------------------------------------
2 // Copyright (c) 2006-2020, Knut Reinert & Freie Universität Berlin
3 // Copyright (c) 2016-2020, Knut Reinert & MPI für molekulare Genetik
4 // This file may be used, modified and/or redistributed under the terms of the 3-clause BSD-License
5 // shipped with this file and also available at: https://github.com/seqan/seqan3/blob/master/LICENSE.md
6 // -----------------------------------------------------------------------------------------------------
7 
14 #pragma once
15 
16 #include <seqan3/std/algorithm>
17 #include <limits>
18 #include <seqan3/std/ranges>
19 #include <set>
20 #include <tuple>
21 #include <type_traits>
22 
31 
32 namespace seqan3
33 {
34 
80 template <std::ranges::viewable_range inner_type>
82  requires std::ranges::random_access_range<inner_type> && std::ranges::sized_range<inner_type> &&
83  (std::is_const_v<std::remove_reference_t<inner_type>> || std::ranges::view<inner_type>)
86 {
87 private:
88  // Declaration of class's iterator types; for the definition see below.
90 
96 
98  using ungapped_view_type = decltype(views::type_reduce(std::declval<inner_type &&>()));
99 
100 public:
109 
115 
122 
127  using size_type = std::ranges::range_size_t<inner_type>;
128 
133  using difference_type = std::ranges::range_difference_t<inner_type>;
135 
140  using unaligned_seq_type = inner_type;
141 
152  gap_decorator() = default;
153  gap_decorator(gap_decorator const &) = default;
154  gap_decorator & operator=(gap_decorator const &) = default;
155  gap_decorator(gap_decorator && rhs) = default;
156  gap_decorator & operator=(gap_decorator && rhs) = default;
157  ~gap_decorator() = default;
158 
163  template <typename other_range_t>
165  requires (!std::same_as<other_range_t, gap_decorator>) &&
166  std::same_as<std::remove_cvref_t<other_range_t>, std::remove_cvref_t<inner_type>> &&
167  std::ranges::viewable_range<other_range_t> // at end, otherwise it competes with the move ctor
169  gap_decorator(other_range_t && range) : ungapped_view{views::type_reduce(std::forward<inner_type>(range))}
170  {} // TODO (@smehringer) only works for copyable views. Has to be changed once views are not required to be copyable anymore.
171  // !\}
172 
186  size_type size() const
187  {
188  if (anchors.size())
189  return anchors.rbegin()->second + ungapped_view.size();
190 
191  return ungapped_view.size();
192  }
193 
210  {
211  if (!count) // [[unlikely]]
212  return it;
213 
214  size_type const pos = it - begin();
215  assert(pos <= size());
216 
217  set_iterator_type it_set = anchors.upper_bound(anchor_gap_t{pos, bound_dummy});
218 
219  if (it_set == anchors.begin()) // will also catch if anchors is empty since begin() == end()
220  {
221  anchors.emplace_hint(anchors.begin(), anchor_gap_t{pos, count});
222  }
223  else // there are gaps before pos
224  {
225  --it_set;
226  auto gap_len{it_set->second};
227  if (it_set != anchors.begin())
228  gap_len -= (*(std::prev(it_set))).second;
229 
230  if (it_set->first + gap_len >= pos) // extend existing gap
231  {
232  anchor_gap_t gap{it_set->first, it_set->second + count};
233  it_set = anchors.erase(it_set);
234  anchors.insert(it_set, gap);
235  }
236  else // insert new gap
237  {
238  anchor_gap_t gap{pos, it_set->second + count};
239  ++it_set;
240  anchors.insert(it_set, gap);
241  }
242  }
243 
244  // post-processing: reverse update of succeeding gaps
245  rupdate(pos, count);
246  return iterator{*this, pos};
247  }
248 
263  {
264  // check if [it, it+gap_len[ covers [first, last[
265  if ((*it) != gap{}) // [[unlikely]]
266  throw gap_erase_failure("The range to be erased does not correspond to a consecutive gap.");
267 
268  return erase_gap(it, std::next(it));
269  }
270 
287  {
288  size_type const pos1 = first - begin();
289  size_type const pos2 = last - begin();
290  set_iterator_type it = anchors.upper_bound(anchor_gap_t{pos1, bound_dummy}); // first element greater than pos1
291 
292  if (it == anchors.begin())
293  throw gap_erase_failure{"There is no gap to erase in range [" + std::to_string(pos1) + "," +
294  std::to_string(pos2) + "]."};
295 
296  --it;
297  size_type const gap_len = gap_length(it);
298 
299  // check if [it, it+gap_len[ covers [first, last[
300  if ((it->first + gap_len) < pos2) // [[unlikely]]
301  {
302  throw gap_erase_failure{"The range to be erased does not correspond to a consecutive gap."};
303  }
304  // case 1: complete gap is deleted
305  else if (gap_len == pos2 - pos1)
306  {
307  it = anchors.erase(it);
308  }
309  // case 2: gap to be deleted in tail or larger than 1 (equiv. to shift tail left, i.e. pos remains unchanged)
310  else
311  {
312  anchor_gap_t gap{it->first, it->second - pos2 + pos1};
313  it = anchors.erase(it);
314  it = anchors.insert(it, gap); // amortized constant because of hint
315  ++it; // update node after the current
316  }
317 
318  // post-processing: forward update of succeeding gaps
319  update(it, pos2 - pos1);
320 
321  return iterator{*this, pos1};
322  }
323 
331  template <typename unaligned_seq_t> // generic template to use forwarding reference
333  requires std::assignable_from<gap_decorator &, unaligned_seq_t>
335  friend void assign_unaligned(gap_decorator & dec, unaligned_seq_t && unaligned)
336  {
337  dec = unaligned;
338  }
340 
359  const_iterator begin() const noexcept
360  {
361  return iterator{*this};
362  }
363 
365  const_iterator cbegin() const noexcept
366  {
367  return const_iterator{*this};
368  }
369 
385  const_iterator end() const noexcept
386  {
387  return iterator{*this, size()};
388  }
389 
391  const_iterator cend() const noexcept
392  {
393  return const_iterator{*this, size()};
394  }
396 
415  {
416  if (i >= size()) // [[unlikely]]
417  throw std::out_of_range{"Trying to access element behind the last in gap_decorator."};
418  return (*this)[i];
419  }
420 
422  const_reference at(size_type const i) const
423  {
424  if (i >= size()) // [[unlikely]]
425  throw std::out_of_range{"Trying to access element behind the last in gap_decorator."};
426  return (*this)[i];
427  }
428 
442  {
443  return *iterator{*this, i};
444  }
446 
470  friend bool operator==(gap_decorator const & lhs, gap_decorator const & rhs)
471  {
472  if (lhs.size() == rhs.size() &&
473  lhs.anchors == rhs.anchors &&
474  std::ranges::equal(lhs.ungapped_view, rhs.ungapped_view))
475  {
476  return true;
477  }
478 
479  return false;
480  }
481 
486  friend bool operator!=(gap_decorator const & lhs, gap_decorator const & rhs)
487  {
488  return !(lhs == rhs);
489  }
490 
495  friend bool operator<(gap_decorator const & lhs, gap_decorator const & rhs)
496  {
497  auto lit = lhs.begin();
498  auto rit = rhs.begin();
499 
500  while (lit != lhs.end() && rit != rhs.end() && *lit == *rit)
501  ++lit, ++rit;
502 
503  if (rit == rhs.end())
504  return false; // lhs == rhs, or rhs prefix of lhs
505  else if (lit == lhs.end())
506  return true; // lhs prefix of rhs
507 
508  return *lit < *rit;
509  }
510 
515  friend bool operator<=(gap_decorator const & lhs, gap_decorator const & rhs)
516  {
517  auto lit = lhs.begin();
518  auto rit = rhs.begin();
519 
520  while (lit != lhs.end() && rit != rhs.end() && *lit == *rit)
521  ++lit, ++rit;
522 
523  if (lit == lhs.end())
524  return true; // lhs == rhs, or lhs prefix of rhs
525  else if (rit == rhs.end())
526  return false; // rhs prefix of lhs
527 
528  return *lit < *rit;
529  }
530 
535  friend bool operator>(gap_decorator const & lhs, gap_decorator const & rhs)
536  {
537  return !(lhs <= rhs);
538  }
539 
544  friend bool operator>=(gap_decorator const & lhs, gap_decorator const & rhs)
545  {
546  return !(lhs < rhs);
547  }
549 
550 private:
553 
556 
558  using set_iterator_type = typename anchor_set_type::iterator;
559 
561  constexpr static size_t bound_dummy{std::numeric_limits<size_t>::max()};
562 
576  {
577  return (it == anchors.begin()) ? it->second : it->second - (*std::prev(it)).second;
578  }
579 
592  void rupdate(size_type const pos, size_type const offset)
593  {
594  for (auto it = std::prev(anchors.end(), 1); it->first > pos;)
595  {
596  anchors.emplace_hint(it, anchor_gap_t{it->first + offset, it->second + offset});
597  anchors.erase(*it--);
598  }
599  }
600 
613  void update(set_iterator_type it, size_type const offset)
614  {
615  while (it != anchors.end())
616  {
617  anchor_gap_t gap{it->first - offset, it->second - offset};
618  it = anchors.erase(it);
619  it = anchors.insert(it, gap);
620  ++it;
621  }
622  }
623 
625  ungapped_view_type ungapped_view{};
626 
628  anchor_set_type anchors{};
629 };
630 
638 template <std::ranges::viewable_range urng_t>
640  requires (!std::ranges::view<std::remove_reference_t<urng_t>>)
642 gap_decorator(urng_t && range) -> gap_decorator<std::remove_reference_t<urng_t> const &>;
643 
648 template <std::ranges::view urng_t>
649 gap_decorator(urng_t range) -> gap_decorator<urng_t>;
651 
668 template <std::ranges::viewable_range inner_type>
670  requires std::ranges::random_access_range<inner_type> && std::ranges::sized_range<inner_type> &&
671  (std::is_const_v<std::remove_reference_t<inner_type>> || std::ranges::view<inner_type>)
674 {
675 protected:
679  typename gap_decorator::size_type pos{0u};
681  int64_t ungapped_view_pos{0}; // must be signed because we need this value to be -1 in case of leading gaps.
684  typename gap_decorator::size_type left_gap_end{0};
687  typename gap_decorator::set_iterator_type anchor_set_it{};
689  bool is_at_gap{true};
690 
692  void jump(typename gap_decorator::size_type const new_pos)
693  {
694  assert(new_pos <= host->size());
695  pos = new_pos;
696 
697  anchor_set_it = host->anchors.upper_bound(anchor_gap_t{pos, host->bound_dummy});
698  ungapped_view_pos = pos;
699 
700  if (anchor_set_it != host->anchors.begin())
701  {
702  typename gap_decorator::set_iterator_type prev{std::prev(anchor_set_it)};
703  size_type gap_len{prev->second};
704 
705  if (prev != host->anchors.begin())
706  gap_len -= std::prev(prev)->second;
707 
708  ungapped_view_pos -= prev->second;
709  left_gap_end = prev->first + gap_len;
710  }
711 
712  if (ungapped_view_pos != static_cast<int64_t>(host->ungapped_view.size()) &&
713  pos >= left_gap_end && (anchor_set_it == host->anchors.end() || pos < anchor_set_it->first))
714  is_at_gap = false;
715  else
716  is_at_gap = true;
717  }
718 
719 public:
730  using pointer = value_type *;
734 
744 
746  explicit gap_decorator_iterator(gap_decorator const & host_) :
747  host(&host_), anchor_set_it{host_.anchors.begin()}
748  {
749  if (host_.anchors.size() && (*host_.anchors.begin()).first == 0) // there are gaps at the very front
750  {
751  --ungapped_view_pos; // set ungapped_view_pos to -1 so operator++ works without an extra if-branch.
752  left_gap_end = anchor_set_it->second;
753  ++anchor_set_it;
754  }
755  else
756  {
757  is_at_gap = false;
758  }
759  }
760 
762  gap_decorator_iterator(gap_decorator const & host_, typename gap_decorator::size_type const pos_) : host(&host_)
763  {
764  jump(pos_); // random access to pos
765  }
767 
773  {
774  assert(host); // host is set
775  ++pos;
776 
777  if (pos < left_gap_end) // we stay within the preceding gap stretch
778  return *this;
779 
780  if (anchor_set_it == host->anchors.end() || pos < anchor_set_it->first)
781  { // proceed within the view since we are right of the previous gap but didn't arrive at the right gap yet
782  ++ungapped_view_pos;
783  if (ungapped_view_pos != static_cast<int64_t>(host->ungapped_view.size()))
784  is_at_gap = false;
785  }
786  else
787  { // we arrived at the right gap and have to update the variables. ungapped_view_pos remains unchanged.
788  left_gap_end = anchor_set_it->first + anchor_set_it->second -
789  ((anchor_set_it != host->anchors.begin()) ? (std::prev(anchor_set_it))->second : 0);
790  ++anchor_set_it;
791  is_at_gap = true;
792 
793  if (left_gap_end == host->size()) // very last gap
794  ++ungapped_view_pos;
795  }
796 
797  return *this;
798  }
799 
802  {
803  gap_decorator_iterator cpy{*this};
804  ++(*this);
805  return cpy;
806  }
807 
810  {
811  this->jump(this->pos + skip);
812  return *this;
813  }
814 
817  {
818  return gap_decorator_iterator{*(this->host), this->pos + skip};
819  }
820 
823  {
824  return it + skip;
825  }
826 
829  {
830  assert(host); // host is set
831  --pos;
832 
833  if (pos < left_gap_end)
834  { // there was no gap before but we arrive at the left gap and have to update the variables.
835  (anchor_set_it != host->anchors.begin()) ? --anchor_set_it : anchor_set_it;
836 
837  if (anchor_set_it != host->anchors.begin())
838  {
839  auto prev = std::prev(anchor_set_it);
840  left_gap_end = prev->first + prev->second -
841  ((prev != host->anchors.begin()) ? std::prev(prev)->second : 0);
842  }
843  else // [[unlikely]]
844  {
845  left_gap_end = 0;
846  }
847  is_at_gap = true;
848  }
849  else if (anchor_set_it == host->anchors.end() || pos < anchor_set_it->first)
850  { // we are neither at the left nor right gap
851  --ungapped_view_pos;
852  is_at_gap = false;
853  }
854  // else -> no op (we are still within the right gap stretch)
855 
856  return *this;
857  }
858 
861  {
862  gap_decorator_iterator cpy{*this};
863  --(*this);
864  return cpy;
865  }
866 
869  {
870  this->jump(this->pos - skip);
871  return *this;
872  }
873 
876  {
877  return gap_decorator_iterator{*(this->host), this->pos - skip};
878  }
879 
882  {
883  return it - skip;
884  }
885 
888  {
889  return static_cast<difference_type>(this->pos - lhs.pos);
890  }
892 
898  {
899  return (is_at_gap) ? reference{gap{}} : reference{host->ungapped_view[ungapped_view_pos]};
900  }
901 
904  {
905  return *(*this + n);
906  }
908 
915  friend bool operator==(gap_decorator_iterator const & lhs, gap_decorator_iterator const & rhs) noexcept
916  {
917  return lhs.pos == rhs.pos;
918  }
919 
921  friend bool operator!=(gap_decorator_iterator const & lhs, gap_decorator_iterator const & rhs) noexcept
922  {
923  return lhs.pos != rhs.pos;
924  }
925 
927  friend bool operator<(gap_decorator_iterator const & lhs, gap_decorator_iterator const & rhs) noexcept
928  {
929  return lhs.pos < rhs.pos;
930  }
931 
933  friend bool operator>(gap_decorator_iterator const & lhs, gap_decorator_iterator const & rhs) noexcept
934  {
935  return lhs.pos > rhs.pos;
936  }
937 
939  friend bool operator<=(gap_decorator_iterator const & lhs, gap_decorator_iterator const & rhs) noexcept
940  {
941  return lhs.pos <= rhs.pos;
942  }
943 
945  friend bool operator>=(gap_decorator_iterator const & lhs, gap_decorator_iterator const & rhs) noexcept
946  {
947  return lhs.pos >= rhs.pos;
948  }
950 };
951 
952 } // namespace seqan
Adaptations of algorithms from the Ranges TS.
Includes customized exception types for the alignment module .
Core alphabet concept and free function/type trait wrappers.
T begin(T... args)
A combined alphabet that can hold values of either of its alternatives.
Definition: alphabet_variant.hpp:132
The iterator type over a seqan3::gap_decorator.
Definition: gap_decorator.hpp:674
friend bool operator<=(gap_decorator_iterator const &lhs, gap_decorator_iterator const &rhs) noexcept
Checks whether *this is less than or equal to rhs.
Definition: gap_decorator.hpp:939
reference operator*() const
Dereference operator returns a copy of the element currently pointed at.
Definition: gap_decorator.hpp:897
gap_decorator_iterator & operator--()
Decrements iterator.
Definition: gap_decorator.hpp:828
gap_decorator_iterator & operator=(gap_decorator_iterator const &)=default
Defaulted.
typename gap_decorator::difference_type difference_type
The difference type.
Definition: gap_decorator.hpp:724
gap_decorator_iterator & operator=(gap_decorator_iterator &&)=default
Defaulted.
friend gap_decorator_iterator operator+(difference_type const skip, gap_decorator_iterator const &it)
Returns an iterator copy advanced by skip many positions.
Definition: gap_decorator.hpp:822
gap_decorator_iterator operator--(int)
Returns a decremented iterator copy.
Definition: gap_decorator.hpp:860
gap_decorator_iterator operator+(difference_type const skip) const
Returns an iterator copy advanced by skip many positions.
Definition: gap_decorator.hpp:816
difference_type operator-(gap_decorator_iterator const lhs) const noexcept
Returns the distance between two iterators.
Definition: gap_decorator.hpp:887
gap_decorator_iterator operator++(int)
Returns an incremented iterator copy.
Definition: gap_decorator.hpp:801
gap_decorator_iterator & operator+=(difference_type const skip)
Advances iterator by skip many positions.
Definition: gap_decorator.hpp:809
gap_decorator_iterator & operator++()
Increments iterator.
Definition: gap_decorator.hpp:772
typename gap_decorator::const_reference reference
The reference type.
Definition: gap_decorator.hpp:728
gap_decorator_iterator operator-(difference_type const skip) const
Returns an iterator copy advanced by skip many positions.
Definition: gap_decorator.hpp:875
friend bool operator<(gap_decorator_iterator const &lhs, gap_decorator_iterator const &rhs) noexcept
Checks whether *this is less than rhs.
Definition: gap_decorator.hpp:927
gap_decorator_iterator(gap_decorator const &host_)
Construct from seqan3::gap_decorator and initialising to first position.
Definition: gap_decorator.hpp:746
gap_decorator_iterator(gap_decorator_iterator &&)=default
Defaulted.
friend gap_decorator_iterator operator-(difference_type const skip, gap_decorator_iterator const &it)
Returns an iterator copy advanced by skip many positions.
Definition: gap_decorator.hpp:881
friend bool operator!=(gap_decorator_iterator const &lhs, gap_decorator_iterator const &rhs) noexcept
Checks whether *this is not equal to rhs.
Definition: gap_decorator.hpp:921
gap_decorator_iterator(gap_decorator const &host_, typename gap_decorator::size_type const pos_)
Construct from seqan3::gap_decorator and explicit position.
Definition: gap_decorator.hpp:762
friend bool operator>=(gap_decorator_iterator const &lhs, gap_decorator_iterator const &rhs) noexcept
Checks whether *this is greater than or equal to rhs.
Definition: gap_decorator.hpp:945
friend bool operator>(gap_decorator_iterator const &lhs, gap_decorator_iterator const &rhs) noexcept
Checks whether *this is greater than rhs.
Definition: gap_decorator.hpp:933
gap_decorator_iterator(gap_decorator_iterator const &)=default
Defaulted.
gap_decorator_iterator & operator-=(difference_type const skip)
Advances iterator by skip many positions.
Definition: gap_decorator.hpp:868
friend bool operator==(gap_decorator_iterator const &lhs, gap_decorator_iterator const &rhs) noexcept
Checks whether *this is equal to rhs.
Definition: gap_decorator.hpp:915
value_type * pointer
The pointer type.
Definition: gap_decorator.hpp:730
typename gap_decorator::value_type value_type
The value type.
Definition: gap_decorator.hpp:726
void jump(typename gap_decorator::size_type const new_pos)
A helper function that performs the random access into the anchor set, updating all member variables.
Definition: gap_decorator.hpp:692
reference operator[](difference_type const n) const
Return underlying container value currently pointed at.
Definition: gap_decorator.hpp:903
A gap decorator allows the annotation of sequences with gap symbols while leaving the underlying sequ...
Definition: gap_decorator.hpp:86
gap_decorator & operator=(gap_decorator &&rhs)=default
Defaulted.
reference at(size_type const i)
Return the i-th element as a reference.
Definition: gap_decorator.hpp:414
friend bool operator==(gap_decorator const &lhs, gap_decorator const &rhs)
Checks whether lhs is equal to rhs.
Definition: gap_decorator.hpp:470
typename anchor_set_type::iterator set_iterator_type
The iterator type for an anchor set.
Definition: gap_decorator.hpp:558
inner_type unaligned_seq_type
The underlying ungapped range type.
Definition: gap_decorator.hpp:140
gap_decorator(gap_decorator &&rhs)=default
Defaulted.
const_reference at(size_type const i) const
Return the i-th element as a reference.
Definition: gap_decorator.hpp:422
std::ranges::range_difference_t< inner_type > difference_type
The difference type of the underlying sequence.
Definition: gap_decorator.hpp:133
const_iterator cend() const noexcept
Returns an iterator pointing behind the last element of the decorator.
Definition: gap_decorator.hpp:391
const_iterator end() const noexcept
Returns an iterator pointing behind the last element of the decorator.
Definition: gap_decorator.hpp:385
typename std::pair< size_t, size_t > anchor_gap_t
The gap type as a tuple storing position and accumulated gap lengths.
Definition: gap_decorator.hpp:552
void rupdate(size_type const pos, size_type const offset)
Update all anchor gaps after the indicated position by adding an offset.
Definition: gap_decorator.hpp:592
gap_decorator(other_range_t &&range)
Construct with the ungapped range type.
Definition: gap_decorator.hpp:169
reference operator[](size_type const i) const
Return the i-th element as a reference.
Definition: gap_decorator.hpp:441
friend bool operator!=(gap_decorator const &lhs, gap_decorator const &rhs)
Checks whether lhs is not equal to rhs.
Definition: gap_decorator.hpp:486
iterator erase_gap(const_iterator const it)
Erase one gap symbol at the indicated iterator postion.
Definition: gap_decorator.hpp:262
const_iterator begin() const noexcept
Returns an iterator to the first element of the container.
Definition: gap_decorator.hpp:359
iterator insert_gap(const_iterator const it, size_type const count=1)
Insert a gap of length count at the aligned sequence iterator position.
Definition: gap_decorator.hpp:209
~gap_decorator()=default
Defaulted.
iterator erase_gap(const_iterator const first, const_iterator const last)
Erase gap symbols at the iterator postions [first, last[.
Definition: gap_decorator.hpp:286
gap_decorator(gap_decorator const &)=default
Defaulted.
friend bool operator<=(gap_decorator const &lhs, gap_decorator const &rhs)
Checks whether lhs is less than or equal to rhs.
Definition: gap_decorator.hpp:515
size_type size() const
Returns the total length of the aligned sequence.
Definition: gap_decorator.hpp:186
size_type gap_length(set_iterator_type it) const
Helper function to compute the length of the gap indicated by the input iterator.
Definition: gap_decorator.hpp:575
reference const_reference
const_reference type equals reference type equals value type because the underlying sequence must not...
Definition: gap_decorator.hpp:121
gap_decorator & operator=(gap_decorator const &)=default
Defaulted.
void update(set_iterator_type it, size_type const offset)
Update all anchor gaps after indicated position by substracting an offset.
Definition: gap_decorator.hpp:613
gapped< std::ranges::range_value_t< inner_type > > value_type
The variant type of the alphabet type and gap symbol type (see seqan3::gapped).
Definition: gap_decorator.hpp:108
friend bool operator>(gap_decorator const &lhs, gap_decorator const &rhs)
Checks whether lhs is greater than rhs.
Definition: gap_decorator.hpp:535
friend bool operator>=(gap_decorator const &lhs, gap_decorator const &rhs)
Checks whether lhs is greater than or equal to rhs.
Definition: gap_decorator.hpp:544
friend void assign_unaligned(gap_decorator &dec, unaligned_seq_t &&unaligned)
Assigns a new sequence of type seqan3::gap_decorator::unaligned_seq_type to the decorator.
Definition: gap_decorator.hpp:335
gap_decorator()=default
Default constructor.
decltype(views::type_reduce(std::declval< inner_type && >())) ungapped_view_type
The type of the underlying view wrapped in seqan3::views::type_reduce.
Definition: gap_decorator.hpp:98
friend bool operator<(gap_decorator const &lhs, gap_decorator const &rhs)
Checks whether lhs is less than rhs.
Definition: gap_decorator.hpp:495
anchor_set_type anchors
Set storing the anchor gaps.
Definition: gap_decorator.hpp:628
std::ranges::range_size_t< inner_type > size_type
The size_type of the underlying sequence.
Definition: gap_decorator.hpp:127
ungapped_view_type ungapped_view
Stores a (copy of a) view to the ungapped, underlying sequence.
Definition: gap_decorator.hpp:625
const_iterator cbegin() const noexcept
Returns an iterator to the first element of the container.
Definition: gap_decorator.hpp:365
Thrown in function seqan3::erase_gap, if a position does not contain a gap.
Definition: exception.hpp:24
The alphabet of a gap character '-'.
Definition: gap.hpp:39
Provides seqan3::gap.
Provides seqan3::gapped.
@ offset
Sequence (seqan3::field::seq) relative start position (0-based), unsigned value.
constexpr ptrdiff_t count
Count the occurrences of a type in a pack.
Definition: traits.hpp:168
constexpr size_t size
The size of a type pack.
Definition: traits.hpp:150
constexpr auto type_reduce
A view adaptor that behaves like std::views::all, but type erases certain ranges.
Definition: type_reduce.hpp:158
Provides the seqan3::detail::inherited_iterator_base template.
T max(T... args)
typename unaligned_seq< t >::type unaligned_seq_t
Helper type that delegates to seqan3::detail::unaligned_seq::type.
Definition: aligned_sequence_concept.hpp:79
The main SeqAn3 namespace.
Definition: aligned_sequence_concept.hpp:29
SeqAn specific customisations in the standard namespace.
T next(T... args)
T prev(T... args)
Provides the seqan3::detail::random_access_iterator class.
Adaptations of concepts from the standard library.
Adaptations of concepts from the Ranges TS.
T size(T... args)
T to_string(T... args)
Provides seqan3::views::type_reduce.