16 #include <type_traits>
36 namespace seqan3::detail
45 template <
typename first_t,
typename second_t>
46 struct alignment_type;
49 template <
typename first_t,
typename second_t>
50 requires std::ranges::random_access_range<first_t> &&
51 std::ranges::sized_range<first_t> &&
52 std::ranges::random_access_range<second_t> &&
53 std::ranges::sized_range<second_t>
54 struct alignment_type<first_t, second_t>
66 template <std::ranges::forward_range first_range_t,
67 std::ranges::forward_range second_range_t,
68 typename configuration_t>
70 requires is_type_specialisation_of_v<remove_cvref_t<configuration_t>, configuration>
72 struct align_result_selector
76 using score_type =
typename alignment_configuration_traits<configuration_t>::original_score_t;
79 static constexpr
auto select()
81 static_assert(configuration_t::template exists<align_cfg::result>());
83 if constexpr (configuration_t::template exists<align_cfg::result<with_back_coordinate_type, score_type>>())
85 return alignment_result_value_type<uint32_t,
87 alignment_coordinate>{};
89 else if constexpr (configuration_t::template exists<align_cfg::result<with_front_coordinate_type, score_type>>())
91 return alignment_result_value_type<uint32_t,
94 alignment_coordinate>{};
96 else if constexpr (configuration_t::template exists<align_cfg::result<with_alignment_type, score_type>>())
99 using first_gapped_seq_type = gapped<value_type_t<first_range_t>>;
100 using second_gapped_seq_type = gapped<value_type_t<second_range_t>>;
106 using decorator_t = alignment_type<first_range_t, second_range_t>;
108 return alignment_result_value_type<uint32_t,
110 alignment_coordinate,
111 alignment_coordinate,
112 detail::transformation_trait_or_t<decorator_t, fallback_t>>{};
116 return alignment_result_value_type<uint32_t, score_type>{};
121 template <
typename alignment_result_value_t>
122 static constexpr
auto augment_if_debug(alignment_result_value_t)
124 if constexpr (configuration_t::template exists<detail::debug_mode>())
126 using as_type_list = transfer_template_args_onto_t<alignment_result_value_t, type_list>;
127 using score_matrix_t = two_dimensional_matrix<std::optional<score_type>,
129 matrix_major_order::column>;
130 using trace_matrix_t = two_dimensional_matrix<std::optional<trace_directions>,
132 matrix_major_order::column>;
134 if constexpr (configuration_t::template exists<align_cfg::result<with_alignment_type>>())
136 using with_score_t = list_traits::replace_at<score_matrix_t, 5, as_type_list>;
137 return transfer_template_args_onto_t<list_traits::replace_at<trace_matrix_t, 6, with_score_t>,
138 alignment_result_value_type>{};
142 return transfer_template_args_onto_t<list_traits::replace_at<score_matrix_t, 5, as_type_list>,
143 alignment_result_value_type>{};
148 return alignment_result_value_t{};
154 using type = decltype(augment_if_debug(select()));