SeqAn3  3.0.2
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 <limits>
17 #include <set>
18 #include <tuple>
19 #include <type_traits>
20 
29 #include <seqan3/std/algorithm>
30 #include <seqan3/std/ranges>
31 
32 namespace seqan3
33 {
34 
79 template <std::ranges::viewable_range inner_type>
81  requires std::ranges::random_access_range<inner_type> && std::ranges::sized_range<inner_type> &&
82  (std::is_const_v<std::remove_reference_t<inner_type>> || std::ranges::view<inner_type>)
85 {
86 private:
87  // Declaration of class's iterator types; for the definition see below.
89 
94  using const_iterator = iterator;
95 
97  using ungapped_view_type = decltype(views::type_reduce(std::declval<inner_type &&>()));
98 
99 public:
111  using size_type = std::ranges::range_size_t<inner_type>;
113  using difference_type = std::ranges::range_difference_t<inner_type>;
115 
117  using unaligned_seq_type = inner_type;
118 
122  gap_decorator() = default;
125  gap_decorator(gap_decorator const &) = default;
126  gap_decorator & operator=(gap_decorator const &) = default;
127  gap_decorator(gap_decorator && rhs) = default;
128  gap_decorator & operator=(gap_decorator && rhs) = default;
129  ~gap_decorator() = default;
130 
132  template <typename other_range_t>
134  requires (!std::same_as<other_range_t, gap_decorator>) &&
135  std::same_as<std::remove_cvref_t<other_range_t>, std::remove_cvref_t<inner_type>> &&
136  std::ranges::viewable_range<other_range_t> // at end, otherwise it competes with the move ctor
138  gap_decorator(other_range_t && range) : ungapped_view{views::type_reduce(std::forward<inner_type>(range))}
139  {} // TODO (@smehringer) only works for copyable views. Has to be changed once views are not required to be copyable anymore.
140  // !\}
141 
153  size_type size() const
154  {
155  if (anchors.size())
156  return anchors.rbegin()->second + ungapped_view.size();
157 
158  return ungapped_view.size();
159  }
160 
175  {
176  if (!count) // [[unlikely]]
177  return it;
178 
179  size_type const pos = it - begin();
180  assert(pos <= size());
181 
182  set_iterator_type it_set = anchors.upper_bound(anchor_gap_t{pos, bound_dummy});
183 
184  if (it_set == anchors.begin()) // will also catch if anchors is empty since begin() == end()
185  {
186  anchors.emplace_hint(anchors.begin(), anchor_gap_t{pos, count});
187  }
188  else // there are gaps before pos
189  {
190  --it_set;
191  auto gap_len{it_set->second};
192  if (it_set != anchors.begin())
193  gap_len -= (*(std::prev(it_set))).second;
194 
195  if (it_set->first + gap_len >= pos) // extend existing gap
196  {
197  anchor_gap_t gap{it_set->first, it_set->second + count};
198  it_set = anchors.erase(it_set);
199  anchors.insert(it_set, gap);
200  }
201  else // insert new gap
202  {
203  anchor_gap_t gap{pos, it_set->second + count};
204  ++it_set;
205  anchors.insert(it_set, gap);
206  }
207  }
208 
209  // post-processing: reverse update of succeeding gaps
210  rupdate(pos, count);
211  return iterator{*this, pos};
212  }
213 
226  {
227  // check if [it, it+gap_len[ covers [first, last[
228  if ((*it) != gap{}) // [[unlikely]]
229  throw gap_erase_failure("The range to be erased does not correspond to a consecutive gap.");
230 
231  return erase_gap(it, std::next(it));
232  }
233 
248  {
249  size_type const pos1 = first - begin();
250  size_type const pos2 = last - begin();
251  set_iterator_type it = anchors.upper_bound(anchor_gap_t{pos1, bound_dummy}); // first element greater than pos1
252 
253  if (it == anchors.begin())
254  throw gap_erase_failure{"There is no gap to erase in range [" + std::to_string(pos1) + "," +
255  std::to_string(pos2) + "]."};
256 
257  --it;
258  size_type const gap_len = gap_length(it);
259 
260  // check if [it, it+gap_len[ covers [first, last[
261  if ((it->first + gap_len) < pos2) // [[unlikely]]
262  {
263  throw gap_erase_failure{"The range to be erased does not correspond to a consecutive gap."};
264  }
265  // case 1: complete gap is deleted
266  else if (gap_len == pos2 - pos1)
267  {
268  it = anchors.erase(it);
269  }
270  // case 2: gap to be deleted in tail or larger than 1 (equiv. to shift tail left, i.e. pos remains unchanged)
271  else
272  {
273  anchor_gap_t gap{it->first, it->second - pos2 + pos1};
274  it = anchors.erase(it);
275  it = anchors.insert(it, gap); // amortized constant because of hint
276  ++it; // update node after the current
277  }
278 
279  // post-processing: forward update of succeeding gaps
280  update(it, pos2 - pos1);
281 
282  return iterator{*this, pos1};
283  }
284 
289  template <typename unaligned_seq_t> // generic template to use forwarding reference
291  requires std::assignable_from<gap_decorator &, unaligned_seq_t>
293  friend void assign_unaligned(gap_decorator & dec, unaligned_seq_t && unaligned)
294  {
295  dec = unaligned;
296  }
298 
315  const_iterator begin() const noexcept
316  {
317  return iterator{*this};
318  }
319 
321  const_iterator cbegin() const noexcept
322  {
323  return const_iterator{*this};
324  }
325 
339  const_iterator end() const noexcept
340  {
341  return iterator{*this, size()};
342  }
343 
345  const_iterator cend() const noexcept
346  {
347  return const_iterator{*this, size()};
348  }
350 
367  {
368  if (i >= size()) // [[unlikely]]
369  throw std::out_of_range{"Trying to access element behind the last in gap_decorator."};
370  return (*this)[i];
371  }
372 
374  const_reference at(size_type const i) const
375  {
376  if (i >= size()) // [[unlikely]]
377  throw std::out_of_range{"Trying to access element behind the last in gap_decorator."};
378  return (*this)[i];
379  }
380 
393  {
394  return *iterator{*this, i};
395  }
397 
417  friend bool operator==(gap_decorator const & lhs, gap_decorator const & rhs)
419  {
420  if (lhs.size() == rhs.size() &&
421  lhs.anchors == rhs.anchors &&
422  std::ranges::equal(lhs.ungapped_view, rhs.ungapped_view))
423  {
424  return true;
425  }
426 
427  return false;
428  }
429 
431  friend bool operator!=(gap_decorator const & lhs, gap_decorator const & rhs)
432  {
433  return !(lhs == rhs);
434  }
435 
437  friend bool operator<(gap_decorator const & lhs, gap_decorator const & rhs)
438  {
439  auto lit = lhs.begin();
440  auto rit = rhs.begin();
441 
442  while (lit != lhs.end() && rit != rhs.end() && *lit == *rit)
443  ++lit, ++rit;
444 
445  if (rit == rhs.end())
446  return false; // lhs == rhs, or rhs prefix of lhs
447  else if (lit == lhs.end())
448  return true; // lhs prefix of rhs
449 
450  return *lit < *rit;
451  }
452 
454  friend bool operator<=(gap_decorator const & lhs, gap_decorator const & rhs)
455  {
456  auto lit = lhs.begin();
457  auto rit = rhs.begin();
458 
459  while (lit != lhs.end() && rit != rhs.end() && *lit == *rit)
460  ++lit, ++rit;
461 
462  if (lit == lhs.end())
463  return true; // lhs == rhs, or lhs prefix of rhs
464  else if (rit == rhs.end())
465  return false; // rhs prefix of lhs
466 
467  return *lit < *rit;
468  }
469 
471  friend bool operator>(gap_decorator const & lhs, gap_decorator const & rhs)
472  {
473  return !(lhs <= rhs);
474  }
475 
477  friend bool operator>=(gap_decorator const & lhs, gap_decorator const & rhs)
478  {
479  return !(lhs < rhs);
480  }
482 
483 private:
485  using anchor_gap_t = typename std::pair<size_t, size_t>;
486 
488  using anchor_set_type = std::set<anchor_gap_t>;
489 
491  using set_iterator_type = typename anchor_set_type::iterator;
492 
494  constexpr static size_t bound_dummy{std::numeric_limits<size_t>::max()};
495 
508  size_type gap_length(set_iterator_type it) const
509  {
510  return (it == anchors.begin()) ? it->second : it->second - (*std::prev(it)).second;
511  }
512 
525  void rupdate(size_type const pos, size_type const offset)
526  {
527  for (auto it = std::prev(anchors.end(), 1); it->first > pos;)
528  {
529  anchors.emplace_hint(it, anchor_gap_t{it->first + offset, it->second + offset});
530  anchors.erase(*it--);
531  }
532  }
533 
546  void update(set_iterator_type it, size_type const offset)
547  {
548  while (it != anchors.end())
549  {
550  anchor_gap_t gap{it->first - offset, it->second - offset};
551  it = anchors.erase(it);
552  it = anchors.insert(it, gap);
553  ++it;
554  }
555  }
556 
558  ungapped_view_type ungapped_view{};
559 
561  anchor_set_type anchors{};
562 };
563 
567 template <std::ranges::viewable_range urng_t>
570  requires (!std::ranges::view<std::remove_reference_t<urng_t>>)
572 gap_decorator(urng_t && range) -> gap_decorator<std::remove_reference_t<urng_t> const &>;
573 
575 template <std::ranges::view urng_t>
576 gap_decorator(urng_t range) -> gap_decorator<urng_t>;
578 
595 template <std::ranges::viewable_range inner_type>
597  requires std::ranges::random_access_range<inner_type> && std::ranges::sized_range<inner_type> &&
598  (std::is_const_v<std::remove_reference_t<inner_type>> || std::ranges::view<inner_type>)
601 {
602 protected:
606  typename gap_decorator::size_type pos{0u};
608  int64_t ungapped_view_pos{0}; // must be signed because we need this value to be -1 in case of leading gaps.
611  typename gap_decorator::size_type left_gap_end{0};
614  typename gap_decorator::set_iterator_type anchor_set_it{};
616  bool is_at_gap{true};
617 
619  void jump(typename gap_decorator::size_type const new_pos)
620  {
621  assert(new_pos <= host->size());
622  pos = new_pos;
623 
624  anchor_set_it = host->anchors.upper_bound(anchor_gap_t{pos, host->bound_dummy});
625  ungapped_view_pos = pos;
626 
627  if (anchor_set_it != host->anchors.begin())
628  {
629  typename gap_decorator::set_iterator_type prev{std::prev(anchor_set_it)};
630  size_type gap_len{prev->second};
631 
632  if (prev != host->anchors.begin())
633  gap_len -= std::prev(prev)->second;
634 
635  ungapped_view_pos -= prev->second;
636  left_gap_end = prev->first + gap_len;
637  }
638 
639  if (ungapped_view_pos != static_cast<int64_t>(host->ungapped_view.size()) &&
640  pos >= left_gap_end && (anchor_set_it == host->anchors.end() || pos < anchor_set_it->first))
641  is_at_gap = false;
642  else
643  is_at_gap = true;
644  }
645 
646 public:
657  using pointer = value_type *;
661 
671 
673  explicit gap_decorator_iterator(gap_decorator const & host_) :
674  host(&host_), anchor_set_it{host_.anchors.begin()}
675  {
676  if (host_.anchors.size() && (*host_.anchors.begin()).first == 0) // there are gaps at the very front
677  {
678  --ungapped_view_pos; // set ungapped_view_pos to -1 so operator++ works without an extra if-branch.
679  left_gap_end = anchor_set_it->second;
680  ++anchor_set_it;
681  }
682  else
683  {
684  is_at_gap = false;
685  }
686  }
687 
689  gap_decorator_iterator(gap_decorator const & host_, typename gap_decorator::size_type const pos_) : host(&host_)
690  {
691  jump(pos_); // random access to pos
692  }
694 
698  gap_decorator_iterator & operator++()
700  {
701  assert(host); // host is set
702  ++pos;
703 
704  if (pos < left_gap_end) // we stay within the preceding gap stretch
705  return *this;
706 
707  if (anchor_set_it == host->anchors.end() || pos < anchor_set_it->first)
708  { // proceed within the view since we are right of the previous gap but didn't arrive at the right gap yet
709  ++ungapped_view_pos;
710  if (ungapped_view_pos != static_cast<int64_t>(host->ungapped_view.size()))
711  is_at_gap = false;
712  }
713  else
714  { // we arrived at the right gap and have to update the variables. ungapped_view_pos remains unchanged.
715  left_gap_end = anchor_set_it->first + anchor_set_it->second -
716  ((anchor_set_it != host->anchors.begin()) ? (std::prev(anchor_set_it))->second : 0);
717  ++anchor_set_it;
718  is_at_gap = true;
719 
720  if (left_gap_end == host->size()) // very last gap
721  ++ungapped_view_pos;
722  }
723 
724  return *this;
725  }
726 
729  {
730  gap_decorator_iterator cpy{*this};
731  ++(*this);
732  return cpy;
733  }
734 
737  {
738  this->jump(this->pos + skip);
739  return *this;
740  }
741 
744  {
745  return gap_decorator_iterator{*(this->host), this->pos + skip};
746  }
747 
750  {
751  return it + skip;
752  }
753 
756  {
757  assert(host); // host is set
758  --pos;
759 
760  if (pos < left_gap_end)
761  { // there was no gap before but we arrive at the left gap and have to update the variables.
762  (anchor_set_it != host->anchors.begin()) ? --anchor_set_it : anchor_set_it;
763 
764  if (anchor_set_it != host->anchors.begin())
765  {
766  auto prev = std::prev(anchor_set_it);
767  left_gap_end = prev->first + prev->second -
768  ((prev != host->anchors.begin()) ? std::prev(prev)->second : 0);
769  }
770  else // [[unlikely]]
771  {
772  left_gap_end = 0;
773  }
774  is_at_gap = true;
775  }
776  else if (anchor_set_it == host->anchors.end() || pos < anchor_set_it->first)
777  { // we are neither at the left nor right gap
778  --ungapped_view_pos;
779  is_at_gap = false;
780  }
781  // else -> no op (we are still within the right gap stretch)
782 
783  return *this;
784  }
785 
788  {
789  gap_decorator_iterator cpy{*this};
790  --(*this);
791  return cpy;
792  }
793 
796  {
797  this->jump(this->pos - skip);
798  return *this;
799  }
800 
803  {
804  return gap_decorator_iterator{*(this->host), this->pos - skip};
805  }
806 
809  {
810  return it - skip;
811  }
812 
815  {
816  return static_cast<difference_type>(this->pos - lhs.pos);
817  }
819 
823  reference operator*() const
825  {
826  return (is_at_gap) ? reference{gap{}} : reference{host->ungapped_view[ungapped_view_pos]};
827  }
828 
831  {
832  return *(*this + n);
833  }
835 
841  friend bool operator==(gap_decorator_iterator const & lhs, gap_decorator_iterator const & rhs) noexcept
843  {
844  return lhs.pos == rhs.pos;
845  }
846 
848  friend bool operator!=(gap_decorator_iterator const & lhs, gap_decorator_iterator const & rhs) noexcept
849  {
850  return lhs.pos != rhs.pos;
851  }
852 
854  friend bool operator<(gap_decorator_iterator const & lhs, gap_decorator_iterator const & rhs) noexcept
855  {
856  return lhs.pos < rhs.pos;
857  }
858 
860  friend bool operator>(gap_decorator_iterator const & lhs, gap_decorator_iterator const & rhs) noexcept
861  {
862  return lhs.pos > rhs.pos;
863  }
864 
866  friend bool operator<=(gap_decorator_iterator const & lhs, gap_decorator_iterator const & rhs) noexcept
867  {
868  return lhs.pos <= rhs.pos;
869  }
870 
872  friend bool operator>=(gap_decorator_iterator const & lhs, gap_decorator_iterator const & rhs) noexcept
873  {
874  return lhs.pos >= rhs.pos;
875  }
877 };
878 
879 } // namespace seqan
seqan3::gap_decorator::gap_decorator_iterator::operator--
gap_decorator_iterator operator--(int)
Returns a decremented iterator copy.
Definition: gap_decorator.hpp:787
seqan3::gap_decorator::cbegin
const_iterator cbegin() const noexcept
Returns an iterator to the first element of the container.
Definition: gap_decorator.hpp:321
seqan3::gap
The alphabet of a gap character '-'.
Definition: gap.hpp:37
seqan3::gap_decorator::gap_decorator_iterator::operator=
gap_decorator_iterator & operator=(gap_decorator_iterator const &)=default
Defaulted.
std::pair
seqan3::gap_erase_failure
Thrown in function seqan3::erase_gap, if a position does not contain a gap.
Definition: exception.hpp:24
seqan3::gap_decorator::unaligned_seq_type
inner_type unaligned_seq_type
The underlying ungapped range type.
Definition: gap_decorator.hpp:117
seqan3::gap_decorator::gap_decorator
gap_decorator(gap_decorator const &)=default
Defaulted.
std::bidirectional_iterator_tag
seqan3::gap_decorator::begin
const_iterator begin() const noexcept
Returns an iterator to the first element of the container.
Definition: gap_decorator.hpp:315
concept.hpp
Adaptations of concepts from the standard library.
tuple
seqan3::gap_decorator::end
const_iterator end() const noexcept
Returns an iterator pointing behind the last element of the decorator.
Definition: gap_decorator.hpp:339
seqan3::gap_decorator::gap_decorator_iterator::operator[]
reference operator[](difference_type const n) const
Return underlying container value currently pointed at.
Definition: gap_decorator.hpp:830
seqan3::views::type_reduce
constexpr auto type_reduce
A view adaptor that behaves like std::views::all, but type erases certain ranges.
Definition: type_reduce.hpp:158
exception.hpp
Includes customized exception types for the alignment module .
seqan3::gap_decorator::gap_decorator_iterator::operator>=
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:872
seqan3::gap_decorator::operator>=
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:477
algorithm
Adaptations of algorithms from the Ranges TS.
seqan3::gap_decorator::at
const_reference at(size_type const i) const
Return the i-th element as a reference.
Definition: gap_decorator.hpp:374
seqan3::gap_decorator::gap_decorator_iterator::reference
typename gap_decorator::const_reference reference
The reference type.
Definition: gap_decorator.hpp:655
seqan3::gap_decorator::gap_decorator_iterator::operator+
gap_decorator_iterator operator+(difference_type const skip) const
Returns an iterator copy advanced by skip many positions.
Definition: gap_decorator.hpp:743
seqan3::alphabet_variant
A combined alphabet that can hold values of either of its alternatives.
Definition: alphabet_variant.hpp:133
seqan3::gap_decorator::gap_decorator_iterator::operator=
gap_decorator_iterator & operator=(gap_decorator_iterator &&)=default
Defaulted.
random_access_iterator.hpp
Provides the seqan3::detail::random_access_iterator class.
seqan3::gap_decorator::gap_decorator_iterator::pointer
value_type * pointer
The pointer type.
Definition: gap_decorator.hpp:657
std::add_pointer_t
seqan3::gap_decorator::operator=
gap_decorator & operator=(gap_decorator &&rhs)=default
Defaulted.
seqan3::gap_decorator::erase_gap
iterator erase_gap(const_iterator const it)
Erase one gap symbol at the indicated iterator postion.
Definition: gap_decorator.hpp:225
gapped.hpp
Provides seqan3::gapped.
seqan3::gap_decorator::gap_decorator_iterator::gap_decorator_iterator
gap_decorator_iterator(gap_decorator_iterator &&)=default
Defaulted.
seqan3::gap_decorator::gap_decorator_iterator::operator-
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:808
type_reduce.hpp
Provides seqan3::views::type_reduce.
seqan3::gap_decorator::at
reference at(size_type const i)
Return the i-th element as a reference.
Definition: gap_decorator.hpp:366
seqan3::gap_decorator::gap_decorator_iterator::operator>
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:860
std::to_string
T to_string(T... args)
seqan3::gap_decorator::gap_decorator_iterator::operator-
gap_decorator_iterator operator-(difference_type const skip) const
Returns an iterator copy advanced by skip many positions.
Definition: gap_decorator.hpp:802
seqan3::gap_decorator::gap_decorator
gap_decorator(other_range_t &&range)
Construct with the ungapped range type.
Definition: gap_decorator.hpp:138
gap.hpp
Provides seqan3::gap.
seqan3
The main SeqAn3 namespace.
Definition: aligned_sequence_concept.hpp:29
seqan3::gap_decorator::operator<=
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:454
seqan3::gap_decorator::gap_decorator_iterator::operator--
gap_decorator_iterator & operator--()
Decrements iterator.
Definition: gap_decorator.hpp:755
seqan3::gap_decorator::gap_decorator_iterator::value_type
typename gap_decorator::value_type value_type
The value type.
Definition: gap_decorator.hpp:653
seqan3::gap_decorator::gap_decorator_iterator::jump
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:619
seqan3::gap_decorator::operator<
friend bool operator<(gap_decorator const &lhs, gap_decorator const &rhs)
Checks whether lhs is less than rhs.
Definition: gap_decorator.hpp:437
seqan3::gap_decorator::gap_decorator_iterator::operator!=
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:848
seqan3::gap_decorator::gap_decorator_iterator::gap_decorator_iterator
gap_decorator_iterator(gap_decorator const &host_)
Construct from seqan3::gap_decorator and initialising to first position.
Definition: gap_decorator.hpp:673
seqan3::pack_traits::size
constexpr size_t size
The size of a type pack.
Definition: traits.hpp:116
seqan3::gap_decorator::gap_decorator
gap_decorator(gap_decorator &&rhs)=default
Defaulted.
seqan3::gap_decorator::gap_decorator_iterator::operator+=
gap_decorator_iterator & operator+=(difference_type const skip)
Advances iterator by skip many positions.
Definition: gap_decorator.hpp:736
ranges
Adaptations of concepts from the Ranges TS.
seqan3::gap_decorator::gap_decorator_iterator::operator<=
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:866
seqan3::gap_decorator::gap_decorator_iterator::gap_decorator_iterator
gap_decorator_iterator(gap_decorator_iterator const &)=default
Defaulted.
seqan3::gap_decorator::gap_decorator_iterator::~gap_decorator_iterator
~gap_decorator_iterator()=default
Defaulted.
std::remove_reference_t
seqan3::gap_decorator::gap_decorator_iterator::operator<
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:854
seqan3::gap_decorator::operator>
friend bool operator>(gap_decorator const &lhs, gap_decorator const &rhs)
Checks whether lhs is greater than rhs.
Definition: gap_decorator.hpp:471
seqan3::gap_decorator::operator!=
friend bool operator!=(gap_decorator const &lhs, gap_decorator const &rhs)
Checks whether lhs is not equal to rhs.
Definition: gap_decorator.hpp:431
limits
seqan3::gap_decorator::erase_gap
iterator erase_gap(const_iterator const first, const_iterator const last)
Erase gap symbols at the iterator postions [first, last[.
Definition: gap_decorator.hpp:247
seqan3::gap_decorator::gap_decorator_iterator::operator-
difference_type operator-(gap_decorator_iterator const lhs) const noexcept
Returns the distance between two iterators.
Definition: gap_decorator.hpp:814
std::set::begin
T begin(T... args)
std
SeqAn specific customisations in the standard namespace.
seqan3::gap_decorator::insert_gap
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:174
seqan3::gap_decorator::gap_decorator_iterator::operator+
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:749
std::remove_cvref_t
std::out_of_range
seqan3::gap_decorator::gap_decorator_iterator
The iterator type over a seqan3::gap_decorator.
Definition: gap_decorator.hpp:601
seqan3::gap_decorator::size
size_type size() const
Returns the total length of the aligned sequence.
Definition: gap_decorator.hpp:153
seqan3::gap_decorator::value_type
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:104
seqan3::gap_decorator::operator[]
reference operator[](size_type const i) const
Return the i-th element as a reference.
Definition: gap_decorator.hpp:392
seqan3::gap_decorator::gap_decorator_iterator::operator-=
gap_decorator_iterator & operator-=(difference_type const skip)
Advances iterator by skip many positions.
Definition: gap_decorator.hpp:795
seqan3::gap_decorator::difference_type
std::ranges::range_difference_t< inner_type > difference_type
The difference type of the underlying sequence.
Definition: gap_decorator.hpp:113
seqan3::gap_decorator::assign_unaligned
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:293
seqan3::gap_decorator::gap_decorator_iterator::operator++
gap_decorator_iterator operator++(int)
Returns an incremented iterator copy.
Definition: gap_decorator.hpp:728
seqan3::gap_decorator
A gap decorator allows the annotation of sequences with gap symbols while leaving the underlying sequ...
Definition: gap_decorator.hpp:85
seqan3::gap_decorator::operator=
gap_decorator & operator=(gap_decorator const &)=default
Defaulted.
std::numeric_limits::max
T max(T... args)
seqan3::gap_decorator::gap_decorator_iterator::difference_type
typename gap_decorator::difference_type difference_type
The difference type.
Definition: gap_decorator.hpp:651
std::prev
T prev(T... args)
inherited_iterator_base.hpp
Provides the seqan3::detail::inherited_iterator_base template.
seqan3::gap_decorator::~gap_decorator
~gap_decorator()=default
Defaulted.
set
concept.hpp
Core alphabet concept and free function/type trait wrappers.
seqan3::pack_traits::count
constexpr ptrdiff_t count
Count the occurrences of a type in a pack.
Definition: traits.hpp:134
seqan3::gap_decorator::cend
const_iterator cend() const noexcept
Returns an iterator pointing behind the last element of the decorator.
Definition: gap_decorator.hpp:345
seqan3::gap_decorator::size_type
std::ranges::range_size_t< inner_type > size_type
The size_type of the underlying sequence.
Definition: gap_decorator.hpp:111
seqan3::gap_decorator::gap_decorator_iterator::gap_decorator_iterator
gap_decorator_iterator()=default
Defaulted.
seqan3::gap_decorator
gap_decorator(urng_t &&range) -> gap_decorator< std::remove_reference_t< urng_t > const & >
Ranges (not views!) always deduce to const & range_type since they are access-only anyway.
std::next
T next(T... args)
seqan3::gap_decorator::gap_decorator_iterator::gap_decorator_iterator
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:689
seqan3::gap_decorator::const_reference
reference const_reference
const_reference type equals reference type equals value type because the underlying sequence must not...
Definition: gap_decorator.hpp:109