View¶
Meta-header for the view submodule .
- Author
- Hannes Hauswedell <hannes.hauswedell AT fu-berlin.de>
-
namespace
view¶ The SeqAn3 namespace for views.
Since views often have name clashes with regular functions and ranges they are implemented in the sub namespace
view.See the view submodule of the range module for more details.
Provides seqan3::view::char_to.
- Author
- Hannes Hauswedell <hannes.hauswedell AT fu-berlin.de>
-
namespace
view¶ The SeqAn3 namespace for views.
Since views often have name clashes with regular functions and ranges they are implemented in the sub namespace
view.See the view submodule of the range module for more details.
Variables
-
auto const
char_to¶ A view over an alphabet, given a range of characters.
- Return
- A view over alphabet_type, created from it’s character representation.
- View properties
- view type: same input_range
- value type: alphabet_type
constiterable: yes
- Complexity
- Linear in the size if the input range (
). - Exceptions
- Strong exception guarantee (does not modify data).
- Thread safety
- Does not modify data.
- Example
std::string s{"ACTTTGATAN"}; auto v1 = s | view::char_to<dna4>; // == "ACTTTGATAA"_dna4 auto v2 = s | view::char_to<dna5>; // == "ACTTTGATAN"_dna5
- Template Parameters
alphabet_type: The type of the desired alphabet, must satisfy seqan3::alphabet_concept.
- Parameters
input_range: The range you wish to convert, elements must be convertible to alphabet_type’s seqan3::underlying_char_t.
-
auto const
Provides seqan3::view::complement.
- Author
- Hannes Hauswedell <hannes.hauswedell AT fu-berlin.de>
-
namespace
view The SeqAn3 namespace for views.
Since views often have name clashes with regular functions and ranges they are implemented in the sub namespace
view.See the view submodule of the range module for more details.
Variables
-
auto const
complement¶ A view that converts a range of nucleotides to their complement.
dna5_vector foo{"ACGTA"_dna5}; // pipe notation auto v = foo | view::complement; // == "TGCAT" // function notation dna5_vector v2(view::complement(foo)); // == "TGCAT" // generate the reverse complement: dna5_vector v3 = foo | view::complement | ranges::view::reverse; // == "TACGT"
- View properties
- view type: same as input_range
- value type: remove_reference_t<value_type_t<input_range>>
constiterable: yes
- Complexity
- Linear in the size if the input range (
). - Exceptions
- Strong exception guarantee (does not modify data).
- Thread safety
- Does not modify data.
- Example
- Parameters
input_range: The range you wish to convert, must satisfy seqan3::input_range_concept and the value_type must satisfy seqan3::nucleotide_concept.
-
auto const
Adaptation of the view concept from the Ranges TS.
- Author
- Hannes Hauswedell <hannes.hauswedell AT fu-berlin.de>
-
namespace
seqan3¶ The main SeqAn3 namespace.
Helpers for seqan3::semi_alphabet_concept
These functions and metafunctions expose member variables and types so that they satisfy seqan3::semi_alphabet_concept.
Helpers for seqan3::alphabet_concept
These functions and metafunctions expose member variables and types so that they satisfy seqan3::alphabet_concept.
Helpers for seqan3::nucleotide_concept
These functions and metafunctions expose member variables and types so that they satisfy seqan3::nucleotide_concept.
Alphabet aliases
Other names (typedefs) for seqan3::nucl16
Range concepts
Adapted from the Ranges TS.
Container concepts
Container concepts as defined by the standard library (or very close).
Container-of-container concepts
Shortcuts for multi-dimensional container concepts.
Variables
-
concept bool seqan3::view_concept= range_concept<type> && (bool)ranges::View<type>() Specifies the requirements of a Range type that has constant time copy, move and assignment operators.
-
Provides seqan3::view::convert.
- Author
- Hannes Hauswedell <hannes.hauswedell AT fu-berlin.de>
-
namespace
view The SeqAn3 namespace for views.
Since views often have name clashes with regular functions and ranges they are implemented in the sub namespace
view.See the view submodule of the range module for more details.
Variables
-
auto const
convert¶ A view that converts each element in the input range (implicitly or via
static_cast).Convert from
inttobool:// convert from int to bool std::vector<int> vec{7, 5, 0, 5, 0, 0, 4, 8, -3}; // pipe notation auto v = vec | view::convert<bool>; // == [1, 1, 0, 1, 0, 0, 1, 1, 1]; // function notation and immediate conversion to vector again std::vector<bool> v2(view::convert<bool>(vec)); // combinability auto v3 = vec | view::convert<bool> | ranges::view::reverse; // == [1, 1, 1, 0, 0, 1, 0, 1, 1];
- Return
- A view with the value_type being
out_t - View properties
- view type: same input_range
- value type: out_t
constiterable: yes
- Complexity
- Linear in the size if the input range (
). - Exceptions
- Strong exception guarantee (does not modify data).
- Thread safety
- Does not modify data.
- Example
- Template Parameters
out_t: The type to convert to (must be given).
- Parameters
input_range: The range you wish to convert, must satisfy seqan3::input_range_concept.
Convert from seqan3::nucl16 to seqan3::dna5:
nucl16_vector vec2{"ACYGTN"_nucl16}; auto v4 = vec2 | view::convert<dna5>; // == "ACNGTN"_dna5
-
auto const
Provides seqan3::view::rank_to.
- Author
- Hannes Hauswedell <hannes.hauswedell AT fu-berlin.de>
-
namespace
view The SeqAn3 namespace for views.
Since views often have name clashes with regular functions and ranges they are implemented in the sub namespace
view.See the view submodule of the range module for more details.
Variables
-
auto const
rank_to¶ A view over an alphabet, given a range of ranks.
- Return
- A view over alphabet_type, created from it’s rank representation.
- View properties
- view type: same input_range
- value type: alphabet_type
constiterable: yes
- Complexity
- Linear in the size if the input range (
). - Exceptions
- Strong exception guarantee (does not modify data).
- Thread safety
- Does not modify data.
- Example
std::vector<int> vec{0, 1, 3, 3, 3, 2, 0, 3, 0}; auto v1 = vec | view::rank_to<dna4>; // == "ACTTTGATA"_dna4 auto v2 = vec | view::rank_to<dna5>; // == "ACTTTGATA"_dna5
- Template Parameters
alphabet_type: The type of the desired alphabet, must satisfy seqan3::alphabet_concept.
- Parameters
input_range: The range you wish to convert, elements be must convertible to alphabet_type’s seqan3::underlying_rank_t.
-
auto const
Provides seqan3::view::to_char.
- Author
- Hannes Hauswedell <hannes.hauswedell AT fu-berlin.de>
-
namespace
view The SeqAn3 namespace for views.
Since views often have name clashes with regular functions and ranges they are implemented in the sub namespace
view.See the view submodule of the range module for more details.
Variables
-
auto const
to_char¶ A view that calls seqan3::to_char() on each element in the input range.
- Return
- A view with the value_type being seqan3::underlying_char_t of the input alphabet.
- View properties
- view type: same input_range
- value type: seqan3::underlying_char_t of the input’s value_type
constiterable: yes
- Complexity
- Linear in the size if the input range (
). - Exceptions
- Strong exception guarantee (does not modify data).
- Thread safety
- Does not modify data.
- Example
dna4_vector vec = "ACTTTGATA"_dna4; auto v = vec | view::to_char; std::cout << v << '\n'; // [A,C,T,T,T,G,A,T,A] std::vector<illumina18> qvec{{0}, {7}, {5}, {3}, {7}, {4}, {30}, {16}, {23}}; auto v3 = qvec | view::to_char; std::cout << v3 << '\n'; // [!,(,&,$,(,%,?,1,8] std::vector<dna4q> qcvec{{dna4::C, 0}, {dna4::A, 7}, {dna4::G, 5}, {dna4::T, 3}, {dna4::G, 7}, {dna4::A, 4}, {dna4::C, 30}, {dna4::T, 16}, {dna4::A, 23}}; auto v4 = qcvec | view::to_char; std::cout << v4 << '\n'; // [C,A,G,T,G,A,C,T,A]- Parameters
input_range: The range you wish to convert, must satisfy seqan3::input_range_concept and the value_type must satisfy seqan3::alphabet_concept.
-
auto const
Provides seqan3::view::to_rank.
- Author
- Hannes Hauswedell <hannes.hauswedell AT fu-berlin.de>
-
namespace
view The SeqAn3 namespace for views.
Since views often have name clashes with regular functions and ranges they are implemented in the sub namespace
view.See the view submodule of the range module for more details.
Variables
-
auto const
to_rank¶ A view that calls seqan3::to_rank() on each element in the input range.
- Return
- A view with the value_type being seqan3::underlying_rank_t of the input alphabet.
- View properties
- view type: same input_range
- value type: seqan3::underlying_rank_t of the input’s value_type
constiterable: yes
- Complexity
- Linear in the size if the input range (
). - Exceptions
- Strong exception guarantee (does not modify data).
- Thread safety
- Does not modify data.
- Example
- We also convert to unsigned here, because the seqan3::underlying_rank_t is often
dna4_vector vec = "ACTTTGATA"_dna4; auto v = vec | view::to_rank | view::convert<unsigned>; std::cout << v << '\n'; // [0,1,3,3,3,2,0,3,0] std::vector<illumina18> qvec{{0}, {7}, {5}, {3}, {7}, {4}, {30}, {16}, {23}}; auto v3 = qvec | view::to_rank | view::convert<unsigned>; std::cout << v3 << '\n'; // [0,7,5,3,7,4,30,16,23] std::vector<dna4q> qcvec{{dna4::C, 0}, {dna4::A, 7}, {dna4::G, 5}, {dna4::T, 3}, {dna4::G, 7}, {dna4::A, 4}, {dna4::C, 30}, {dna4::T, 16}, {dna4::A, 23}}; auto v4 = qcvec | view::to_rank | view::convert<unsigned>; std::cout << v4 << '\n'; // [1,28,22,15,30,16,121,67,92]
uint8_twhich is often implemented asunsigned charand thus will not be printed as a number by default. - Parameters
input_range: The range you wish to convert, must satisfy seqan3::input_range_concept and the value_type must satisfy seqan3::alphabet_concept.
-
auto const