SeqAn3 3.4.0-rc.1
The Modern C++ library for sequence analysis.
Loading...
Searching...
No Matches
edit_distance_fwd.hpp
Go to the documentation of this file.
1// SPDX-FileCopyrightText: 2006-2024 Knut Reinert & Freie Universität Berlin
2// SPDX-FileCopyrightText: 2016-2024 Knut Reinert & MPI für molekulare Genetik
3// SPDX-License-Identifier: BSD-3-Clause
4
10#pragma once
11
12#include <concepts>
13#include <ranges>
14
21
22namespace seqan3::detail
23{
24template <typename word_t, typename score_t, bool is_semi_global, bool use_max_errors>
25class edit_distance_score_matrix_full; //forward declaration
26
27template <typename word_t, bool is_semi_global, bool use_max_errors>
28class edit_distance_trace_matrix_full; //forward declaration
29
31template <typename state_t, typename...>
32struct empty_state
33{};
34
36template <bool enabled, typename state_t>
38
43template <bool B, template <typename...> typename T, template <typename...> typename F>
44struct selector
45{
47 template <typename... args_t>
48 struct select : public std::conditional_t<B, T<args_t...>, F<args_t...>>
49 {};
50};
51
55template <std::ranges::viewable_range database_t,
56 std::ranges::viewable_range query_t,
57 typename align_config_t,
58 typename is_semi_global_t,
59 typename word_t = uint_fast64_t>
60struct default_edit_distance_trait_type
61{
63 using align_config_type = std::remove_reference_t<align_config_t>;
65 using alignment_traits_type = alignment_configuration_traits<align_config_type>;
67 using word_type = word_t;
68 static_assert(std::is_unsigned_v<word_type>, "the word type of edit_distance_unbanded must be unsigned.");
69 static_assert(alignment_traits_type::has_output_configuration, "We assume the result type was configured.");
71 using score_type = typename alignment_traits_type::original_score_type;
73 using database_type = std::remove_reference_t<database_t>;
75 using query_type = std::remove_reference_t<query_t>;
76
78 static constexpr uint8_t word_size = bits_of<word_type>;
79 static_assert(bits_of<word_type> <= 64u, "we assume at most uint64_t as word_type");
80
82 using database_iterator = std::ranges::iterator_t<database_type>;
86 using alignment_result_type = typename alignment_traits_type::alignment_result_type;
88 using result_value_type = typename alignment_result_value_type_accessor<alignment_result_type>::type;
89
92 static constexpr bool use_max_errors = align_config_type::template exists<align_cfg::min_score>();
94 static constexpr bool is_semi_global = is_semi_global_t::value;
96 static constexpr bool is_global = !is_semi_global;
98 static constexpr bool compute_score = true;
100 static constexpr bool compute_sequence_alignment = alignment_traits_type::compute_sequence_alignment;
102 static constexpr bool compute_begin_positions =
103 alignment_traits_type::compute_begin_positions || compute_sequence_alignment;
105 static constexpr bool compute_end_positions =
106 alignment_traits_type::compute_end_positions || compute_begin_positions;
108 static constexpr bool compute_score_matrix = false;
110 static constexpr bool compute_trace_matrix = compute_begin_positions || compute_sequence_alignment;
112 static constexpr bool compute_matrix = compute_score_matrix || compute_trace_matrix;
113
115 using trace_matrix_type = edit_distance_trace_matrix_full<word_type, is_semi_global, use_max_errors>;
117 using score_matrix_type = edit_distance_score_matrix_full<word_type, score_type, is_semi_global, use_max_errors>;
118};
119
121template <bool enable_policy, template <typename...> typename policy_t, typename edit_traits, typename derived_t>
122using edit_distance_base = invoke_deferred_crtp_base<
123 deferred_crtp_base<selector<enable_policy, policy_t, empty_state>::template select, edit_traits>,
124 derived_t>;
125
127template <std::ranges::viewable_range database_t,
128 std::ranges::viewable_range query_t,
129 typename align_config_t,
130 typename traits_t>
131class edit_distance_unbanded; //forward declaration
133
134} // namespace seqan3::detail
Provides seqan3::align_cfg::min_score configuration.
Provides seqan3::detail::align_result_selector.
Provides helper type traits for the configuration and execution of the alignment algorithm.
Provides utility functions for bit twiddling.
Provides seqan3::detail::deferred_crtp_base.
Provides platform and dependency checks.
Hide me