Iterator for calculating hash values via a given seqan3::shape.
More...
#include <seqan3/search/views/kmer_hash.hpp>
|
void | hash_backward () |
| Decrements iterator by 1.
|
|
void | hash_backward (difference_type const skip) |
| Decrements iterator by skip .
|
|
void | hash_forward () |
| Increments iterator by 1.
|
|
void | hash_forward (difference_type const skip) |
| Increments iterator by skip .
|
|
void | hash_full () |
| Calculates a hash value by explicitly looking at each position.
|
|
void | hash_roll_backward () |
| Calculates the previous hash value via rolling hash.
|
|
void | hash_roll_forward () |
| Calculates the next hash value via rolling hash.
|
|
|
size_t | hash_value {0} |
| The hash value.
|
|
size_t | roll_factor {0} |
| The factor for the left most position of the hash value.
|
|
shape | shape_ |
| The shape to use.
|
|
it_t | text_left |
| Iterator to the leftmost position of the k-mer.
|
|
it_t | text_right |
| Iterator to the rightmost position of the k-mer.
|
|
|
basic_iterator | operator+ (difference_type const skip, basic_iterator const &it) noexcept |
| Non-member operator+ delegates to non-friend operator+.
|
|
difference_type | operator- (basic_iterator const &lhs, basic_iterator const &rhs) noexcept |
| Return offset between two iterator's positions.
|
|
difference_type | operator- (basic_iterator const &lhs, sentinel_t const &rhs) noexcept |
| Return offset this and remote sentinel's position.
|
|
basic_iterator | operator- (difference_type const skip, basic_iterator const &it) noexcept |
| Non-member operator- delegates to non-friend operator-.
|
|
difference_type | operator- (sentinel_t const &lhs, basic_iterator const &rhs) noexcept |
| Return offset between remote sentinel's position and this.
|
|
|
|
bool | operator== (basic_iterator const &lhs, sentinel_t const &rhs) noexcept |
| Compare to iterator on text.
|
|
bool | operator== (sentinel_t const &lhs, basic_iterator const &rhs) noexcept |
| Compare to iterator on text.
|
|
bool | operator== (basic_iterator const &lhs, basic_iterator const &rhs) noexcept |
| Compare to another basic_iterator.
|
|
bool | operator!= (basic_iterator const &lhs, sentinel_t const &rhs) noexcept |
| Compare to iterator on text.
|
|
bool | operator!= (sentinel_t const &lhs, basic_iterator const &rhs) noexcept |
| Compare to iterator on text.
|
|
bool | operator!= (basic_iterator const &lhs, basic_iterator const &rhs) noexcept |
| Compare to another basic_iterator.
|
|
bool | operator< (basic_iterator const &lhs, basic_iterator const &rhs) noexcept |
| Compare to another basic_iterator.
|
|
bool | operator> (basic_iterator const &lhs, basic_iterator const &rhs) noexcept |
| Compare to another basic_iterator.
|
|
bool | operator<= (basic_iterator const &lhs, basic_iterator const &rhs) noexcept |
| Compare to another basic_iterator.
|
|
bool | operator>= (basic_iterator const &lhs, basic_iterator const &rhs) noexcept |
| Compare to another basic_iterator.
|
|
template<std::ranges::view urng_t>
template<bool const_range>
class seqan3::detail::kmer_hash_view< urng_t >::basic_iterator< const_range >
Iterator for calculating hash values via a given seqan3::shape.
- Template Parameters
-
urng_t | Type of the text. Must model std::forward_range. Reference type must model seqan3::semialphabet. |
The basic_iterator can be used to iterate over the hash values of a text. The basic_iterator needs an iterator of the text and a seqan3::shape that defines how to hash the text.
Depending on the type of the iterator passed to the basic_iterator, different functionality is available:
When using a gapped seqan3::shape, the 0
s of the seqan3::shape are virtually removed from the hashed k-mer. Note that any shape is expected to start with a 1
and end with a 1
.
This entity is experimental and subject to change in the future.
Implementation detail
To avoid dereferencing the sentinel when iterating, the basic_iterator computes the hash value up until the second to last position and performs the addition of the last position upon access (operator* and operator[]).
◆ basic_iterator() [1/2]
template<std::ranges::view urng_t>
template<bool const_range>
Construct from a given iterator on the text and a seqan3::shape. /param[in] it_start Iterator pointing to the first position of the text. /param[in] it_end Sentinel pointing to the end of the text. /param[in] s_ The seqan3::shape that determines which positions participate in hashing.
Complexity
Linear in size of shape.
◆ basic_iterator() [2/2]
template<std::ranges::view urng_t>
template<bool const_range>
Construct from a given iterator on the text and a seqan3::shape. /param[in] it_start Iterator pointing to the first position of the text. /param[in] it_end Sentinel pointing to the end of the text. /param[in] s_ The seqan3::shape that determines which positions participate in hashing. /param[in] is_end Indicates that this iterator should point to the end of the text.
If we have a common_range as underlying range, we want to preserve this property. This means that we need to have a basic_iterator that can act as end for the kmer_hash_view, i.e. the text_right iterator is equal to the end iterator of the underlying range. However, we still need to do some initialisation via hash_full: When using std::views::reverse
, we start iterating from the end and decrement the iterator. After calling hash_full, we need to reset our text_right iterator to point to the end again.
Another difference to the other constructor is that we need to do some work to determine the position of the text_left iterator. Note that we use std::ranges::next
instead of std::ranges::prev
because the latter only works for bidirectional ranges. *
Complexity
Linear in size of shape.
◆ hash_backward() [1/2]
template<std::ranges::view urng_t>
template<bool const_range>
Decrements iterator by 1.
- Attention
- This function is only available if
it_t
models std::bidirectional_iterator.
◆ hash_backward() [2/2]
template<std::ranges::view urng_t>
template<bool const_range>
Decrements iterator by skip
.
- Parameters
-
- Attention
- This function is only available if
it_t
models std::bidirectional_iterator.
◆ hash_forward()
template<std::ranges::view urng_t>
template<bool const_range>
Increments iterator by skip
.
- Parameters
-
- Attention
- This function is only available if
it_t
models std::random_access_iterator.
◆ hash_roll_backward()
template<std::ranges::view urng_t>
template<bool const_range>
Calculates the previous hash value via rolling hash.
- Attention
- This function is only available if
it_t
models std::bidirectional_iterator.
◆ operator+()
template<std::ranges::view urng_t>
template<bool const_range>
Forward copy of this iterator.
- Attention
- This function is only available if
it_t
models std::random_access_iterator.
◆ operator+=()
template<std::ranges::view urng_t>
template<bool const_range>
Forward this iterator.
- Attention
- This function is only available if
it_t
models std::random_access_iterator.
◆ operator-()
template<std::ranges::view urng_t>
template<bool const_range>
Return decremented copy of this iterator.
- Attention
- This function is only available if
it_t
models std::random_access_iterator.
◆ operator--() [1/2]
template<std::ranges::view urng_t>
template<bool const_range>
Pre-decrement.
- Attention
- This function is only available if
it_t
models std::bidirectional_iterator.
◆ operator--() [2/2]
template<std::ranges::view urng_t>
template<bool const_range>
Post-decrement.
- Attention
- This function is only available if
it_t
models std::bidirectional_iterator.
◆ operator-=()
template<std::ranges::view urng_t>
template<bool const_range>
Decrement iterator by skip
.
- Attention
- This function is only available if
it_t
models std::random_access_iterator.
◆ operator[]()
template<std::ranges::view urng_t>
template<bool const_range>
Move the iterator by a given offset and return the corresponding hash value.
- Attention
- This function is only available if
it_t
models std::random_access_iterator.
◆ operator+
template<std::ranges::view urng_t>
template<bool const_range>
Non-member operator+ delegates to non-friend operator+.
- Attention
- This function is only available if
it_t
models std::random_access_iterator.
◆ operator- [1/4]
template<std::ranges::view urng_t>
template<bool const_range>
Return offset between two iterator's positions.
- Attention
- This function is only available if
it_t
models std::random_access_iterator.
◆ operator- [2/4]
template<std::ranges::view urng_t>
template<bool const_range>
Return offset this and remote sentinel's position.
- Attention
- This function is only available if it_t and sentinel_t model std::sized_sentinel_for.
◆ operator- [3/4]
template<std::ranges::view urng_t>
template<bool const_range>
Non-member operator- delegates to non-friend operator-.
- Attention
- This function is only available if
it_t
models std::random_access_iterator.
◆ operator- [4/4]
template<std::ranges::view urng_t>
template<bool const_range>
Return offset between remote sentinel's position and this.
- Attention
- This function is only available if sentinel_t and it_t model std::sized_sentinel_for.
The documentation for this class was generated from the following file: