SeqAn3 3.4.0-rc.1
The Modern C++ library for sequence analysis.
|
A function object that compares and possibly updates the alignment optimum with the current cell. More...
#include <seqan3/alignment/pairwise/detail/policy_optimum_tracker.hpp>
Public Member Functions | |
template<typename score_t , typename coordinate_t > requires (std::totally_ordered<score_t> && std::assignable_from<score_t &, score_t const &> && std::assignable_from<coordinate_t &, coordinate_t const &>) | |
void | operator() (score_t &optimal_score, coordinate_t &optimal_coordinate, score_t current_score, coordinate_t current_coordinate) const noexcept |
Compares and updates the optimal score-coordinate pair. | |
void | set_target_indices (row_index_type< size_t > row_index, column_index_type< size_t > col_index) noexcept |
Sets the target index for the last row and column of the matrix. | |
A function object that compares and possibly updates the alignment optimum with the current cell.
This special function object is used for global alignments including free end-gaps. It updates the current alignment optimum with the new score and the respective coordinate if the new score is greater or equal to the score of the current optimum and the cell is either in the target row or column. For the banded alignment this additional check is needed because the band might not reach the last row of the matrix for all columns. Thus, the last cell of a column will only be checked if the corresponding coordinate points to the last row of the matrix.
Consider the following banded matrix:
When computing the columns from index 0 to 3 the last row of the matrix is not covered by the band. But the algorithm that computes the column does not know if the last computed cell of it is in fact also the last cell of the matrix (row index 6). Thus, by comparing the cell coordinate, which corresponds to the absolute matrix coordinate, with the initialised target row and column index of this function object, it can be guaranteed that only the scores of the cells are tracked that are in the last row or column (cells marked with an *
in the picture above).
|
inlinenoexcept |
Compares and updates the optimal score-coordinate pair.
score_t | The type of the score to track; must model std::totally_ordered and std::assignable_from const & score_t . |
coordinate_t | The type of the coordinate to track; must model std::assignable_from const & coordinate_t . |
[in,out] | optimal_score | The optimal score to update. |
[in,out] | optimal_coordinate | The optimal coordinate to update. |
[in] | current_score | The score of the current cell. |
[in] | current_coordinate | The coordinate of the current cell. |
First, checks if the coordinate of the current alignment cell is either in the target row or column, i.e. the last row/column of the alignment matrix. If this is not the case the score won't be updated. Otherwise, compares the current_score with the optimal score and updates the optimal score and coordinate accordingly.
|
inlinenoexcept |
Sets the target index for the last row and column of the matrix.
row_index | The target index of the last row. |
col_index | The target index of the last column. |