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

Implements the tracker to store the global optimum for a particular alignment computation. More...

#include <seqan3/alignment/pairwise/detail/policy_optimum_tracker.hpp>

+ Inheritance diagram for seqan3::detail::policy_optimum_tracker< alignment_configuration_t, optimum_updater_t >:

Protected Types

using matrix_coordinate_type = typename traits_type::matrix_coordinate_type
 The matrix coordinate type that is used to locate a cell inside of the alignment matrix.
 
using score_type = typename traits_type::score_type
 The configured score type.
 
using traits_type = alignment_configuration_traits< alignment_configuration_t >
 The configuration traits type.
 

Protected Member Functions

template<typename cell_t >
void invoke_comparator (cell_t &&cell, matrix_coordinate_type coordinate) noexcept
 Handles the invocation of the optimum comparator and updater.
 
void reset_optimum () noexcept
 Resets the optimum such that a new alignment can be computed.
 
template<typename cell_t >
decltype(auto) track_cell (cell_t &&cell, matrix_coordinate_type coordinate) noexcept
 Tracks any cell within the alignment matrix.
 
template<typename cell_t >
decltype(auto) track_final_cell (cell_t &&cell, matrix_coordinate_type coordinate) noexcept
 Tracks the final cell of the alignment matrix.
 
template<typename cell_t >
decltype(auto) track_last_column_cell (cell_t &&cell, matrix_coordinate_type coordinate) noexcept
 Tracks the last cell of a column within the alignment matrix.
 
template<typename cell_t >
decltype(auto) track_last_row_cell (cell_t &&cell, matrix_coordinate_type coordinate) noexcept
 Tracks the last cell of a row within the alignment matrix.
 
Constructors, destructor and assignment
 policy_optimum_tracker ()=default
 Defaulted.
 
 policy_optimum_tracker (policy_optimum_tracker const &)=default
 Defaulted.
 
 policy_optimum_tracker (policy_optimum_tracker &&)=default
 Defaulted.
 
policy_optimum_trackeroperator= (policy_optimum_tracker const &)=default
 Defaulted.
 
policy_optimum_trackeroperator= (policy_optimum_tracker &&)=default
 Defaulted.
 
 ~policy_optimum_tracker ()=default
 Defaulted.
 
 policy_optimum_tracker (alignment_configuration_t const &config)
 Construction and initialisation using the alignment configuration.
 

Protected Attributes

optimum_updater_t compare_and_set_optimum {}
 The function object to compare and exchange the optimum.
 
matrix_coordinate_type optimal_coordinate {}
 The matrix coordinate of the tracked optimum.
 
score_type optimal_score {}
 The tracked score of the global optimum.
 
bool test_every_cell {false}
 Whether every cell of the alignment matrix shall be tracked.
 
bool test_last_column_cell {false}
 Whether cells of the last column shall be tracked.
 
bool test_last_row_cell {false}
 Whether cells of the last row shall be tracked.
 

Detailed Description

template<typename alignment_configuration_t, std::semiregular optimum_updater_t>
requires is_type_specialisation_of_v<alignment_configuration_t, configuration> && std::invocable< optimum_updater_t, typename alignment_configuration_traits<alignment_configuration_t>::score_type &, typename alignment_configuration_traits<alignment_configuration_t>::matrix_coordinate_type &, typename alignment_configuration_traits<alignment_configuration_t>::score_type, typename alignment_configuration_traits<alignment_configuration_t>::matrix_coordinate_type>
class seqan3::detail::policy_optimum_tracker< alignment_configuration_t, optimum_updater_t >

Implements the tracker to store the global optimum for a particular alignment computation.

Template Parameters
alignment_configuration_tThe type of the alignment configuration; must be a type specialisation of seqan3::configuration.
optimum_updater_tThe type of the optimum update operation, which compares and updates the alignment optimum with the current cell; must model std::semiregular.

Implements the interface to track the alignment optimum. It updates the currently stored optimum using the optimum update operation. The optimum update operation is stored inside of the class and can have a state. The optimum updater must be invokable with a reference to the optimal score and coordinate and the score and coordinate of the current cell. Special methods are offered to track any cell (for example when computing the local alignment), the last cell of a column or a row (for example when using free-end gaps), or the final cell of the entire matrix (for example in the standard global alignment). The optimum needs to be reset in between alignment computations in order to ensure that the correct result is tracked.

Constructor & Destructor Documentation

◆ policy_optimum_tracker()

template<typename alignment_configuration_t , std::semiregular optimum_updater_t>
seqan3::detail::policy_optimum_tracker< alignment_configuration_t, optimum_updater_t >::policy_optimum_tracker ( alignment_configuration_t const &  config)
inlineprotected

Construction and initialisation using the alignment configuration.

Parameters
[in]configThe alignment configuration (not used in this context).

Reads the state of seqan3::align_cfg::method_global and enables the tracking of the last row or column if requested. Otherwise, only the last cell will be tracked.

Member Function Documentation

◆ invoke_comparator()

template<typename alignment_configuration_t , std::semiregular optimum_updater_t>
template<typename cell_t >
void seqan3::detail::policy_optimum_tracker< alignment_configuration_t, optimum_updater_t >::invoke_comparator ( cell_t &&  cell,
matrix_coordinate_type  coordinate 
)
inlineprotectednoexcept

Handles the invocation of the optimum comparator and updater.

Template Parameters
cell_tThe cell type of the alignment matrix; must have a member function best_score().
Parameters
[in]cellThe current cell to be tracked.
[in]coordinateThe matrix coordinate of the current cell.

Forwards the score and coordinate pair as a tuple and invokes the compare and set operation with the so far best score/coordinate pair and the current score/coordinate pair.

◆ track_cell()

template<typename alignment_configuration_t , std::semiregular optimum_updater_t>
template<typename cell_t >
decltype(auto) seqan3::detail::policy_optimum_tracker< alignment_configuration_t, optimum_updater_t >::track_cell ( cell_t &&  cell,
matrix_coordinate_type  coordinate 
)
inlineprotectednoexcept

Tracks any cell within the alignment matrix.

Template Parameters
cell_tThe cell type of the alignment matrix; must have a member function best_score().
Parameters
[in]cellThe current cell to be tracked.
[in]coordinateThe matrix coordinate of the current cell.
Returns
The forwarded cell.

A call to this function only tracks the optimal score of the given cell if the configuration of the alignment algorithm requires it, for example when a local alignment shall be computed.

◆ track_final_cell()

template<typename alignment_configuration_t , std::semiregular optimum_updater_t>
template<typename cell_t >
decltype(auto) seqan3::detail::policy_optimum_tracker< alignment_configuration_t, optimum_updater_t >::track_final_cell ( cell_t &&  cell,
matrix_coordinate_type  coordinate 
)
inlineprotectednoexcept

Tracks the final cell of the alignment matrix.

Template Parameters
cell_tThe cell type of the alignment matrix; must have a member function best_score().
Parameters
[in]cellThe current cell to be tracked.
[in]coordinateThe matrix coordinate of the current cell.
Returns
The forwarded cell.

A call to this function only tracks the optimal score of the given cell if the configuration of the alignment algorithm requires it, for example when a global alignment shall be computed.

◆ track_last_column_cell()

template<typename alignment_configuration_t , std::semiregular optimum_updater_t>
template<typename cell_t >
decltype(auto) seqan3::detail::policy_optimum_tracker< alignment_configuration_t, optimum_updater_t >::track_last_column_cell ( cell_t &&  cell,
matrix_coordinate_type  coordinate 
)
inlineprotectednoexcept

Tracks the last cell of a column within the alignment matrix.

Template Parameters
cell_tThe cell type of the alignment matrix; must have a member function best_score().
Parameters
[in]cellThe current cell to be tracked.
[in]coordinateThe matrix coordinate of the current cell.
Returns
The forwarded cell.

A call to this function only tracks the optimal score of the given cell if the configuration of the alignment algorithm requires it, for example when a semi-global alignment shall be computed.

◆ track_last_row_cell()

template<typename alignment_configuration_t , std::semiregular optimum_updater_t>
template<typename cell_t >
decltype(auto) seqan3::detail::policy_optimum_tracker< alignment_configuration_t, optimum_updater_t >::track_last_row_cell ( cell_t &&  cell,
matrix_coordinate_type  coordinate 
)
inlineprotectednoexcept

Tracks the last cell of a row within the alignment matrix.

Template Parameters
cell_tThe cell type of the alignment matrix; must have a member function best_score().
Parameters
[in]cellThe current cell to be tracked.
[in]coordinateThe matrix coordinate of the current cell.
Returns
The forwarded cell.

A call to this function only tracks the optimal score of the given cell if the configuration of the alignment algorithm requires it, for example when a semi-global alignment shall be computed.


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