30namespace bio::ranges::detail
35struct translate_join_fn
43 return detail::adaptor_from_functor{*
this, tf};
51 template <std::ranges::range urng_t>
54 static_assert(range_dimension_v<urng_t> == 2,
55 "This adaptor only handles range-of-range (two dimensions) as input.");
56 static_assert(std::ranges::viewable_range<urng_t>,
57 "The range parameter to views::translate_join must be viewable.");
58 static_assert(std::ranges::viewable_range<std::ranges::range_reference_t<urng_t>>,
59 "The inner range of the range parameter to views::translate_join must be viewable.");
60 static_assert(std::ranges::sized_range<urng_t>,
61 "The range parameter to views::translate_join must model std::ranges::sized_range.");
62 static_assert(std::ranges::sized_range<std::ranges::range_reference_t<urng_t>>,
63 "The inner range of the range parameter to views::translate_join must model "
64 "std::ranges::sized_range.");
65 static_assert(std::ranges::random_access_range<urng_t>,
66 "The range parameter to views::translate_join must model std::ranges::random_access_range.");
67 static_assert(std::ranges::random_access_range<std::ranges::range_reference_t<urng_t>>,
68 "The inner range of the range parameter to views::translate_join must model "
69 "std::ranges::random_access_range.");
70 static_assert(alphabet::nucleotide<std::ranges::range_reference_t<std::ranges::range_reference_t<urng_t>>>,
71 "The range parameter to views::translate_join must be over a range over elements of "
72 "bio::alphabet::nucleotide.");
75 small_vector<alphabet::translation_frames, 6> selected_frames{};
89 size_t size = std::ranges::size(urange) * selected_frames.size();
90 return detail::view_transform_by_pos{
91 std::forward<urng_t>(urange),
92 trans_fn{.size =
size, .selected_frames = selected_frames},
98 template <std::ranges::range urng_t>
99 constexpr friend auto operator|(urng_t && urange, translate_join_fn
const & me)
101 return me(std::forward<urng_t>(urange));
111 small_vector<alphabet::translation_frames, 6> selected_frames{};
114 auto operator()(
auto && urange,
size_t const n)
const
117 size_t index_frame = n % selected_frames.size();
118 size_t index_urange = (n - index_frame) / selected_frames.size();
constexpr auto size
A type trait that holds the size of a (semi-)alphabet.
Definition: concept.hpp:517
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_join
A view that translates nucleotide into aminoacid alphabet with 1, 2, 3 or 6 frames....
Definition: translate_join.hpp:199
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.
A constexpr string implementation to manipulate string literals at compile time.
Provides bio::views::translate and bio::views::translate_single.
Provides various transformation traits used by the range module.