SeqAn3 3.4.0-rc.4
The Modern C++ library for sequence analysis.
|
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. | |
size_t | seq1_slice_offset {} |
The offset of the first sequence slice. | |
size_t | seq2_slice_offset {} |
The offset of the second sequence slice;. | |
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_policy & | operator= (alignment_matrix_policy const &)=default |
Defaulted. | |
constexpr alignment_matrix_policy & | operator= (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) 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. | |
constexpr size_t | to_original_sequence1_position (size_t position) const noexcept |
Converts a sliced position in the alignment matrix to the corresponding position in the original sequence 1. | |
constexpr size_t | to_original_sequence2_position (size_t position) const noexcept |
Converts a sliced position in the alignment matrix to the corresponding position in the original sequence 2. | |
Manages the alignment and score matrix.
alignment_algorithm_t | The derived type (seqan3::detail::alignment_algorithm) to be augmented with this CRTP-policy. |
score_matrix_t | The type of the alignment score matrix. |
trace_matrix_t | The 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.
|
no-apiinlineconstexprprivate |
}
Allocates the memory of the underlying matrices.
sequence1_t | The type of the first sequence to align; must model std::forward_ranges. |
sequence2_t | The type of the second sequence to align; must model std::forward_ranges. |
[in] | sequence1 | The first sequence to align. |
[in] | sequence2 | The second sequence to align. |
Initialises the underlying score and trace matrices and sets the respective matrix iterators to the begin of the corresponding matrix.
|
no-apiinlineconstexprprivate |
Allocates the memory of the underlying matrices.
sequence1_t | The type of the first sequence to align; must model std::forward_ranges. |
sequence2_t | The type of the second sequence to align; must model std::forward_ranges. |
score_t | The score type used inside of the alignment algorithm. |
[in] | sequence1 | The first sequence to align. |
[in] | sequence2 | The second sequence to align. |
[in] | band | The band used to initialise the matrices. |
[in] | state | The 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.
|
no-apiinlineconstexprprivatenoexcept |
Returns the current alignment 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.
|
no-apiinlineconstexprprivatenoexcept |
Moves to the next alignment column.
Increments the underlying matrix iterators for the score matrix and the trace matrix.
|
no-apiinlineconstexprprivatenoexcept |
Slices the sequences according to the band parameters.
sequence1_t | The type of the first sequence to align; must model std::forward_ranges. |
sequence2_t | The type of the second sequence to align; must model std::forward_ranges. |
[in] | sequence1 | The first sequence to align. |
[in] | sequence2 | The second sequence to align. |
[in] | band | The 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.
|
no-apiinlineconstexprprivatenoexcept |
Converts a sliced position in the alignment matrix to the corresponding position in the original sequence 1.
position | The position in the sliced alignment matrix. |
Only changes the position if the sequence was sliced due to band configuration.
|
no-apiinlineconstexprprivatenoexcept |
Converts a sliced position in the alignment matrix to the corresponding position in the original sequence 2.
position | The position in the sliced alignment matrix. |
Only changes the position if the sequence was sliced due to band configuration.