SeqAn3 3.4.0-rc.1
The Modern C++ library for sequence analysis.
|
Iterator for calculating minimisers. More...
#include <seqan3/search/views/minimiser.hpp>
Public Types | |
Associated types | |
using | difference_type = std::ranges::range_difference_t< urng1_t > |
Type for distances between iterators. | |
using | value_type = std::ranges::range_value_t< urng1_t > |
Value type of this iterator. | |
using | pointer = void |
The pointer type. | |
using | reference = value_type |
Reference to value_type . | |
using | iterator_category = std::forward_iterator_tag |
Tag this class as a forward iterator. | |
using | iterator_concept = iterator_category |
Tag this class as a forward iterator. | |
Public Member Functions | |
constexpr urng1_iterator_t | base () && |
Return the underlying iterator. It will point to the last element in the current window. | |
constexpr urng1_iterator_t const & | base () const &noexcept |
Return the underlying iterator. It will point to the last element in the current window. | |
value_type | operator* () const noexcept |
Return the minimiser. | |
basic_iterator & | operator++ () noexcept |
Pre-increment. | |
basic_iterator | operator++ (int) noexcept |
Post-increment. | |
Constructors, destructor and assignment | |
basic_iterator ()=default | |
Defaulted. | |
basic_iterator (basic_iterator const &)=default | |
Defaulted. | |
basic_iterator (basic_iterator &&)=default | |
Defaulted. | |
basic_iterator & | operator= (basic_iterator const &)=default |
Defaulted. | |
basic_iterator & | operator= (basic_iterator &&)=default |
Defaulted. | |
~basic_iterator ()=default | |
Defaulted. | |
basic_iterator (basic_iterator<!const_range > const &it) | |
Allow iterator on a const range to be constructible from an iterator over a non-const range. | |
basic_iterator (urng1_iterator_t urng1_iterator, urng1_sentinel_t urng1_sentinel, urng2_iterator_t urng2_iterator, size_t window_size) | |
Construct from begin and end iterators of a given range over std::totally_ordered values, and the number of values per window. | |
Private Types | |
using | urng1_iterator_t = maybe_const_iterator_t< const_range, urng1_t > |
The iterator type of the first underlying range. | |
using | urng1_sentinel_t = maybe_const_sentinel_t< const_range, urng1_t > |
The sentinel type of the first underlying range. | |
using | urng2_iterator_t = maybe_const_iterator_t< const_range, urng2_t > |
The iterator type of the second underlying range. | |
Private Member Functions | |
void | advance_window () |
Advances the window to the next position. | |
bool | next_minimiser () |
Calculates the next minimiser value. | |
void | next_unique_minimiser () |
Increments iterator by 1. | |
void | window_first (size_t const window_size) |
Calculates minimisers for the first window. | |
auto | window_value () const |
Returns new window value. | |
Private Attributes | |
size_t | minimiser_position_offset {} |
The offset relative to the beginning of the window where the minimizer value is found. | |
value_type | minimiser_value {} |
The minimiser value. | |
urng1_iterator_t | urng1_iterator {} |
Iterator to the rightmost value of one window. | |
urng1_sentinel_t | urng1_sentinel {} |
brief Iterator to last element in range. | |
urng2_iterator_t | urng2_iterator {} |
Iterator to the rightmost value of one window of the second range. | |
std::deque< value_type > | window_values {} |
Stored values per window. It is necessary to store them, because a shift can remove the current minimiser. | |
Friends | |
Comparison operators | |
bool | operator== (basic_iterator const &lhs, basic_iterator const &rhs) |
Compare to another basic_iterator. | |
bool | operator!= (basic_iterator const &lhs, basic_iterator const &rhs) |
Compare to another basic_iterator. | |
bool | operator== (basic_iterator const &lhs, sentinel const &) |
Compare to the sentinel of the minimiser_view. | |
bool | operator== (sentinel const &lhs, basic_iterator const &rhs) |
Compare to the sentinel of the minimiser_view. | |
bool | operator!= (sentinel const &lhs, basic_iterator const &rhs) |
Compare to the sentinel of the minimiser_view. | |
bool | operator!= (basic_iterator const &lhs, sentinel const &rhs) |
Compare to the sentinel of the minimiser_view. | |
Iterator for calculating minimisers.
|
inline |
Construct from begin and end iterators of a given range over std::totally_ordered values, and the number of values per window.
[in] | urng1_iterator | Iterator pointing to the first position of the first std::totally_ordered range. |
[in] | urng1_sentinel | Iterator pointing to the last position of the first std::totally_ordered range. |
[in] | urng2_iterator | Iterator pointing to the first position of the second std::totally_ordered range. |
[in] | window_size | The number of values in one window. |
Looks at the number of values per window in two ranges, returns the smallest between both as minimiser and shifts then by one to repeat this action. If a minimiser in consecutive windows is the same, it is returned only once.
|
inlineprivate |
Calculates the next minimiser value.
For the following windows, we remove the first window value (is now not in window_values) and add the new value that results from the window shifting.