91 template <
typename urng_t>
97 class view_translate_single
101 struct data_members_t
109 std::shared_ptr<data_members_t> data_members;
112 static constexpr
constexpr_string multiple_frame_error =
"Error: Invalid type of frame. Choose one out of FWD_FRAME_0, " 113 "REV_FRAME_0, FWD_FRAME_1, REV_FRAME_1, FWD_FRAME_2 and REV_FRAME_2.";
129 using iterator = detail::random_access_iterator<view_translate_single const>;
131 using const_iterator = iterator;
137 view_translate_single() =
default;
138 constexpr view_translate_single(view_translate_single
const & rhs) =
default;
139 constexpr view_translate_single(view_translate_single && rhs) =
default;
140 constexpr view_translate_single & operator=(view_translate_single
const & rhs) =
default;
141 constexpr view_translate_single & operator=(view_translate_single && rhs) =
default;
142 ~view_translate_single() =
default;
153 : data_members{
new data_members_t{std::forward<urng_t>(urange), tf}}
155 if (__builtin_popcount(static_cast<uint8_t>(tf)) > 1)
157 throw std::invalid_argument(multiple_frame_error.c_str());
178 iterator begin()
const noexcept
184 iterator
cbegin()
const noexcept
202 iterator end()
const noexcept
204 return {*
this,
size()};
208 iterator
cend()
const noexcept
227 switch (data_members->tf)
245 throw std::invalid_argument(multiple_frame_error.c_str());
270 switch (data_members->tf)
273 return translate_triplet((data_members->urange)[n * 3], (data_members->urange)[n * 3 + 1], (data_members->urange)[n * 3 + 2]);
279 return translate_triplet((data_members->urange)[n * 3 + 1], (data_members->urange)[n * 3 + 2], (data_members->urange)[n * 3 + 3]);
285 return translate_triplet((data_members->urange)[n * 3 + 2], (data_members->urange)[n * 3 + 3], (data_members->urange)[n * 3 + 4]);
291 throw std::invalid_argument(multiple_frame_error.c_str());
298 template <random_access_container_concept container_type>
299 explicit operator container_type()
301 requires std::is_same_v<aa27, value_type_t<container_type>>
312 template <
typename urng_t>
318 view_translate_single(urng_t &&,
translation_frames const) -> view_translate_single<urng_t>;
321 template <
typename urng_t>
327 view_translate_single(urng_t &&) -> view_translate_single<urng_t>;
378 inline constexpr
auto translate_single =
deep{detail::generic_pipable_view_adaptor<detail::view_translate_single>{}};
394 template <
typename urng_t>
404 struct data_members_t
411 std::vector<translation_frames> selected_frames{};
414 std::shared_ptr<data_members_t> data_members;
420 using reference = view_translate_single<urng_t &>;
431 using iterator = detail::random_access_iterator<view_translate const>;
433 using const_iterator = iterator;
443 template <
typename t>
444 requires (dimension_v<t> == dimension_v<value_type> + 1) &&
445 std::is_same_v<remove_cvref_t<innermost_value_type_t<value_type>>,
447 static constexpr
bool is_compatible_this_aux =
true;
456 view_translate() =
default;
457 constexpr view_translate(view_translate
const & rhs) =
default;
458 constexpr view_translate(view_translate && rhs) =
default;
459 constexpr view_translate & operator=(view_translate
const & rhs) =
default;
460 constexpr view_translate & operator=(view_translate && rhs) =
default;
461 ~view_translate() =
default;
468 : data_members{
new data_members_t{std::forward<urng_t>(urange), tf}}
471 data_members->selected_frames.push_back(translation_frames::FWD_FRAME_0);
473 data_members->selected_frames.push_back(translation_frames::FWD_FRAME_1);
475 data_members->selected_frames.push_back(translation_frames::FWD_FRAME_2);
477 data_members->selected_frames.push_back(translation_frames::REV_FRAME_0);
479 data_members->selected_frames.push_back(translation_frames::REV_FRAME_1);
481 data_members->selected_frames.push_back(translation_frames::REV_FRAME_2);
501 iterator begin()
const 527 return {*
this,
size()};
531 iterator
cend()
const 550 return (
size_type) data_members->selected_frames.size();
578 template <random_access_container_concept container_type>
579 explicit operator container_type()
581 requires is_compatible_this_aux<container_type>
593 template <
typename urng_t>
602 template <
typename urng_t>
608 view_translate(urng_t &&) -> view_translate<urng_t>;
659 inline constexpr
auto translate =
deep{detail::generic_pipable_view_adaptor<detail::view_translate>{}};
Provides seqan3::add_enum_bitwise_operators.
constexpr bool add_enum_bitwise_operators< translation_frames >
Enable bitwise operators for enum translation_frames.
Definition: translation.hpp:79
::ranges::cbegin cbegin
Alias for ranges::cbegin. Returns an iterator to the beginning of a range.
Definition: ranges:245
A constexpr string implementation to manipulate string literals at compile time.
constexpr nucleotide_type complement(nucleotide_type const alph) requires requires(nucleotide_type alph)
Implementation of seqan3::nucleotide_concept::complement() that delegates to a member function...
Definition: member_exposure.hpp:220
constexpr auto translate_single
A view that translates nucleotide into aminoacid alphabet for one of the six frames.
Definition: translation.hpp:378
constexpr auto translate
A view that translates nucleotide into aminoacid alphabet with 1, 2, 3 or 6 frames.
Definition: translation.hpp:659
Contains seqan3::aa27, container aliases and string literals.
::ranges::copy copy
Alias for ranges::copy. Copies a range of elements to a new location.
Definition: ranges:200
Contains functions for translating a triplet of nucleotides into an amino acid.
Provides the seqan3::detail::random_access_iterator class.
::ranges::size size
Alias for ranges::size. Obtains the size of a range whose size can be calculated in constant time...
Definition: ranges:195
The main SeqAn3 namespace.
Definition: aligned_sequence_concept.hpp:58
Contains seqan3::dna5, container aliases and string literals.
The twenty-seven letter amino acid alphabet.
Definition: aa27.hpp:67
Provides seqan3::view::deep.
Type metafunction that returns the difference_type of another type [metafunction declaration].
Definition: pre.hpp:172
Auxiliary header for the view submodule .
Adaptations of concepts from the Ranges TS.
The first third and third reverse frame.
The SeqAn3 namespace for views.
Type metafunction that returns the size_type of another type [metafunction declaration].
Definition: pre.hpp:198
The second forward and second reverse frame.
Specifies requirements of a Range type for which begin returns a type that models std::RandomAccessIt...
The second forward frame starting at position 1.
Definition: aligned_sequence_concept.hpp:288
Implements a constexpr string that can be used for compile time computations.
Definition: constexpr_string.hpp:65
Type metafunction that returns the const_reference of another type [metafunction declaration].
Definition: pre.hpp:146
The first forward and first reverse frame.
A wrapper type around an existing view adaptor that enables "deep view" behaviour for that view...
Definition: deep.hpp:129
Type metafunction that returns the reference of another type [metafunction declaration].
Definition: pre.hpp:92
Provides various metafunctions used by the range module.
constexpr aa27 translate_triplet(nucl_type const &n1, nucl_type const &n2, nucl_type const &n3) noexcept
Translate one nucleotide triplet into single amino acid (single nucleotide interface).
Definition: translation.hpp:83
The third forward frame starting at position 2.
The first forward frame starting at position 0.
::ranges::cend cend
Alias for ranges::cend. Returns an iterator to the end of a range.
Definition: ranges:250
The second reverse frame starting at position 1.
Adaptations of concepts from the standard library.
Type metafunction that returns the value_type of another type [metafunction declaration].
Definition: pre.hpp:66
Specifies the requirements of a Range type that knows its size in constant time with the size functio...
The first reverse frame starting at position 0.
translation_frames
Specialisation values for single and multiple translation frames.
Definition: translation.hpp:61
The third reverse frame starting at position 2.
A concept that indicates whether an alphabet represents nucleotides.In addition to the requirements f...