SeqAn3 3.4.0-rc.1
The Modern C++ library for sequence analysis.
Loading...
Searching...
No Matches
seqan3::detail::edit_distance_algorithm< config_t, traits_t > Class Template Reference

This algorithm unifies different edit distance implementations and uses the appropriate one depending on the given configuration. More...

#include <seqan3/alignment/pairwise/edit_distance_algorithm.hpp>

+ Inheritance diagram for seqan3::detail::edit_distance_algorithm< config_t, traits_t >:

Private Types

using alignment_result_type = typename configuration_traits_type::alignment_result_type
 The configured alignment result type.
 
using configuration_traits_type = alignment_configuration_traits< config_t >
 The configuration traits for the selected alignment algorithm.
 

Constructors, destructor and assignment

std::shared_ptr< std::remove_cvref_t< config_t > > cfg_ptr {}
 The alignment configuration stored on the heap.
 
constexpr edit_distance_algorithm ()=default
 Defaulted.
 
constexpr edit_distance_algorithm (edit_distance_algorithm const &)=default
 Defaulted.
 
constexpr edit_distance_algorithm (edit_distance_algorithm &&)=default
 Defaulted.
 
constexpr edit_distance_algorithmoperator= (edit_distance_algorithm const &)=default
 Defaulted.
 
constexpr edit_distance_algorithmoperator= (edit_distance_algorithm &&)=default
 Defaulted.
 
 ~edit_distance_algorithm ()=default
 Defaulted.
 
constexpr edit_distance_algorithm (config_t const &cfg)
 Constructs the wrapper with the passed configuration.
 
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)
 }
 
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)
 Invokes the actual alignment computation for a single pair of sequences.
 

Detailed Description

template<typename config_t, typename traits_t>
class seqan3::detail::edit_distance_algorithm< config_t, traits_t >

This algorithm unifies different edit distance implementations and uses the appropriate one depending on the given configuration.

Template Parameters
config_tThe configuration type.
traits_tThe traits type.

This wrapper class is used to decouple the sequence types from the algorithm class type. Within the alignment configuration a std::function object storing this wrapper is returned if an edit distance should be computed. On invocation it delegates the call to the actual implementation of the edit distance algorithm, while the interface is unified with the execution model of the pairwise alignment algorithms.

Constructor & Destructor Documentation

◆ edit_distance_algorithm()

template<typename config_t , typename traits_t >
constexpr seqan3::detail::edit_distance_algorithm< config_t, traits_t >::edit_distance_algorithm ( config_t const &  cfg)
inlineconstexpr

Constructs the wrapper with the passed configuration.

Parameters
cfgThe configuration to be passed to the algorithm.

The configuration is copied once to the heap during construction and maintained by a std::shared_ptr. The configuration is not passed to the function-call-operator of this function object in order to avoid incompatible configurations between the passed configuration and the one used during configuration of this class. Further, the function object will be stored in a std::function which requires copyable objects and in parallel executions the function object must be copied as well.

Member Function Documentation

◆ compute_single_pair()

template<typename config_t , typename traits_t >
template<std::ranges::forward_range first_range_t, std::ranges::forward_range second_range_t, typename callback_t >
constexpr void seqan3::detail::edit_distance_algorithm< config_t, traits_t >::compute_single_pair ( size_t const  idx,
first_range_t &&  first_range,
second_range_t &&  second_range,
callback_t &&  callback 
)
inlineconstexprprivate

Invokes the actual alignment computation for a single pair of sequences.

Template Parameters
first_range_tThe type of the first sequence (or packed sequences); must model std::ranges::forward_range.
second_range_tThe type of the second sequence (or packed sequences); must model std::ranges::forward_range.
callback_tThe callback to call on the computed alignment result.
Parameters
[in]idxThe index of the current sequence pair.
[in]first_rangeThe first sequence (or packed sequences).
[in]second_rangeThe second sequence (or packed sequences).
[in]callbackThe callback to invoke on an alignment result.

◆ operator()()

template<typename config_t , typename traits_t >
template<indexed_sequence_pair_range indexed_sequence_pairs_t, typename callback_t >
requires std::invocable<callback_t, alignment_result_type>
constexpr void seqan3::detail::edit_distance_algorithm< config_t, traits_t >::operator() ( indexed_sequence_pairs_t &&  indexed_sequence_pairs,
callback_t &&  callback 
)
inlineconstexpr

}

Invokes the alignment computation for every indexed sequence pair contained in the given range.

Template Parameters
indexed_sequence_pairs_tThe type of the range of the indexed sequence pairs; must model seqan3::detail::indexed_sequence_pairs.
callback_tThe type of the callback function that is called with the alignment result; must model std::invocable accepting one argument of type seqan3::alignment_result.
Parameters
[in]indexed_sequence_pairsThe indexed sequence pairs to align.
[in]callbackThe callback function to be invoked with the alignment result; must model std::invocable with the respective seqan3::alignment_result type.

Computes for each contained sequence pair the respective alignment and invokes the given callback for each alignment result.


The documentation for this class was generated from the following file:
Hide me