35template <simd::simd_concept simd_t>
74template <
typename alignment_algorithm_t, simd::simd_concept simd_t>
101 template <
typename configuration_t>
104 if constexpr (configuration_t::template exists<align_cfg::method_local>())
118 template <
typename cell_t,
typename score_t>
127 template <
typename other_alignment_algorithm_t, simd_concept score_t,
typename is_local_t>
131 template <
typename other_alignment_algorithm_t>
135 template <
typename cell_t,
typename score_t>
144 check_and_update<true>(last_row_cell, state);
151 template <
typename alignment_column_t,
typename score_t>
159 for (
auto && cell : last_column)
162 check_and_update<false>(cell, state);
170 template <
typename cell_t,
typename score_t>
191 template <std::ranges::forward_range sequence1_collection_t,
192 std::ranges::forward_range sequence2_collection_t,
195 [[maybe_unused]] sequence2_collection_t && sequence2_collection,
196 [[maybe_unused]] score_t
const padding_score)
200 assert(std::ranges::distance(sequence1_collection) == std::ranges::distance(sequence2_collection));
210 size_t array_index{};
211 for (
auto && [sequence1, sequence2] :
views::zip(sequence1_collection, sequence2_collection))
213 sequence1_sizes[array_index] = std::ranges::distance(sequence1);
214 sequence2_sizes[array_index] = std::ranges::distance(sequence2);
215 max_sequence1_size = std::max<std::ptrdiff_t>(sequence1_sizes[array_index], max_sequence1_size);
216 max_sequence2_size = std::max<std::ptrdiff_t>(sequence2_sizes[array_index], max_sequence2_size);
221 std::ptrdiff_t global_diagonal = max_sequence1_size - max_sequence2_size;
226 local_diagonal < global_diagonal)
254 template <
typename cell_t,
typename score_t>
259 auto const & [score_cell, trace_cell] = cell;
260 state.optimum.update_if_new_optimal_score(score_cell.current,
281 template <
bool in_last_row,
typename cell_t,
typename score_t>
287 auto const & [score_cell, trace_cell] = cell;
288 simd_t column_positions = simd::fill<simd_t>(trace_cell.coordinate.first);
289 simd_t row_positions = simd::fill<simd_t>(trace_cell.coordinate.second);
293 if constexpr (in_last_row)
300 state.optimum.score =
mask ? score_cell.current - this->
score_offset : state.optimum.score;
301 state.optimum.column_index =
mask ? column_positions - this->
coordinate_offset : state.optimum.column_index;
Provides seqan3::detail::alignment_algorithm_state.
Provides seqan3::detail::alignment_optimum.
Sets the global alignment method.
Definition align_config_method.hpp:119
The CRTP-policy that implements the initialisation of the dynamic programming matrix with affine gaps...
Definition affine_gap_init_policy.hpp:34
The CRTP-policy that computes a batch of cells in the alignment matrix using simd instructions.
Definition simd_affine_gap_policy.hpp:51
The CRTP-policy to determine the optimum of the dynamic programming matrix.
Definition simd_find_optimum_policy.hpp:76
constexpr void check_score_of_cells_in_last_column(alignment_column_t &&last_column, alignment_algorithm_state< score_t > &state) const noexcept
Checks all cells of the last alignment column for a new alignment optimum.
Definition simd_find_optimum_policy.hpp:153
~simd_find_optimum_policy()=default
Defaulted.
constexpr simd_find_optimum_policy & operator=(simd_find_optimum_policy &&)=default
Defaulted.
constexpr void check_and_update(cell_t const &cell, alignment_algorithm_state< score_t > &state) const noexcept
Tests if the score in the current cell is greater than the current alignment optimum.
Definition simd_find_optimum_policy.hpp:255
constexpr simd_find_optimum_policy & operator=(simd_find_optimum_policy const &)=default
Defaulted.
constexpr void check_score_of_last_cell(cell_t const &last_cell, alignment_algorithm_state< score_t > &state) const noexcept
Checks if the last cell of the alignment matrix is a new optimum in the alignment.
Definition simd_find_optimum_policy.hpp:171
constexpr simd_find_optimum_policy(simd_find_optimum_policy &&)=default
Defaulted.
constexpr simd_find_optimum_policy(simd_find_optimum_policy const &)=default
Defaulted.
void initialise_find_optimum_policy(sequence1_collection_t &&sequence1_collection, sequence2_collection_t &&sequence2_collection, score_t const padding_score)
Initialises the global alignment state for the current batch of sequences.
Definition simd_find_optimum_policy.hpp:194
friend alignment_algorithm_t
Befriends the derived class to grant it access to the private members.
Definition simd_find_optimum_policy.hpp:79
constexpr void check_score_of_cell(cell_t const ¤t_cell, alignment_algorithm_state< score_t > &state) const noexcept
Checks if a given cell is a new optimum in the alignment.
Definition simd_find_optimum_policy.hpp:119
bool test_every_cell
Whether every cell of the alignment matrix shall be tracked.
Definition simd_find_optimum_policy.hpp:84
constexpr void check_and_update(cell_t const &cell, alignment_algorithm_state< score_t > &state) const noexcept
Tests if the current row, respectively column, is part of a global alignment to track.
Definition simd_find_optimum_policy.hpp:282
bool test_last_column_cell
Whether cells of the last column shall be tracked.
Definition simd_find_optimum_policy.hpp:88
simd_find_optimum_policy(configuration_t const &config)
Initialise the policy.
Definition simd_find_optimum_policy.hpp:102
constexpr void check_score_of_last_row_cell(cell_t const &last_row_cell, alignment_algorithm_state< score_t > &state) const noexcept
Checks if a cell in the last row of the alignment matrix is a new optimum in the alignment.
Definition simd_find_optimum_policy.hpp:137
constexpr simd_find_optimum_policy()=default
Defaulted.
bool test_last_row_cell
Whether cells of the last row shall be tracked.
Definition simd_find_optimum_policy.hpp:86
bool is_global_alignment
A flag to check if global alignment is computed.
Definition simd_find_optimum_policy.hpp:82
Implementation of a masked alphabet to be used for tuple composites.
Definition mask.hpp:35
Provides seqan3::detail::empty_type.
Provides seqan3::detail::find_optimum_policy.
seqan::stl::views::zip zip
A view adaptor that takes several views and returns tuple-like values from every i-th element of each...
Definition zip.hpp:24
A type that satisfies std::is_arithmetic_v<t>.
Refines the seqan3::simd::simd_concept requiring the underlying scalar type to model std::integral.
The internal SeqAn3 namespace.
Definition aligned_sequence_concept.hpp:26
Local state for the standard alignment algorithm.
Definition alignment_algorithm_state.hpp:32
A strong type for designated initialisation of the column index of a matrix.
Definition matrix_coordinate.hpp:29
A strong type for designated initialisation of the row index of a matrix.
Definition matrix_coordinate.hpp:58
A state that is only used for global alignments.
Definition simd_find_optimum_policy.hpp:37
simd_t coordinate_offset
A coordinate offset that needs to be subtracted for every alignment to get the correct end position.
Definition simd_find_optimum_policy.hpp:41
simd_t score_offset
The score offset that needs to be subtracted for every alignment to get the correct result.
Definition simd_find_optimum_policy.hpp:39
simd_t last_row_mask
A mask vector storing the column indices for alignments that end in the last row of the global matrix...
Definition simd_find_optimum_policy.hpp:45
simd_t last_column_mask
A mask vector storing the row indices for alignments that end in the last column of the global matrix...
Definition simd_find_optimum_policy.hpp:43
seqan3::simd::simd_traits is the trait class that provides uniform interface to the properties of sim...
Definition simd_traits.hpp:38
Provides seqan3::simd::simd_concept.
Provides seqan3::views::zip.