SeqAn3 3.4.0-rc.1
The Modern C++ library for sequence analysis.
Loading...
Searching...
No Matches
seqan3::detail::simd_affine_gap_policy< alignment_algorithm_t, score_t, align_local_t > Class Template Reference

The CRTP-policy that computes a batch of cells in the alignment matrix using simd instructions. More...

#include <seqan3/alignment/pairwise/policy/simd_affine_gap_policy.hpp>

Private Types

using alignment_state_t = alignment_algorithm_state< score_t >
 The type of state of the alignment algorithm for affine gaps.
 

Private Member Functions

template<typename cell_t >
constexpr void compute_cell (cell_t &&current_cell, alignment_algorithm_state< score_t > &state, score_t const score) const noexcept
 Computes the score of the current simd cell.
 
constexpr score_t convert_to_simd (trace_directions const direction) const noexcept
 Converts a trace direction into a simd vector.
 
template<typename alignment_configuration_t >
constexpr void initialise_alignment_state (alignment_configuration_t const &config) noexcept
 Initialise the alignment state for affine gap computation.
 
Constructors, destructor and assignment
constexpr simd_affine_gap_policy () noexcept=default
 Defaulted.
 
constexpr simd_affine_gap_policy (simd_affine_gap_policy const &) noexcept=default
 Defaulted.
 
constexpr simd_affine_gap_policy (simd_affine_gap_policy &&) noexcept=default
 Defaulted.
 
constexpr simd_affine_gap_policyoperator= (simd_affine_gap_policy const &) noexcept=default
 Defaulted.
 
constexpr simd_affine_gap_policyoperator= (simd_affine_gap_policy &&) noexcept=default
 Defaulted.
 
 ~simd_affine_gap_policy () noexcept=default
 Defaulted.
 
template<typename configuration_t >
 simd_affine_gap_policy (configuration_t const &)
 Initialise the policy.
 

Private Attributes

friend alignment_algorithm_t
 Befriends the derived class to grant it access to the private members.
 
alignment_state_t alignment_state {}
 The internal alignment state tracking the current alignment optimum.
 

Detailed Description

template<typename alignment_algorithm_t, simd_concept score_t, typename align_local_t = std::false_type>
class seqan3::detail::simd_affine_gap_policy< alignment_algorithm_t, score_t, align_local_t >

The CRTP-policy that computes a batch of cells in the alignment matrix using simd instructions.

Template Parameters
alignment_algorithm_tThe derived type (seqan3::detail::alignment_algorithm) to be augmented with this CRTP-policy.
score_tThe score type of the dynamic programming matrix; must model seqan3::simd::simd_concept.
align_local_tA std::bool_constant to switch between local and global alignment.

This CRTP-policy implements the recursion for the alignment algorithm with affine gaps using an inter-sequence vectorisation scheme. See Rahn, R, et al. Generic accelerated sequence alignment in SeqAn using vectorization and multi-threading. Bioinformatics 34.20 (2018): 3437-3445. for more information.

Remarks
The template parameters of this CRTP-policy are selected in the seqan3::detail::alignment_configurator::select_gap_policy when selecting the alignment for the given configuration.

Member Function Documentation

◆ compute_cell()

template<typename alignment_algorithm_t , simd_concept score_t, typename align_local_t = std::false_type>
template<typename cell_t >
constexpr void seqan3::detail::simd_affine_gap_policy< alignment_algorithm_t, score_t, align_local_t >::compute_cell ( cell_t &&  current_cell,
alignment_algorithm_state< score_t > &  state,
score_t const  score 
) const
inlineconstexprprivatenoexcept

Computes the score of the current simd cell.

Template Parameters
cell_tThe type of the current cell [for detailed information on the type see below].
Parameters
[in,out]current_cellThe current cell in the dynamic programming matrix.
[in,out]stateThe state storing hot helper variables.
[in]scoreThe score of comparing the respective letters of the first and the second sequence.

cell_t is the result type of dereferencing the zipped iterator over the respective alignment score matrix and the alignment trace matrix used inside of the seqan3::detail::alignment_matrix_policy. The first parameter stored in the zipped tuple is the seqan3::detail::alignment_score_matrix_proxy and the second value is the seqan3::detail::alignment_trace_matrix_proxy.

In order to compute the maximum for two simd vectors, gcc implements the ternary operator such that std::max(a, b) can be implemented as (a > b) ? a : b, where (a > b) returns a mask vector. This implements the compare-and-blend approach for simd vector types.

◆ convert_to_simd()

template<typename alignment_algorithm_t , simd_concept score_t, typename align_local_t = std::false_type>
constexpr score_t seqan3::detail::simd_affine_gap_policy< alignment_algorithm_t, score_t, align_local_t >::convert_to_simd ( trace_directions const  direction) const
inlineconstexprprivatenoexcept

Converts a trace direction into a simd vector.

Parameters
[in]directionThe trace direction to convert to a simd vector.

◆ initialise_alignment_state()

template<typename alignment_algorithm_t , simd_concept score_t, typename align_local_t = std::false_type>
template<typename alignment_configuration_t >
constexpr void seqan3::detail::simd_affine_gap_policy< alignment_algorithm_t, score_t, align_local_t >::initialise_alignment_state ( alignment_configuration_t const &  config)
inlineconstexprprivatenoexcept

Initialise the alignment state for affine gap computation.

Template Parameters
alignment_configuration_tThe type of alignment configuration.
Parameters
[in]configThe alignment configuration.

Gets the stored gap scheme from the configuration or uses a default gap scheme if not set and initialises the alignment algorithm state with the respective gap extension and gap open costs. If the gap scheme was not specified by the user the following defaults are used:

  • -1 for the gap extension score, and
  • -10 for the gap open score.

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