33template <std::ranges::view urng_t>
34 requires std::ranges::sized_range<urng_t> && std::ranges::random_access_range<urng_t>
38template <std::ranges::view urng_t>
39 requires std::ranges::sized_range<urng_t> && std::ranges::random_access_range<urng_t>
111 template <std::ranges::range urng_t>
114 static_assert(std::ranges::viewable_range<urng_t>,
115 "The range parameter to views::translate[_single] cannot be a temporary of a non-view range.");
116 static_assert(std::ranges::sized_range<urng_t>,
117 "The range parameter to views::translate[_single] must model std::ranges::sized_range.");
118 static_assert(std::ranges::random_access_range<urng_t>,
119 "The range parameter to views::translate[_single] must model std::ranges::random_access_range.");
122 "The range parameter to views::translate[_single] must be over elements of seqan3::nucleotide_alphabet.");
131 template <std::ranges::range urng_t>
134 return me(std::forward<urng_t>(urange));
148template <std::ranges::view urng_t>
149 requires std::ranges::sized_range<urng_t> && std::ranges::random_access_range<urng_t>
160 "forward_frame0, reverse_frame0, forward_frame1, "
161 "reverse_frame1, forward_frame2 and reverse_frame2."};
202 urange{std::move(_urange)},
205 if (__builtin_popcount(
static_cast<uint8_t
>(_tf)) > 1)
219 template <
typename rng_t>
221 && std::ranges::viewable_range<rng_t>
270 return {*
this,
size()};
276 return {*
this,
size()};
298 return std::ranges::size(
urange) / 3;
303 return (std::max<size_type>(std::ranges::size(
urange), 1) - 1) / 3;
308 return (std::max<size_type>(std::ranges::size(
urange), 2) - 2) / 3;
324 return std::ranges::size(
urange) / 3;
329 return (std::max<size_type>(std::ranges::size(
urange), 1) - 1) / 3;
334 return (std::max<size_type>(std::ranges::size(
urange), 2) - 2) / 3;
456template <
typename urng_t>
460template <
typename urng_t>
539template <std::ranges::view urng_t>
540 requires std::ranges::sized_range<urng_t> && std::ranges::random_access_range<urng_t>
580 template <
typename t>
581 requires (range_dimension_v<t> == range_dimension_v<value_type> + 1)
584 static constexpr bool is_compatible_this_aux =
true;
604 urange{std::move(_urange)},
625 template <
typename rng_t>
626 requires (!std::same_as<std::remove_cvref_t<rng_t>,
view_translate>) && std::ranges::viewable_range<rng_t>
629 view_translate{std::views::all(std::forward<rng_t>(_urange)), _tf}
675 return {*
this,
size()};
681 return {*
this,
size()};
740template <
typename urng_t>
741 requires std::ranges::sized_range<urng_t> && std::ranges::random_access_range<urng_t>
Provides seqan3::aa27, container aliases and string literals.
Provides seqan3::detail::adaptor_from_functor.
Provides seqan3::add_enum_bitwise_operators.
The twenty-seven letter amino acid alphabet.
Definition aa27.hpp:43
Template for range adaptor closure objects that store arguments and wrap a proto-adaptor.
Definition adaptor_from_functor.hpp:54
A generic random access iterator that delegates most operations to the range.
Definition random_access_iterator.hpp:288
The return type of seqan3::views::translate_single.
Definition translate.hpp:152
const_reference operator[](size_type const n) const
This is an overloaded member function, provided for convenience. It differs from the above function o...
Definition translate.hpp:407
size_type size() const
This is an overloaded member function, provided for convenience. It differs from the above function o...
Definition translate.hpp:317
reference operator[](size_type const n)
Return the n-th element.
Definition translate.hpp:360
size_type size()
Returns the number of elements in the view.
Definition translate.hpp:291
translation_frames tf
The frame that should be used for translation.
Definition translate.hpp:157
iterator end() noexcept
Returns an iterator to the element following the last element of the container.
Definition translate.hpp:268
std::ranges::range_difference_t< urng_t > difference_type
A signed integer type, usually std::ptrdiff_t.
Definition translate.hpp:176
static constexpr small_string multiple_frame_error
Error thrown if tried to be used with multiple frames.
Definition translate.hpp:159
view_translate_single() noexcept=default
Defaulted.
iterator begin() noexcept
Returns an iterator to the first element of the container.
Definition translate.hpp:244
urng_t urange
The input range (of ranges).
Definition translate.hpp:155
view_translate_single(rng_t &&_urange, translation_frames const _tf=translation_frames::forward_frame0)
Construct from another range.
Definition translate.hpp:223
const_iterator end() const noexcept
This is an overloaded member function, provided for convenience. It differs from the above function o...
Definition translate.hpp:274
const_iterator begin() const noexcept
This is an overloaded member function, provided for convenience. It differs from the above function o...
Definition translate.hpp:250
std::ranges::range_size_t< urng_t > size_type
The size_type.
Definition translate.hpp:174
The return type of seqan3::views::translate.
Definition translate.hpp:543
const_reference operator[](size_type const n) const
This is an overloaded member function, provided for convenience. It differs from the above function o...
Definition translate.hpp:731
translation_frames tf
The frames that should be used for translation.
Definition translate.hpp:548
view_translate(rng_t &&_urange, translation_frames const _tf)
Construct from another range.
Definition translate.hpp:628
view_translate() noexcept=default
Defaulted.
std::ranges::range_difference_t< urng_t > difference_type
A signed integer type, usually std::ptrdiff_t.
Definition translate.hpp:565
const_iterator begin() const noexcept
This is an overloaded member function, provided for convenience. It differs from the above function o...
Definition translate.hpp:655
reference operator[](size_type const n)
Return the n-th element.
Definition translate.hpp:724
small_vector< translation_frames, 6 > selected_frames
The selected frames corresponding to the frames required.
Definition translate.hpp:550
size_type size() noexcept
Returns the number of elements in the view.
Definition translate.hpp:695
view_translate_single< urng_t > reference
The reference_type.
Definition translate.hpp:557
iterator begin() noexcept
Returns an iterator to the first element of the container.
Definition translate.hpp:649
std::ranges::range_size_t< urng_t > size_type
The size_type.
Definition translate.hpp:563
iterator end() noexcept
Returns an iterator to the element following the last element of the container.
Definition translate.hpp:673
urng_t urange
The data members of view_translate_single.
Definition translate.hpp:546
const_iterator end() const noexcept
This is an overloaded member function, provided for convenience. It differs from the above function o...
Definition translate.hpp:679
size_type size() const noexcept
This is an overloaded member function, provided for convenience. It differs from the above function o...
Definition translate.hpp:701
Implements a small string that can be used for compile time computations.
Definition small_string.hpp:41
constexpr char const * c_str() const noexcept
Returns the content represented as 0-terminated c-style string.
Definition small_string.hpp:342
A constexpr vector implementation with dynamic size at compile time.
Definition small_vector.hpp:44
constexpr void push_back(value_type const value) noexcept
Appends the given element value to the end of the container.
Definition small_vector.hpp:847
constexpr size_type size() const noexcept
Returns the number of elements in the container, i.e. std::distance(begin(), end()).
Definition small_vector.hpp:571
A wrapper type around an existing view adaptor that enables "deep view" behaviour for that view.
Definition deep.hpp:101
Provides various transformation traits used by the range module.
Provides seqan3::views::deep.
Provides seqan3::dna5, container aliases and string literals.
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:52
constexpr auto complement
Return the complement of a nucleotide object.
Definition alphabet/nucleotide/concept.hpp:102
constexpr auto translate
A view that translates nucleotide into aminoacid alphabet with 1, 2, 3 or 6 frames.
Definition translate.hpp:800
constexpr auto translate_single
A view that translates nucleotide into aminoacid alphabet for one of the six frames.
Definition translate.hpp:520
typename range_innermost_value< t >::type range_innermost_value_t
Shortcut for seqan3::range_innermost_value (transformation_trait shortcut).
Definition core/range/type_traits.hpp:95
@ single
The text is a single range.
Definition search/fm_index/concept.hpp:90
A concept that indicates whether an alphabet represents nucleotides.
The internal SeqAn3 namespace.
Definition aligned_sequence_concept.hpp:26
view_translate(urng_t &&, translation_frames const) -> view_translate< std::views::all_t< urng_t > >
Class template argument deduction for view_translate.
view_translate_single(urng_t &&, translation_frames const) -> view_translate_single< std::views::all_t< urng_t > >
Class template argument deduction for view_translate_single.
The SeqAn namespace for views.
Definition char_strictly_to.hpp:19
The main SeqAn3 namespace.
Definition aligned_sequence_concept.hpp:26
constexpr bool add_enum_bitwise_operators< translation_frames >
Enable bitwise operators for enum translation_frames.
Definition translate.hpp:78
translation_frames
Specialisation values for single and multiple translation frames.
Definition translate.hpp:59
@ forward_frame2
The third forward frame starting at position 2.
@ forward_frame0
The first forward frame starting at position 0.
@ reverse_frames
All reverse frames.
@ forward_frames
All forward frames.
@ reverse_frame0
The first reverse frame starting at position 0.
@ forward_reverse2
The first third and third reverse frame.
@ reverse_frame2
The third reverse frame starting at position 2.
@ forward_frame1
The second forward frame starting at position 1.
@ reverse_frame1
The second reverse frame starting at position 1.
@ forward_reverse0
The first forward and first reverse frame.
@ forward_reverse1
The second forward and second reverse frame.
A constexpr string implementation to manipulate string literals at compile time.
Definition of the range adaptor object type for seqan3::views::translate and seqan3::views::translate...
Definition translate.hpp:95
constexpr auto operator()(translation_frames const tf=default_frames) const
Store the argument and return a range adaptor closure object.
Definition translate.hpp:101
constexpr auto operator()(urng_t &&urange, translation_frames const tf=default_frames) const
Directly return an instance of the view, initialised with the given parameters.
Definition translate.hpp:112
static constexpr translation_frames default_frames
The default frames parameter for the translation view adaptors.
Definition translate.hpp:97
constexpr friend auto operator|(urng_t &&urange, translate_fn const &me)
This adaptor is usable without setting the frames parameter in which case the default is chosen.
Definition translate.hpp:132
Provides functions for translating a triplet of nucleotides into an amino acid.