SeqAn3 3.3.0-rc.1
The Modern C++ library for sequence analysis.
edit_distance_fwd.hpp
Go to the documentation of this file.
1// -----------------------------------------------------------------------------------------------------
2// Copyright (c) 2006-2022, Knut Reinert & Freie Universität Berlin
3// Copyright (c) 2016-2022, Knut Reinert & MPI für molekulare Genetik
4// This file may be used, modified and/or redistributed under the terms of the 3-clause BSD-License
5// shipped with this file and also available at: https://github.com/seqan/seqan3/blob/master/LICENSE.md
6// -----------------------------------------------------------------------------------------------------
7
13#pragma once
14
15#include <concepts>
16#include <ranges>
17
24
25namespace seqan3::detail
26{
27template <typename word_t, typename score_t, bool is_semi_global, bool use_max_errors>
28class edit_distance_score_matrix_full; //forward declaration
29
30template <typename word_t, bool is_semi_global, bool use_max_errors>
31class edit_distance_trace_matrix_full; //forward declaration
32
34template <typename state_t, typename...>
36{};
37
39template <bool enabled, typename state_t>
41
46template <bool B, template <typename...> typename T, template <typename...> typename F>
48{
50 template <typename... args_t>
51 struct select : public std::conditional_t<B, T<args_t...>, F<args_t...>>
52 {};
53};
54
58template <std::ranges::viewable_range database_t,
59 std::ranges::viewable_range query_t,
60 typename align_config_t,
61 typename is_semi_global_t,
62 typename word_t = uint_fast64_t>
64{
70 using word_type = word_t;
71 static_assert(std::is_unsigned_v<word_type>, "the word type of edit_distance_unbanded must be unsigned.");
72 static_assert(alignment_traits_type::has_output_configuration, "We assume the result type was configured.");
79
81 static constexpr uint8_t word_size = bits_of<word_type>;
82 static_assert(bits_of<word_type> <= 64u, "we assume at most uint64_t as word_type");
83
85 using database_iterator = std::ranges::iterator_t<database_type>;
91 using result_value_type = typename alignment_result_value_type_accessor<alignment_result_type>::type;
92
95 static constexpr bool use_max_errors = align_config_type::template exists<align_cfg::min_score>();
97 static constexpr bool is_semi_global = is_semi_global_t::value;
99 static constexpr bool is_global = !is_semi_global;
101 static constexpr bool compute_score = true;
105 static constexpr bool compute_begin_positions =
108 static constexpr bool compute_end_positions =
111 static constexpr bool compute_score_matrix = false;
116
121};
122
124template <bool enable_policy, template <typename...> typename policy_t, typename edit_traits, typename derived_t>
127 derived_t>;
128
130template <std::ranges::viewable_range database_t,
131 std::ranges::viewable_range query_t,
132 typename align_config_t,
133 typename traits_t>
134class edit_distance_unbanded; //forward declaration
136
137} // 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:33
The underlying data structure of seqan3::detail::edit_distance_unbanded that represents the trace mat...
Definition: edit_distance_trace_matrix_full.hpp:33
This calculates an alignment using the edit distance and without a band.
Definition: edit_distance_unbanded.hpp:714
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:97
The internal SeqAn3 namespace.
Definition: aligned_sequence_concept.hpp:29
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:127
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:83
static constexpr bool has_output_configuration
Flag indicating if any output option was set.
Definition: alignment/pairwise/detail/type_traits.hpp:171
static constexpr bool compute_sequence_alignment
Flag indicating whether the sequence alignment shall be computed.
Definition: alignment/pairwise/detail/type_traits.hpp:165
static constexpr bool compute_begin_positions
Flag indicating whether the begin positions shall be computed.
Definition: alignment/pairwise/detail/type_traits.hpp:162
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:140
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:134
static constexpr bool compute_end_positions
Flag indicating whether the end positions shall be computed.
Definition: alignment/pairwise/detail/type_traits.hpp:160
The default traits type for the edit distance algorithm.
Definition: edit_distance_fwd.hpp:64
typename alignment_traits_type::original_score_type score_type
The type of the score.
Definition: edit_distance_fwd.hpp:74
word_t word_type
The type of one machine word.
Definition: edit_distance_fwd.hpp:70
static constexpr bool is_global
Whether the alignment is a global alignment or not.
Definition: edit_distance_fwd.hpp:99
std::ranges::iterator_t< database_type > database_iterator
The type of an iterator of the database sequence.
Definition: edit_distance_fwd.hpp:85
static constexpr uint8_t word_size
The size of one machine word.
Definition: edit_distance_fwd.hpp:81
static constexpr bool compute_trace_matrix
Whether the alignment configuration indicates to compute and/or store the trace matrix.
Definition: edit_distance_fwd.hpp:113
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:95
static constexpr bool compute_score_matrix
Whether the alignment configuration indicates to compute and/or store the score matrix.
Definition: edit_distance_fwd.hpp:111
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:115
static constexpr bool compute_score
Whether the alignment configuration indicates to compute and/or store the score.
Definition: edit_distance_fwd.hpp:101
typename alignment_traits_type::alignment_result_type alignment_result_type
The alignment result type generated by the algorithm.
Definition: edit_distance_fwd.hpp:89
static constexpr bool is_semi_global
Whether the alignment is a semi-global alignment or not.
Definition: edit_distance_fwd.hpp:97
static constexpr bool compute_end_positions
Whether the alignment configuration indicates to compute and/or store the end positions.
Definition: edit_distance_fwd.hpp:108
typename alignment_result_value_type_accessor< alignment_result_type >::type result_value_type
The alignment result value type.
Definition: edit_distance_fwd.hpp:91
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:103
static constexpr bool compute_begin_positions
Whether the alignment configuration indicates to compute and/or store the begin positions.
Definition: edit_distance_fwd.hpp:105
An invocable wrapper that defers the instantiation of a crtp_base class.
Definition: deferred_crtp_base.hpp:43
Store no state for state_t.
Definition: edit_distance_fwd.hpp:36
Depending on B, select is the template template parameter T or F.
Definition: edit_distance_fwd.hpp:52
The same as std::conditional but for template template parameters.
Definition: edit_distance_fwd.hpp:48