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...>
33{};
34
36template <bool enabled, typename state_t>
38
43template <bool B, template <typename...> typename T, template <typename...> typename F>
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>
61{
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.");
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>;
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;
102 static constexpr bool compute_begin_positions =
105 static constexpr bool compute_end_positions =
108 static constexpr bool compute_score_matrix = false;
113
118};
119
121template <bool enable_policy, template <typename...> typename policy_t, typename edit_traits, typename derived_t>
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.
The underlying data structure of seqan3::detail::edit_distance_unbanded that represents the score mat...
Definition edit_distance_score_matrix_full.hpp:30
The underlying data structure of seqan3::detail::edit_distance_unbanded that represents the trace mat...
Definition edit_distance_trace_matrix_full.hpp:30
This calculates an alignment using the edit distance and without a band.
Definition edit_distance_unbanded.hpp:711
Provides seqan3::detail::deferred_crtp_base.
typename deferred_crtp_base_t::template invoke< derived_t > invoke_deferred_crtp_base
Template alias to instantiate the deferred crtp base with the derived class.
Definition deferred_crtp_base.hpp:94
The internal SeqAn3 namespace.
Definition aligned_sequence_concept.hpp:26
invoke_deferred_crtp_base< deferred_crtp_base< selector< enable_policy, policy_t, empty_state >::template select, edit_traits >, derived_t > edit_distance_base
A base class for edit_distance_unbanded.
Definition edit_distance_fwd.hpp:124
Provides platform and dependency checks.
A traits type for the alignment algorithm that exposes static information stored within the alignment...
Definition alignment/pairwise/detail/type_traits.hpp:80
static constexpr bool has_output_configuration
Flag indicating if any output option was set.
Definition alignment/pairwise/detail/type_traits.hpp:167
static constexpr bool compute_sequence_alignment
Flag indicating whether the sequence alignment shall be computed.
Definition alignment/pairwise/detail/type_traits.hpp:161
static constexpr bool compute_begin_positions
Flag indicating whether the begin positions shall be computed.
Definition alignment/pairwise/detail/type_traits.hpp:158
decltype(determine_alignment_result_type()) alignment_result_type
The alignment result type if present. Otherwise seqan3::detail::empty_type.
Definition alignment/pairwise/detail/type_traits.hpp:137
typename std::remove_reference_t< decltype(std::declval< configuration_t >().get_or(align_cfg::score_type< int32_t >{}))>::type original_score_type
The original score type selected by the user.
Definition alignment/pairwise/detail/type_traits.hpp:131
static constexpr bool compute_end_positions
Flag indicating whether the end positions shall be computed.
Definition alignment/pairwise/detail/type_traits.hpp:156
The default traits type for the edit distance algorithm.
Definition edit_distance_fwd.hpp:61
typename alignment_traits_type::original_score_type score_type
The type of the score.
Definition edit_distance_fwd.hpp:71
word_t word_type
The type of one machine word.
Definition edit_distance_fwd.hpp:67
static constexpr bool is_global
Whether the alignment is a global alignment or not.
Definition edit_distance_fwd.hpp:96
std::ranges::iterator_t< database_type > database_iterator
The type of an iterator of the database sequence.
Definition edit_distance_fwd.hpp:82
static constexpr uint8_t word_size
The size of one machine word.
Definition edit_distance_fwd.hpp:78
static constexpr bool compute_trace_matrix
Whether the alignment configuration indicates to compute and/or store the trace matrix.
Definition edit_distance_fwd.hpp:110
static constexpr bool use_max_errors
When true the computation will use the ukkonen trick with the last active cell and bounds the error t...
Definition edit_distance_fwd.hpp:92
static constexpr bool compute_score_matrix
Whether the alignment configuration indicates to compute and/or store the score matrix.
Definition edit_distance_fwd.hpp:108
static constexpr bool compute_matrix
Whether the alignment configuration indicates to compute and/or store the score or trace matrix.
Definition edit_distance_fwd.hpp:112
static constexpr bool compute_score
Whether the alignment configuration indicates to compute and/or store the score.
Definition edit_distance_fwd.hpp:98
typename alignment_traits_type::alignment_result_type alignment_result_type
The alignment result type generated by the algorithm.
Definition edit_distance_fwd.hpp:86
static constexpr bool is_semi_global
Whether the alignment is a semi-global alignment or not.
Definition edit_distance_fwd.hpp:94
static constexpr bool compute_end_positions
Whether the alignment configuration indicates to compute and/or store the end positions.
Definition edit_distance_fwd.hpp:105
typename alignment_result_value_type_accessor< alignment_result_type >::type result_value_type
The alignment result value type.
Definition edit_distance_fwd.hpp:88
static constexpr bool compute_sequence_alignment
Whether the alignment configuration indicates to compute and/or store the alignment of the sequences.
Definition edit_distance_fwd.hpp:100
static constexpr bool compute_begin_positions
Whether the alignment configuration indicates to compute and/or store the begin positions.
Definition edit_distance_fwd.hpp:102
An invocable wrapper that defers the instantiation of a crtp_base class.
Definition deferred_crtp_base.hpp:40
Store no state for state_t.
Definition edit_distance_fwd.hpp:33
Depending on B, select is the template template parameter T or F.
Definition edit_distance_fwd.hpp:49
The same as std::conditional but for template template parameters.
Definition edit_distance_fwd.hpp:45
Hide me