Loading...
Searching...
No Matches
edit_distance_algorithm.hpp
Go to the documentation of this file.
// SPDX-FileCopyrightText: 2006-2025 Knut Reinert & Freie Universität Berlin
// SPDX-FileCopyrightText: 2016-2025 Knut Reinert & MPI für molekulare Genetik
// SPDX-License-Identifier: BSD-3-Clause
#pragma once
#include <tuple>
#include <seqan3/alignment/configuration/align_config_edit.hpp>
#include <seqan3/alignment/pairwise/detail/concept.hpp>
#include <seqan3/alignment/pairwise/edit_distance_unbanded.hpp>
namespace seqan3::detail
{
template <typename config_t, typename traits_t>
class edit_distance_algorithm
{
private:
using configuration_traits_type = alignment_configuration_traits<config_t>;
using alignment_result_type = typename configuration_traits_type::alignment_result_type;
static_assert(!std::same_as<alignment_result_type, empty_type>, "Alignment result type was not configured.");
public:
constexpr edit_distance_algorithm() = default;
constexpr edit_distance_algorithm(edit_distance_algorithm const &) = default;
constexpr edit_distance_algorithm(edit_distance_algorithm &&) = default;
constexpr edit_distance_algorithm & operator=(edit_distance_algorithm const &) = default;
constexpr edit_distance_algorithm & operator=(edit_distance_algorithm &&) = default;
~edit_distance_algorithm() = default;
constexpr edit_distance_algorithm(config_t const & cfg) : cfg_ptr{new config_t(cfg)}
{}
template <indexed_sequence_pair_range indexed_sequence_pairs_t, typename callback_t>
requires std::invocable<callback_t, alignment_result_type>
constexpr void operator()(indexed_sequence_pairs_t && indexed_sequence_pairs, callback_t && callback)
{
using std::get;
for (auto && [sequence_pair, index] : indexed_sequence_pairs)
compute_single_pair(index,
get<0>(sequence_pair),
get<1>(sequence_pair),
std::forward<callback_t>(callback));
}
private:
template <std::ranges::forward_range first_range_t, std::ranges::forward_range second_range_t, typename callback_t>
constexpr void compute_single_pair(size_t const idx,
first_range_t && first_range,
second_range_t && second_range,
callback_t && callback)
{
using edit_traits = default_edit_distance_trait_type<first_range_t,
second_range_t,
config_t,
typename traits_t::is_semi_global_type>;
edit_distance_unbanded algo{first_range, second_range, *cfg_ptr, edit_traits{}};
algo(idx, callback);
}
std::shared_ptr<std::remove_cvref_t<config_t>> cfg_ptr{};
};
} // namespace seqan3::detail
align_config_edit.hpp
Provides seqan3::align_cfg::edit_scheme.
concept.hpp
Provides concepts needed internally for the alignment algorithms.
edit_distance_unbanded.hpp
Provides a pairwise alignment algorithm for edit distance but without band.
std::forward
T forward(T... args)
seqan3::get
constexpr auto const & get(configuration< configs_t... > const &config) noexcept
This is an overloaded member function, provided for convenience. It differs from the above function o...
Definition configuration.hpp:412
tuple
Hide me