SeqAn3 3.4.0-rc.1
The Modern C++ library for sequence analysis.
Loading...
Searching...
No Matches
edit_distance_algorithm.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 <tuple>
13
17
18namespace seqan3::detail
19{
20
35template <typename config_t, typename traits_t>
37{
38private:
43
44 static_assert(!std::same_as<alignment_result_type, empty_type>, "Alignment result type was not configured.");
45
46public:
50 constexpr edit_distance_algorithm() = default;
51 constexpr edit_distance_algorithm(edit_distance_algorithm const &) = default;
56
68 constexpr edit_distance_algorithm(config_t const & cfg) : cfg_ptr{new config_t(cfg)}
69 {}
71
87 template <indexed_sequence_pair_range indexed_sequence_pairs_t, typename callback_t>
88 requires std::invocable<callback_t, alignment_result_type>
89 constexpr void operator()(indexed_sequence_pairs_t && indexed_sequence_pairs, callback_t && callback)
90 {
91 using std::get;
92
93 for (auto && [sequence_pair, index] : indexed_sequence_pairs)
95 get<0>(sequence_pair),
96 get<1>(sequence_pair),
97 std::forward<callback_t>(callback));
98 }
99
100private:
112 template <std::ranges::forward_range first_range_t, std::ranges::forward_range second_range_t, typename callback_t>
113 constexpr void compute_single_pair(size_t const idx,
114 first_range_t && first_range,
115 second_range_t && second_range,
116 callback_t && callback)
117 {
118 using edit_traits = default_edit_distance_trait_type<first_range_t,
119 second_range_t,
120 config_t,
121 typename traits_t::is_semi_global_type>;
122 edit_distance_unbanded algo{first_range, second_range, *cfg_ptr, edit_traits{}};
123 algo(idx, callback);
124 }
125
128};
129
130} // namespace seqan3::detail
Provides seqan3::align_cfg::edit_scheme.
Provides concepts needed internally for the alignment algorithms.
This algorithm unifies different edit distance implementations and uses the appropriate one depending...
Definition edit_distance_algorithm.hpp:37
~edit_distance_algorithm()=default
Defaulted.
constexpr edit_distance_algorithm & operator=(edit_distance_algorithm &&)=default
Defaulted.
constexpr edit_distance_algorithm(edit_distance_algorithm const &)=default
Defaulted.
std::shared_ptr< std::remove_cvref_t< config_t > > cfg_ptr
The alignment configuration stored on the heap.
Definition edit_distance_algorithm.hpp:127
constexpr void compute_single_pair(size_t const idx, first_range_t &&first_range, second_range_t &&second_range, callback_t &&callback)
Invokes the actual alignment computation for a single pair of sequences.
Definition edit_distance_algorithm.hpp:113
constexpr edit_distance_algorithm(edit_distance_algorithm &&)=default
Defaulted.
constexpr void operator()(indexed_sequence_pairs_t &&indexed_sequence_pairs, callback_t &&callback)
}
Definition edit_distance_algorithm.hpp:89
constexpr edit_distance_algorithm & operator=(edit_distance_algorithm const &)=default
Defaulted.
typename configuration_traits_type::alignment_result_type alignment_result_type
The configured alignment result type.
Definition edit_distance_algorithm.hpp:42
constexpr edit_distance_algorithm(config_t const &cfg)
Constructs the wrapper with the passed configuration.
Definition edit_distance_algorithm.hpp:68
constexpr edit_distance_algorithm()=default
Defaulted.
This calculates an alignment using the edit distance and without a band.
Definition edit_distance_unbanded.hpp:711
Provides a pairwise alignment algorithm for edit distance but without band.
A helper concept to check if a type is a sequence pair.
The internal SeqAn3 namespace.
Definition aligned_sequence_concept.hpp:26
A traits type for the alignment algorithm that exposes static information stored within the alignment...
Definition alignment/pairwise/detail/type_traits.hpp:80
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
The default traits type for the edit distance algorithm.
Definition edit_distance_fwd.hpp:61
Hide me