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

Manages the alignment and score matrix. More...

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

Private Attributes

friend alignment_algorithm_t
 Allow alignment algorithm to instantiate this crtp base class.
 

Constructors, destructor and assignment

score_matrix_t score_matrix {}
 The scoring matrix.
 
trace_matrix_t trace_matrix {}
 The trace matrix if needed.
 
score_matrix_t::iterator score_matrix_iter {}
 The matrix iterator over the score matrix.
 
trace_matrix_t::iterator trace_matrix_iter {}
 The matrix iterator over the trace matrix.
 
constexpr alignment_matrix_policy ()=default
 Defaulted.
 
constexpr alignment_matrix_policy (alignment_matrix_policy const &)=default
 Defaulted.
 
constexpr alignment_matrix_policy (alignment_matrix_policy &&)=default
 Defaulted.
 
constexpr alignment_matrix_policyoperator= (alignment_matrix_policy const &)=default
 Defaulted.
 
constexpr alignment_matrix_policyoperator= (alignment_matrix_policy &&)=default
 Defaulted.
 
 ~alignment_matrix_policy ()=default
 Defaulted.
 
template<typename configuration_t >
 alignment_matrix_policy (configuration_t const &)
 Initialise the policy.
 
template<typename sequence1_t , typename sequence2_t >
constexpr void allocate_matrix (sequence1_t &&sequence1, sequence2_t &&sequence2)
 }
 
template<typename sequence1_t , typename sequence2_t , typename score_t >
constexpr void allocate_matrix (sequence1_t &&sequence1, sequence2_t &&sequence2, align_cfg::band_fixed_size const &band, alignment_algorithm_state< score_t > const &state)
 Allocates the memory of the underlying matrices.
 
constexpr void initialise_matrix_iterator () noexcept
 Initialises the score and trace matrix iterator after allocating the matrices.
 
template<typename sequence1_t , typename sequence2_t >
constexpr auto slice_sequences (sequence1_t &sequence1, sequence2_t &sequence2, align_cfg::band_fixed_size const &band) const noexcept
 Slices the sequences according to the band parameters.
 
constexpr auto current_alignment_column () noexcept
 Returns the current alignment column.
 
constexpr void next_alignment_column () noexcept
 Moves to the next alignment column.
 

Detailed Description

template<typename alignment_algorithm_t, typename score_matrix_t, typename trace_matrix_t>
class seqan3::detail::alignment_matrix_policy< alignment_algorithm_t, score_matrix_t, trace_matrix_t >

Manages the alignment and score matrix.

Template Parameters
alignment_algorithm_tThe derived type (seqan3::detail::alignment_algorithm) to be augmented with this CRTP-policy.
score_matrix_tThe type of the alignment score matrix.
trace_matrix_tThe type of the alignment trace matrix.

This policy is used to manage the score and trace matrix of the alignment algorithm. On invocation of an alignment instance the necessary memory is allocated and the corresponding matrix iterators are initialised. These iterators are used as a global state within this particular alignment instance and are accessed from the alignment algorithm.

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

Member Function Documentation

◆ allocate_matrix() [1/2]

template<typename alignment_algorithm_t , typename score_matrix_t , typename trace_matrix_t >
template<typename sequence1_t , typename sequence2_t >
constexpr void seqan3::detail::alignment_matrix_policy< alignment_algorithm_t, score_matrix_t, trace_matrix_t >::allocate_matrix ( sequence1_t &&  sequence1,
sequence2_t &&  sequence2 
)
inlineconstexprprivate

}

Allocates the memory of the underlying matrices.

Template Parameters
sequence1_tThe type of the first sequence to align; must model std::forward_ranges.
sequence2_tThe type of the second sequence to align; must model std::forward_ranges.
Parameters
[in]sequence1The first sequence to align.
[in]sequence2The second sequence to align.

Initialises the underlying score and trace matrices and sets the respective matrix iterators to the begin of the corresponding matrix.

◆ allocate_matrix() [2/2]

template<typename alignment_algorithm_t , typename score_matrix_t , typename trace_matrix_t >
template<typename sequence1_t , typename sequence2_t , typename score_t >
constexpr void seqan3::detail::alignment_matrix_policy< alignment_algorithm_t, score_matrix_t, trace_matrix_t >::allocate_matrix ( sequence1_t &&  sequence1,
sequence2_t &&  sequence2,
align_cfg::band_fixed_size const &  band,
alignment_algorithm_state< score_t > const &  state 
)
inlineconstexprprivate

Allocates the memory of the underlying matrices.

Template Parameters
sequence1_tThe type of the first sequence to align; must model std::forward_ranges.
sequence2_tThe type of the second sequence to align; must model std::forward_ranges.
score_tThe score type used inside of the alignment algorithm.
Parameters
[in]sequence1The first sequence to align.
[in]sequence2The second sequence to align.
[in]bandThe band used to initialise the matrices.
[in]stateThe current state used by the alignment algorithm.

Initialises the underlying banded score and trace matrices and sets the respective matrix iterators to the begin of the corresponding matrix. Using the additional band parameter the actual dimensions are reduced according to the matrix implementation. For the banded case, one additional cell per column is stored such that we can read from it without introducing a case distinction inside of the algorithm implementation. However, this cell needs to be properly initialised with an infinity value. To emulate the infinity for integral values we use the smallest representable value and subtract the gap extension score (assumed to be always negative) from it. In the algorithm we never write to this cell and only add the extension costs to the read value. This way we can get the smallest possible value as an infinity.

◆ current_alignment_column()

template<typename alignment_algorithm_t , typename score_matrix_t , typename trace_matrix_t >
constexpr auto seqan3::detail::alignment_matrix_policy< alignment_algorithm_t, score_matrix_t, trace_matrix_t >::current_alignment_column ( )
inlineconstexprprivatenoexcept

Returns the current alignment column.

Returns
The current alignment column as a zipped view over the score matrix and trace matrix column.

The current alignment column is a zipped view over the current score matrix column and trace matrix column. These columns are managed by the corresponding alignment matrix policy.

◆ next_alignment_column()

template<typename alignment_algorithm_t , typename score_matrix_t , typename trace_matrix_t >
constexpr void seqan3::detail::alignment_matrix_policy< alignment_algorithm_t, score_matrix_t, trace_matrix_t >::next_alignment_column ( )
inlineconstexprprivatenoexcept

Moves to the next alignment column.

Increments the underlying matrix iterators for the score matrix and the trace matrix.

◆ slice_sequences()

template<typename alignment_algorithm_t , typename score_matrix_t , typename trace_matrix_t >
template<typename sequence1_t , typename sequence2_t >
constexpr auto seqan3::detail::alignment_matrix_policy< alignment_algorithm_t, score_matrix_t, trace_matrix_t >::slice_sequences ( sequence1_t &  sequence1,
sequence2_t &  sequence2,
align_cfg::band_fixed_size const &  band 
) const
inlineconstexprprivatenoexcept

Slices the sequences according to the band parameters.

Template Parameters
sequence1_tThe type of the first sequence to align; must model std::forward_ranges.
sequence2_tThe type of the second sequence to align; must model std::forward_ranges.
Parameters
[in]sequence1The first sequence to align.
[in]sequence2The second sequence to align.
[in]bandThe seqan3::align_cfg::band_fixed_size used to limit the alignment space.

If the band does not intersect with the origin or the sink of the matrix the sequences are sliced such that the band starts in the origin and ends in the sink.


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