36namespace bio::ranges::detail
49 return detail::adaptor_from_functor{*
this, tf};
57 template <std::ranges::range urng_t>
60 static_assert(std::ranges::viewable_range<urng_t>,
61 "The range parameter to views::translate_single must be viewable.");
62 static_assert(std::ranges::sized_range<urng_t>,
63 "The range parameter to views::translate_single must model std::ranges::sized_range.");
64 static_assert(std::ranges::random_access_range<urng_t>,
65 "The range parameter to views::translate_single must model std::ranges::random_access_range.");
66 static_assert(alphabet::nucleotide<std::ranges::range_reference_t<urng_t>>,
67 "The range parameter to views::translate_single must be over elements of "
68 "bio::alphabet::alphabet::nucleotide.");
71 small_vector<alphabet::translation_frames, 6> selected_frames{};
85 return detail::view_transform_by_pos{std::forward<urng_t>(urange),
86 trans_fn{.selected_frames = selected_frames},
87 selected_frames.size()};
91 template <std::ranges::range urng_t>
92 constexpr friend auto operator|(urng_t && urange, translate_fn
const & me)
94 return me(std::forward<urng_t>(urange));
102 small_vector<alphabet::translation_frames, 6> selected_frames{};
105 auto operator()(
auto && urange,
size_t const n)
const
107 assert(n < selected_frames.size());
Provides bio::alphabet::aa27, container aliases and string literals.
A wrapper type around an existing view adaptor that enables "deep view" behaviour for that view.
Definition: deep.hpp:104
Provides bio::views::deep.
Provides bio::alphabet::dna5, container aliases and string literals.
translation_frames
Specialisation values for single and multiple translation frames.
Definition: translation.hpp:85
@ REV_FRAME_0
The first reverse frame starting at position 0.
@ REV_FRAME_1
The second reverse frame starting at position 1.
@ FWD_FRAME_2
The third forward frame starting at position 2.
@ FWD_FRAME_1
The second forward frame starting at position 1.
@ REV_FRAME_2
The third reverse frame starting at position 2.
@ FWD_FRAME_0
The first forward frame starting at position 0.
constexpr auto translate_single
A view that translates nucleotide into aminoacid alphabet for one of the six frames.
Definition: translate_single.hpp:225
constexpr auto translate
A view that translates nucleotide into aminoacid alphabet with 1, 2, 3 or 6 frames.
Definition: translate.hpp:177
constexpr translation_frames operator|(translation_frames lhs, translation_frames rhs) noexcept
Binary operators for bio::alphabet::translation_frames.
Definition: translation.hpp:111
The BioC++ namespace for views.
Provides the bio::ranges::detail::random_access_iterator class.
Adaptations of concepts from the standard library.
Auxiliary header for the views submodule .
A constexpr string implementation to manipulate string literals at compile time.
Provides bio::views::translate and bio::views::translate_single.
Provides functions for translating a triplet of nucleotides into an amino acid.
Provides various transformation traits used by the range module.