SeqAn3 3.4.0-rc.1
The Modern C++ library for sequence analysis.
|
Alphabet related views. More...
Variables | |
template<alphabet alphabet_type> | |
auto const | seqan3::views::char_strictly_to |
A view over an alphabet, given a range of characters. | |
template<alphabet alphabet_type> | |
auto const | seqan3::views::char_to |
A view over an alphabet, given a range of characters. | |
auto const | seqan3::views::complement |
A view that converts a range of nucleotides to their complement. | |
template<typename alphabet_type > | |
auto const | seqan3::views::rank_to |
A view over an alphabet, given a range of ranks. | |
auto const | seqan3::views::to_char |
A view that calls seqan3::to_char() on each element in the input range. | |
auto const | seqan3::views::to_rank |
A view that calls seqan3::to_rank() on each element in the input range. | |
constexpr auto | seqan3::views::translate |
A view that translates nucleotide into aminoacid alphabet with 1, 2, 3 or 6 frames. | |
constexpr auto | seqan3::views::translate_join |
A view that translates nucleotide into aminoacid alphabet with 1, 2, 3 or 6 frames. Input and output range are always two-dimensional. | |
constexpr auto | seqan3::views::trim_quality |
A view that does quality-threshold trimming on a range of seqan3::quality_alphabet. | |
template<alphabet alphabet_type> | |
auto const | seqan3::views::validate_char_for |
An identity view that throws if an encountered character is not valid for the given alphabet. | |
Alphabet related views | |
constexpr auto | seqan3::views::translate_single |
A view that translates nucleotide into aminoacid alphabet for one of the six frames. | |
constexpr auto | seqan3::views::minimiser_hash |
Computes minimisers for a range with a given shape, window size and seed. | |
Alphabet related views.
|
inline |
A view over an alphabet, given a range of characters.
urng_t | The type of the range being processed. See below for requirements. [template parameter is omitted in pipe notation] |
alphabet_t | The alphabet to convert to; must satisfy seqan3::alphabet. |
[in] | urange | The range being processed. [parameter is omitted in pipe notation] |
seqan3::invalid_char_assignment | if an invalid character is encountered. |
Header File
#include <seqan3/alphabet/views/char_strictly_to.hpp>
This view differs from seqan3::views::chars_to in that it throws an exception if an invalid character conversion happens. See seqan3::char_strictly_to for more details.
This view is a deep view. Given a range-of-range as input (as opposed to just a range), it will apply the transformation on the innermost range (instead of the outermost range).
Concepts and traits | urng_t (underlying range type) | rrng_t (returned range type) |
---|---|---|
std::ranges::input_range | required | preserved |
std::ranges::forward_range | preserved | |
std::ranges::bidirectional_range | preserved | |
std::ranges::random_access_range | preserved | |
std::ranges::contiguous_range | lost | |
std::ranges::viewable_range | required | guaranteed |
std::ranges::view | guaranteed | |
std::ranges::sized_range | preserved | |
std::ranges::common_range | preserved | |
std::ranges::output_range | lost | |
std::semiregular | preserved | |
seqan3::const_iterable_range | preserved | |
std::ranges::range_reference_t | seqan3::alphabet_char_t<alphabet_t> | alphabet_t |
See the views submodule documentation for detailed descriptions of the view properties.
|
inline |
A view over an alphabet, given a range of characters.
urng_t | The type of the range being processed. See below for requirements. [template parameter is omitted in pipe notation] |
alphabet_t | The alphabet to convert to; must satisfy seqan3::alphabet. |
[in] | urange | The range being processed. [parameter is omitted in pipe notation] |
Header File
#include <seqan3/alphabet/views/char_to.hpp>
This view is a deep view Given a range-of-range as input (as opposed to just a range), it will apply the transformation on the innermost range (instead of the outermost range).
Concepts and traits | urng_t (underlying range type) | rrng_t (returned range type) |
---|---|---|
std::ranges::input_range | required | preserved |
std::ranges::forward_range | preserved | |
std::ranges::bidirectional_range | preserved | |
std::ranges::random_access_range | preserved | |
std::ranges::contiguous_range | lost | |
std::ranges::viewable_range | required | guaranteed |
std::ranges::view | guaranteed | |
std::ranges::sized_range | preserved | |
std::ranges::common_range | preserved | |
std::ranges::output_range | lost | |
seqan3::const_iterable_range | preserved | |
std::ranges::range_reference_t | seqan3::alphabet_char_t<alphabet_t> | alphabet_t |
See the views submodule documentation for detailed descriptions of the view properties.
|
inline |
A view that converts a range of nucleotides to their complement.
urng_t | The type of the range being processed. See below for requirements. [template parameter is omitted in pipe notation] |
[in] | urange | The range being processed. [parameter is omitted in pipe notation] |
Header File
#include <seqan3/alphabet/views/complement.hpp>
Calls seqan3::nucleotide_alphabet::complement() on every element of the input range.
This view is a deep view Given a range-of-range as input (as opposed to just a range), it will apply the transformation on the innermost range (instead of the outermost range).
Concepts and traits | urng_t (underlying range type) | rrng_t (returned range type) |
---|---|---|
std::ranges::input_range | required | preserved |
std::ranges::forward_range | preserved | |
std::ranges::bidirectional_range | preserved | |
std::ranges::random_access_range | preserved | |
std::ranges::contiguous_range | lost | |
std::ranges::viewable_range | required | guaranteed |
std::ranges::view | guaranteed | |
std::ranges::sized_range | preserved | |
std::ranges::common_range | preserved | |
std::ranges::output_range | lost | |
seqan3::const_iterable_range | preserved | |
std::ranges::range_reference_t | seqan3::nucleotide_alphabet | std::remove_reference_t<std::ranges::range_reference_t<urng_t>> |
See the views submodule documentation for detailed descriptions of the view properties.
|
inlineconstexpr |
Computes minimisers for a range with a given shape, window size and seed.
urng_t | The type of the range being processed. See below for requirements. [template parameter is omitted in pipe notation] |
[in] | urange | The range being processed. [parameter is omitted in pipe notation] |
[in] | shape | The seqan3::shape that determines how to compute the hash value. |
[in] | window_size | The window size to use. |
[in] | seed | The seed used to skew the hash values. Default: 0x8F3F73B5CF1C9ADE. |
size_t
where each value is the minimiser of the resp. window. See below for the properties of the returned range.A sequence can be presented by a small number of k-mers (minimisers). For a given shape and window size all k-mers are determined in the forward strand and the backward strand and only the lexicographically smallest k-mer is returned for one window. This process is repeated over every possible window of a sequence. If consecutive windows share a minimiser, it is saved only once. For example, in the sequence "TAAAGTGCTAAA" for an ungapped shape of length 3 and a window size of 5 the first, the second and the last window contain the same minimiser "AAA". Because the minimisers of the first two consecutive windows also share the same position, storing this minimiser twice is redundant and it is stored only once. The "AAA" minimiser of the last window on the other hand is stored, since it is located at an other position than the previous "AAA" minimiser and hence storing the second "AAA"-minimiser is not redundant but necessary.
It might happen that a minimiser changes only slightly when sliding the window over the sequence. For instance, when a minimiser starts with a repetition of A’s, then in the next window it is highly likely that the minimiser will start with a repetition of A’s as well. Because it is only one A shorter, depending on how long the repetition is this might go on for multiple window shifts. Saving these only slightly different minimiser makes no sense because they contain no new information about the underlying sequence. Additionally, sequences with a repetition of A’s will be seen as more similar to each other than they actually are. As Marçais et al. have shown, randomizing the order of the k-mers can solve this problem. Therefore, a random seed is used to XOR all k-mers, thereby randomizing the order. The user can change the seed to any other value he or she thinks is useful. A seed of 0 is returning the lexicographical order.
Concepts and traits | urng_t (underlying range type) | rrng_t (returned range type) |
---|---|---|
std::ranges::input_range | required | preserved |
std::ranges::forward_range | required | preserved |
std::ranges::bidirectional_range | lost | |
std::ranges::random_access_range | lost | |
std::ranges::contiguous_range | lost | |
std::ranges::viewable_range | required | guaranteed |
std::ranges::view | guaranteed | |
std::ranges::sized_range | lost | |
std::ranges::common_range | lost | |
std::ranges::output_range | lost | |
seqan3::const_iterable_range | preserved | |
std::ranges::range_reference_t | seqan3::semialphabet | std::size_t |
See the views submodule documentation for detailed descriptions of the view properties.
|
inline |
A view over an alphabet, given a range of ranks.
urng_t | The type of the range being processed. See below for requirements. [template parameter is omitted in pipe notation] |
alphabet_t | The alphabet to convert to; must satisfy seqan3::writable_semialphabet. |
[in] | urange | The range being processed. [parameter is omitted in pipe notation] |
Header File
#include <seqan3/alphabet/views/rank_to.hpp>
This view is a deep view Given a range-of-range as input (as opposed to just a range), it will apply the transformation on the innermost range (instead of the outermost range).
Concepts and traits | urng_t (underlying range type) | rrng_t (returned range type) |
---|---|---|
std::ranges::input_range | required | preserved |
std::ranges::forward_range | preserved | |
std::ranges::bidirectional_range | preserved | |
std::ranges::random_access_range | preserved | |
std::ranges::contiguous_range | lost | |
std::ranges::viewable_range | required | guaranteed |
std::ranges::view | guaranteed | |
std::ranges::sized_range | preserved | |
std::ranges::common_range | preserved | |
std::ranges::output_range | lost | |
seqan3::const_iterable_range | preserved | |
std::ranges::range_reference_t | seqan3::alphabet_rank_t<alphabet_t> | alphabet_t |
See the views submodule documentation for detailed descriptions of the view properties.
|
inline |
A view that calls seqan3::to_char() on each element in the input range.
urng_t | The type of the range being processed. See below for requirements. [template parameter is omitted in pipe notation] |
[in] | urange | The range being processed. [parameter is omitted in pipe notation] |
Header File
#include <seqan3/alphabet/views/to_char.hpp>
This view is a deep view Given a range-of-range as input (as opposed to just a range), it will apply the transformation on the innermost range (instead of the outermost range).
Concepts and traits | urng_t (underlying range type) | rrng_t (returned range type) |
---|---|---|
std::ranges::input_range | required | preserved |
std::ranges::forward_range | preserved | |
std::ranges::bidirectional_range | preserved | |
std::ranges::random_access_range | preserved | |
std::ranges::contiguous_range | lost | |
std::ranges::viewable_range | required | guaranteed |
std::ranges::view | guaranteed | |
std::ranges::sized_range | preserved | |
std::ranges::common_range | preserved | |
std::ranges::output_range | lost | |
seqan3::const_iterable_range | preserved | |
std::ranges::range_reference_t | seqan3::alphabet | seqan3::alphabet_char_t<std::ranges::range_value_t<urng_t>> |
See the views submodule documentation for detailed descriptions of the view properties.
|
inline |
A view that calls seqan3::to_rank() on each element in the input range.
urng_t | The type of the range being processed. See below for requirements. [template parameter is omitted in pipe notation] |
[in] | urange | The range being processed. [parameter is omitted in pipe notation] |
Header File
#include <seqan3/alphabet/views/to_rank.hpp>
This view is a deep view Given a range-of-range as input (as opposed to just a range), it will apply the transformation on the innermost range (instead of the outermost range).
Concepts and traits | urng_t (underlying range type) | rrng_t (returned range type) |
---|---|---|
std::ranges::input_range | required | preserved |
std::ranges::forward_range | preserved | |
std::ranges::bidirectional_range | preserved | |
std::ranges::random_access_range | preserved | |
std::ranges::contiguous_range | lost | |
std::ranges::viewable_range | required | guaranteed |
std::ranges::view | guaranteed | |
std::ranges::sized_range | preserved | |
std::ranges::common_range | preserved | |
std::ranges::output_range | lost | |
seqan3::const_iterable_range | preserved | |
std::ranges::range_reference_t | seqan3::alphabet | seqan3::alphabet_rank_t<std::ranges::range_value_t<urng_t>> |
See the views submodule documentation for detailed descriptions of the view properties.
We also convert to unsigned here, because the seqan3::alphabet_rank_t is often uint8_t
which is often implemented as unsigned char
and thus will not be printed as a number by default.
|
inlineconstexpr |
A view that translates nucleotide into aminoacid alphabet with 1, 2, 3 or 6 frames.
urng_t | The type of the range being processed. |
[in] | urange | The range being processed. |
[in] | tf | A value of seqan3::tanslation_frames that indicates the desired frames. |
Header File
#include <seqan3/alphabet/views/translate.hpp>
This view can be used to translate nucleotide sequences into aminoacid sequences (see translation_frames for possible combination of frames).
Concepts and traits | urng_t (underlying range type) | rrng_t (returned range type) |
---|---|---|
std::ranges::input_range | required | preserved |
std::ranges::forward_range | required | preserved |
std::ranges::bidirectional_range | required | preserved |
std::ranges::random_access_range | required | preserved |
std::ranges::contiguous_range | lost | |
std::ranges::viewable_range | required | guaranteed |
std::ranges::view | guaranteed | |
std::ranges::sized_range | required | preserved |
std::ranges::common_range | guaranteed | |
std::ranges::output_range | lost | |
seqan3::const_iterable_range | required | preserved |
std::ranges::range_reference_t | seqan3::nucleotide_alphabet | std::ranges::view && std::ranges::random_access_range && std::ranges::sized_range |
urng_t
is the type of the range modified by this view (input).rrng_type
is the type of the range returned by this view.Operating on a range of seqan3::dna5:
|
inlineconstexpr |
A view that translates nucleotide into aminoacid alphabet with 1, 2, 3 or 6 frames. Input and output range are always two-dimensional.
urng_t | The type of the range being processed. |
[in] | urange | The range being processed. Needs to be a range of ranges (two-dimensional). |
[in] | tf | A value of seqan3::tanslation_frames that indicates the desired frames. |
Header File
#include <seqan3/alphabet/views/translate_join.hpp>
This view can be used to translate nucleotide sequences into aminoacid sequences (see translation_frames for possible combination of frames). This view only operates on two-dimensional input (range of ranges) and outputs a range of ranges no matter the number of input sequences or the number of translation frames given. Therefore, it has the same capabilities as the standard view_translate but concatenates the different frames of the different input sequences rather than having a separate range for each input sequence containing the translated frames. In the output, frames are ordered in a way, that all requested frames are listed per sequence directly after each other in the order of input sequences. improved and efficient downstream post-processing if needed. However, the index of a frame for a specific sequence needs to be calculated via modulo operations in this case. The i-th frame of the j-th sequence can be calculated by n = (i * s) + j, where s is the number of frames used for translation (index starting at zero).
In short, this views behaves the same as:
Except that the performance is better and the returned range still models std::ranges::random_access_range and std::ranges::sized_range.
Concepts and traits | urng_t (underlying range type) | rrng_t (returned range type) |
---|---|---|
std::ranges::input_range | required | preserved |
std::ranges::forward_range | required | preserved |
std::ranges::bidirectional_range | required | preserved |
std::ranges::random_access_range | required | preserved |
std::ranges::contiguous_range | lost | |
std::ranges::viewable_range | required | guaranteed |
std::ranges::view | guaranteed | |
std::ranges::sized_range | required | preserved |
std::ranges::common_range | guaranteed | |
std::ranges::output_range | lost | |
seqan3::const_iterable_range | required | preserved |
std::ranges::range_reference_t | seqan3::nucleotide_alphabet | std::ranges::view && std::ranges::random_access_range && std::ranges::sized_range |
urng_t
is the type of the range modified by this view (input).rrng_t
is the type of the range returned by this view.Operating on a range of seqan3::dna5:
|
inlineconstexpr |
A view that translates nucleotide into aminoacid alphabet for one of the six frames.
urng_t | The type of the range being processed. |
[in] | urange | The range being processed. |
[in] | tf | A value of seqan3::translation_frames that indicates the desired frames. |
Header File
#include <seqan3/alphabet/views/translate.hpp>
This view can be used to translate nucleotide sequences into aminoacid sequences (see translation_frames for possible combination of frames).
Concepts and traits | urng_t (underlying range type) | rrng_t (returned range type) |
---|---|---|
std::ranges::input_range | required | preserved |
std::ranges::forward_range | required | preserved |
std::ranges::bidirectional_range | required | preserved |
std::ranges::random_access_range | required | preserved |
std::ranges::contiguous_range | lost | |
std::ranges::viewable_range | required | guaranteed |
std::ranges::view | guaranteed | |
std::ranges::sized_range | required | preserved |
std::ranges::common_range | guaranteed | |
std::ranges::output_range | lost | |
seqan3::const_iterable_range | required | preserved |
std::ranges::range_reference_t | seqan3::nucleotide_alphabet | seqan3::aa27 |
urng_t
is the type of the range modified by this view (input).rrng_type
is the type of the range returned by this view.Operating on a range of seqan3::dna5:
|
inlineconstexpr |
A view that does quality-threshold trimming on a range of seqan3::quality_alphabet.
urng_t | The type of the range being processed. See below for requirements. |
threshold_t | Either std::ranges::range_value_t<urng_t> or seqan3::alphabet_phred_t<std::ranges::range_value_t<urng_t>>. |
[in] | urange | The range being processed. [parameter is omitted in pipe notation] |
[in] | threshold | The minimum quality. |
Header File
#include <seqan3/alphabet/views/trim_quality.hpp>
This view can be used to trim sequences based on quality. Only bases at the end of the sequence not meeting the specified threshold are discarded.
This view is a deep view Given a range-of-range as input (as opposed to just a range), it will apply the transformation on the innermost range (instead of the outermost range).
Concepts and traits | urng_t (underlying range type) | rrng_t (returned range type) |
---|---|---|
std::ranges::input_range | required | preserved |
std::ranges::forward_range | preserved | |
std::ranges::bidirectional_range | preserved | |
std::ranges::random_access_range | preserved | |
std::ranges::view | guaranteed | |
std::ranges::sized_range | lost | |
std::ranges::common_range | lost | |
std::ranges::output_range | preserved | |
seqan3::const_iterable_range | preserved | |
std::ranges::range_reference_t | seqan3::quality_alphabet | std::ranges::range_reference_t<urng_t> |
See the views submodule documentation for detailed descriptions of the view properties.
Operating on a range of seqan3::phred42:
Or operating on a range of seqan3::dna5q:
|
inline |
An identity view that throws if an encountered character is not valid for the given alphabet.
urng_t | The type of the range being processed. See below for requirements. [template parameter is omitted in pipe notation] |
alphabet_t | The alphabet to check validity for; must satisfy seqan3::alphabet. |
[in] | urange | The range being processed. [parameter is omitted in pipe notation] |
seqan3::invalid_char_assignment | if an invalid character is encountered. |
Header File
#include <seqan3/alphabet/views/validate_char_for.hpp>
This view throws if it encounters a character that is not in the valid set of an alphabet. It performs no transformation on the elements of the view itself. However, the contiguous property is lost due to the way it is currently implemented.
This view is a deep view. Given a range-of-range as input (as opposed to just a range), it will apply the transformation on the innermost range (instead of the outermost range).
Concepts and traits | urng_t (underlying range type) | rrng_t (returned range type) |
---|---|---|
std::ranges::input_range | required | preserved |
std::ranges::forward_range | preserved | |
std::ranges::bidirectional_range | preserved | |
std::ranges::random_access_range | preserved | |
std::ranges::contiguous_range | lost | |
std::ranges::viewable_range | required | guaranteed |
std::ranges::view | guaranteed | |
std::ranges::sized_range | preserved | |
std::ranges::common_range | preserved | |
std::ranges::output_range | preserved | |
std::semiregular | preserved | |
seqan3::const_iterable_range | preserved | |
std::ranges::range_reference_t | seqan3::alphabet_char_t<alphabet_t> | std::ranges::range_reference_t<urng_t> |
See the views submodule documentation for detailed descriptions of the view properties.