SeqAn3 3.2.0-rc.1
The Modern C++ library for sequence analysis.
alignment_algorithm.hpp
Go to the documentation of this file.
1// -----------------------------------------------------------------------------------------------------
2// Copyright (c) 2006-2021, Knut Reinert & Freie Universität Berlin
3// Copyright (c) 2016-2021, Knut Reinert & MPI für molekulare Genetik
4// This file may be used, modified and/or redistributed under the terms of the 3-clause BSD-License
5// shipped with this file and also available at: https://github.com/seqan/seqan3/blob/master/LICENSE.md
6// -----------------------------------------------------------------------------------------------------
7
13#pragma once
14
15#include <iterator>
16#include <memory>
17#include <optional>
18#include <seqan3/std/ranges>
19#include <type_traits>
20
38
39namespace seqan3::detail
40{
41
75template <typename config_t, typename ...algorithm_policies_t>
77 public invoke_deferred_crtp_base<algorithm_policies_t, alignment_algorithm<config_t, algorithm_policies_t...>>...
78{
79private:
80
83
94 template <typename alignment_algorithm_t = alignment_algorithm>
95 static auto _alignment_column_t() -> decltype(std::declval<alignment_algorithm_t>().current_alignment_column());
96
100 using alignment_column_iterator_t = std::ranges::iterator_t<alignment_column_t>;
103
104 static_assert(!std::same_as<alignment_result_t, empty_type>, "Alignment result type was not configured.");
105
112 empty_type>;
119 empty_type>;
120
121public:
125 constexpr alignment_algorithm() = default;
126 constexpr alignment_algorithm(alignment_algorithm const &) = default;
127 constexpr alignment_algorithm(alignment_algorithm &&) = default;
128 constexpr alignment_algorithm & operator=(alignment_algorithm const &) = default;
131
140 explicit constexpr alignment_algorithm(config_t const & cfg) :
141 invoke_deferred_crtp_base<algorithm_policies_t, alignment_algorithm<config_t, algorithm_policies_t...>>{cfg}...,
142 cfg_ptr{std::make_shared<config_t>(cfg)}
143 {
144 this->scoring_scheme = seqan3::get<align_cfg::scoring_scheme>(*cfg_ptr).scheme;
145 this->initialise_alignment_state(*cfg_ptr);
146 }
148
194 template <indexed_sequence_pair_range indexed_sequence_pairs_t, typename callback_t>
196 requires (!traits_t::is_vectorised) && std::invocable<callback_t, alignment_result_t>
198 void operator()(indexed_sequence_pairs_t && indexed_sequence_pairs, callback_t && callback)
199 {
200 using std::get;
201
202 for (auto && [sequence_pair, idx] : indexed_sequence_pairs)
203 compute_single_pair(idx, get<0>(sequence_pair), get<1>(sequence_pair), callback);
204 }
205
207 template <indexed_sequence_pair_range indexed_sequence_pairs_t, typename callback_t>
209 requires traits_t::is_vectorised && std::invocable<callback_t, alignment_result_t>
211 void operator()(indexed_sequence_pairs_t && indexed_sequence_pairs, callback_t && callback)
212 {
213 assert(cfg_ptr != nullptr);
214
215 static_assert(simd_concept<typename traits_t::score_type>, "Expected simd score type.");
216 static_assert(simd_concept<typename traits_t::trace_type>, "Expected simd trace type.");
217
218 // Extract the batch of sequences for the first and the second sequence.
219 auto sequence1_range = indexed_sequence_pairs | views::elements<0> | views::elements<0>;
220 auto sequence2_range = indexed_sequence_pairs | views::elements<0> | views::elements<1>;
221
222 // Initialise the find_optimum policy in the simd case.
223 this->initialise_find_optimum_policy(sequence1_range,
224 sequence2_range,
225 this->scoring_scheme.padding_match_score());
226
227 // Convert batch of sequences to sequence of simd vectors.
228 auto simd_sequences1 = convert_batch_of_sequences_to_simd_vector(sequence1_range);
229 auto simd_sequences2 = convert_batch_of_sequences_to_simd_vector(sequence2_range);
230
231 max_size_in_collection = std::pair{simd_sequences1.size(), simd_sequences2.size()};
232 // Reset the alignment state's optimum between executions of the alignment algorithm.
233 this->alignment_state.reset_optimum();
234
235 compute_matrix(simd_sequences1, simd_sequences2);
236
237 make_alignment_result(indexed_sequence_pairs, callback);
238 }
240
241private:
255 template <typename sequence_range_t>
256 constexpr auto convert_batch_of_sequences_to_simd_vector(sequence_range_t & sequences)
257 {
258 assert(static_cast<size_t>(std::ranges::distance(sequences)) <= traits_t::alignments_per_vector);
259
260 using simd_score_t = typename traits_t::score_type;
261
262 std::vector<simd_score_t, aligned_allocator<simd_score_t, alignof(simd_score_t)>> simd_sequence{};
263
264 for (auto && simd_vector_chunk : sequences | views::to_simd<simd_score_t>(this->scoring_scheme.padding_symbol))
265 for (auto && simd_vector : simd_vector_chunk)
266 simd_sequence.push_back(std::move(simd_vector));
267
268 return simd_sequence;
269 }
270
288 template <std::ranges::forward_range sequence1_t,
289 std::ranges::forward_range sequence2_t,
290 typename callback_t>
291 constexpr void compute_single_pair(size_t const idx,
292 sequence1_t && sequence1,
293 sequence2_t && sequence2,
294 callback_t & callback)
295 {
296 assert(cfg_ptr != nullptr);
297
298 if constexpr (traits_t::is_debug)
299 initialise_debug_matrices(sequence1, sequence2);
300
301 // Reset the alignment state's optimum between executions of the alignment algorithm.
302 this->alignment_state.reset_optimum();
303
304 if constexpr (traits_t::is_banded)
305 {
306 using seqan3::get;
307 // Get the band and check if band configuration is valid.
308 auto const & band = get<align_cfg::band_fixed_size>(*cfg_ptr);
309 check_valid_band_parameter(sequence1, sequence2, band);
310 auto && [subsequence1, subsequence2] = this->slice_sequences(sequence1, sequence2, band);
311 // It would be great to use this interface here instead
312 compute_matrix(subsequence1, subsequence2, band);
313 make_alignment_result(idx, subsequence1, subsequence2, callback);
314 }
315 else
316 {
317 compute_matrix(sequence1, sequence2);
318 make_alignment_result(idx, sequence1, sequence2, callback);
319 }
320 }
321
338 template <typename sequence1_t, typename sequence2_t>
339 constexpr void check_valid_band_parameter(sequence1_t && sequence1,
340 sequence2_t && sequence2,
341 align_cfg::band_fixed_size const & band)
342 {
343 static_assert(config_t::template exists<align_cfg::band_fixed_size>(),
344 "The band configuration is required for the banded alignment algorithm.");
345
347 static_assert(std::is_signed_v<diff_type>, "Only signed types can be used to test the band parameters.");
348
349 if (static_cast<diff_type>(band.lower_diagonal) > std::ranges::distance(sequence1))
350 {
352 {
353 "Invalid band error: The lower diagonal excludes the whole alignment matrix."
354 };
355 }
356
357 if (static_cast<diff_type>(band.upper_diagonal) < -std::ranges::distance(sequence2))
358 {
360 {
361 "Invalid band error: The upper diagonal excludes the whole alignment matrix."
362 };
363 }
364 }
365
378 template <typename sequence1_t, typename sequence2_t>
379 constexpr void initialise_debug_matrices(sequence1_t & sequence1, sequence2_t & sequence2)
380 {
381 size_t rows = std::ranges::distance(sequence2) + 1;
382 size_t cols = std::ranges::distance(sequence1) + 1;
383
386 }
387
395 template <typename sequence1_t, typename sequence2_t>
396 void compute_matrix(sequence1_t & sequence1, sequence2_t & sequence2)
398 requires (!traits_t::is_banded)
400 {
401 // ----------------------------------------------------------------------------
402 // Initialisation phase: allocate memory and initialise first column.
403 // ----------------------------------------------------------------------------
404
405 this->allocate_matrix(sequence1, sequence2);
407
408 // ----------------------------------------------------------------------------
409 // Recursion phase: compute column-wise the alignment matrix.
410 // ----------------------------------------------------------------------------
411
412 for (auto const & alphabet1 : sequence1)
413 {
414 compute_alignment_column<true>(this->scoring_scheme_profile_column(alphabet1), sequence2);
416 }
417
418 // ----------------------------------------------------------------------------
419 // Wrap up phase: track score in last column and prepare the alignment result.
420 // ----------------------------------------------------------------------------
421
423 }
424
426 template <typename sequence1_t, typename sequence2_t>
427 void compute_matrix(sequence1_t & sequence1, sequence2_t & sequence2, align_cfg::band_fixed_size const & band)
429 requires traits_t::is_banded
431 {
432 // ----------------------------------------------------------------------------
433 // Initialisation phase: allocate memory and initialise first column.
434 // ----------------------------------------------------------------------------
435
436 // Allocate and initialise first column.
437 this->allocate_matrix(sequence1, sequence2, band, this->alignment_state);
438 using row_index_t = std::ranges::range_difference_t<sequence2_t>;
439 row_index_t last_row_index = this->score_matrix.band_row_index;
440 initialise_first_alignment_column(std::views::take(sequence2, last_row_index));
441
442 // ----------------------------------------------------------------------------
443 // 1st recursion phase: iterate as long as the band intersects with the first row.
444 // ----------------------------------------------------------------------------
445
446 row_index_t sequence2_size = std::ranges::distance(sequence2);
447 for (auto const & seq1_value : std::views::take(sequence1, this->score_matrix.band_col_index))
448 {
449 compute_alignment_column<true>(seq1_value, std::views::take(sequence2, ++last_row_index));
450 // Only if band reached last row of matrix the last cell might be tracked.
451 finalise_last_cell_in_column(last_row_index >= sequence2_size);
452 }
453
454 // ----------------------------------------------------------------------------
455 // 2nd recursion phase: iterate until the end of the matrix.
456 // ----------------------------------------------------------------------------
457
458 size_t first_row_index = 0;
459 for (auto const & seq1_value : std::views::drop(sequence1, this->score_matrix.band_col_index))
460 {
461 // In the second phase the band moves in every column one base down on the second sequence.
462 compute_alignment_column<false>(seq1_value, sequence2 | views::slice(first_row_index++, ++last_row_index));
463 // Only if band reached last row of matrix the last cell might be tracked.
464 finalise_last_cell_in_column(last_row_index >= sequence2_size);
465 }
466
467 // ----------------------------------------------------------------------------
468 // Wrap up phase: track score in last column and prepare the alignment result.
469 // ----------------------------------------------------------------------------
470
472 }
473
486 template <typename sequence2_t>
487 auto initialise_first_alignment_column(sequence2_t && sequence2)
488 {
489 // Get the initial column.
490 alignment_column = this->current_alignment_column();
491 assert(!alignment_column.empty()); // Must contain at least one element.
492
493 // Initialise first cell.
495 this->init_origin_cell(*alignment_column_it, this->alignment_state);
496
497 // Initialise the remaining cells of this column.
498 for (auto it = std::ranges::begin(sequence2); it != std::ranges::end(sequence2); ++it)
499 this->init_column_cell(*++alignment_column_it, this->alignment_state);
500
501 // Finalise the last cell of the initial column.
502 bool at_last_row = true;
503 if constexpr (traits_t::is_banded) // If the band reaches until the last row of the matrix.
504 at_last_row = static_cast<size_t>(this->score_matrix.band_row_index) == this->score_matrix.num_rows - 1;
505
506 finalise_last_cell_in_column(at_last_row);
507 }
508
524 template <bool initialise_first_cell, typename sequence1_value_t, typename sequence2_t>
525 void compute_alignment_column(sequence1_value_t const & seq1_value, sequence2_t && sequence2)
526 {
527 this->next_alignment_column(); // move to next column and set alignment column iterator accordingly.
528 alignment_column = this->current_alignment_column();
530
531 auto seq2_it = std::ranges::begin(sequence2);
532
533 if constexpr (initialise_first_cell) // Initialise first cell if it intersects with the first row of the matrix.
534 {
535 this->init_row_cell(*alignment_column_it, this->alignment_state);
536 }
537 else // Compute first cell of banded column if it does not intersect with the first row of the matrix.
538 {
539 this->compute_first_band_cell(*alignment_column_it,
540 this->alignment_state,
541 this->scoring_scheme.score(seq1_value, *seq2_it));
542 ++seq2_it;
543 }
544
545 for (; seq2_it != std::ranges::end(sequence2); ++seq2_it)
546 this->compute_cell(*++alignment_column_it,
547 this->alignment_state,
548 this->scoring_scheme.score(seq1_value, *seq2_it));
549 }
550
561 constexpr void finalise_last_cell_in_column(bool const at_last_row) noexcept
562 {
563 if (at_last_row)
564 this->check_score_of_last_row_cell(*alignment_column_it, this->alignment_state);
565
566 if constexpr (traits_t::is_debug)
568 }
569
571 constexpr void finalise_alignment() noexcept
572 {
573 // ----------------------------------------------------------------------------
574 // Check for the optimum in last cell/column.
575 // ----------------------------------------------------------------------------
576
577 this->check_score_of_cells_in_last_column(alignment_column, this->alignment_state);
578 this->check_score_of_last_cell(*alignment_column_it, this->alignment_state);
579 }
580
607 template <typename index_t, typename sequence1_t, typename sequence2_t, typename callback_t>
609 requires (!traits_t::is_vectorised)
611 constexpr void make_alignment_result([[maybe_unused]] index_t const idx,
612 [[maybe_unused]] sequence1_t & sequence1,
613 [[maybe_unused]] sequence2_t & sequence2,
614 callback_t & callback)
615 {
616 using result_value_t = typename alignment_result_value_type_accessor<alignment_result_t>::type;
617
618 // ----------------------------------------------------------------------------
619 // Build the alignment result
620 // ----------------------------------------------------------------------------
621
623 "The configuration must contain at least one align_cfg::output_* element.");
624
625 result_value_t res{};
626
627 if constexpr (traits_t::output_sequence1_id)
628 res.sequence1_id = idx;
629
630 if constexpr (traits_t::output_sequence2_id)
631 res.sequence2_id = idx;
632
633 // Choose what needs to be computed.
634 if constexpr (traits_t::compute_score)
635 res.score = this->alignment_state.optimum.score;
636
638 {
639 using alignment_coordinate_t = detail::advanceable_alignment_coordinate<>;
640 res.end_positions = alignment_coordinate_t{column_index_type{this->alignment_state.optimum.column_index},
641 row_index_type{this->alignment_state.optimum.row_index}};
642 // At some point this needs to be refactored so that it is not necessary to adapt the coordinate.
643 if constexpr (traits_t::is_banded)
644 res.end_positions.second += res.end_positions.first - this->trace_matrix.band_col_index;
645 }
646
648 {
649 // Get a aligned sequence builder for banded or un-banded case.
650 aligned_sequence_builder builder{sequence1, sequence2};
651
652 detail::matrix_coordinate const optimum_coordinate
653 {
654 detail::row_index_type{this->alignment_state.optimum.row_index},
655 detail::column_index_type{this->alignment_state.optimum.column_index}
656 };
657 auto trace_res = builder(this->trace_matrix.trace_path(optimum_coordinate));
658 res.begin_positions.first = trace_res.first_sequence_slice_positions.first;
659 res.begin_positions.second = trace_res.second_sequence_slice_positions.first;
660
662 res.alignment = std::move(trace_res.alignment);
663 }
664
665 // Store the matrices in debug mode.
666 if constexpr (traits_t::is_debug)
667 {
668 res.score_debug_matrix = std::move(score_debug_matrix);
669 if constexpr (traits_t::compute_sequence_alignment) // compute alignment
670 res.trace_debug_matrix = std::move(trace_debug_matrix);
671 }
672
673 callback(std::move(res));
674 }
675
701 template <typename indexed_sequence_pair_range_t, typename callback_t>
705 constexpr auto make_alignment_result(indexed_sequence_pair_range_t && index_sequence_pairs,
706 callback_t & callback)
707 {
708 using result_value_t = typename alignment_result_value_type_accessor<alignment_result_t>::type;
709
710 size_t simd_index = 0;
711 for (auto && [sequence_pairs, alignment_index] : index_sequence_pairs)
712 {
713 (void) sequence_pairs;
714 result_value_t res{};
715
716 if constexpr (traits_t::output_sequence1_id)
717 res.sequence1_id = alignment_index;
718
719 if constexpr (traits_t::output_sequence2_id)
720 res.sequence2_id = alignment_index;
721
722 if constexpr (traits_t::compute_score)
723 res.score = this->alignment_state.optimum.score[simd_index]; // Just take this
724
726 {
727 res.end_positions.first = this->alignment_state.optimum.column_index[simd_index];
728 res.end_positions.second = this->alignment_state.optimum.row_index[simd_index];
729 }
730
731 callback(std::move(res));
732 ++simd_index;
733 }
734 }
735
745 {
746 using std::get;
747
748 auto column = this->current_alignment_column();
749
750 auto coord = get<1>(column.front()).coordinate;
751 if constexpr (traits_t::is_banded)
752 coord.second += coord.first - this->score_matrix.band_col_index;
753
754 matrix_offset offset{row_index_type{static_cast<std::ptrdiff_t>(coord.second)},
755 column_index_type{static_cast<std::ptrdiff_t>(coord.first)}};
756
757 std::ranges::copy(column | std::views::transform([] (auto const & tpl)
758 {
759 using std::get;
760 return get<0>(tpl).current;
761 }), score_debug_matrix.begin() + offset);
762
763 // if traceback is enabled.
764 if constexpr (traits_t::compute_sequence_alignment)
765 {
766 auto trace_matrix_it = trace_debug_matrix.begin() + offset;
767 std::ranges::copy(column | std::views::transform([] (auto const & tpl)
768 {
769 using std::get;
770 return get<1>(tpl).current;
771 }), trace_debug_matrix.begin() + offset);
772 }
773 }
774
778 alignment_column_t alignment_column{};
780 alignment_column_iterator_t alignment_column_it{};
782 score_debug_matrix_t score_debug_matrix{};
784 trace_debug_matrix_t trace_debug_matrix{};
786 std::pair<size_t, size_t> max_size_in_collection{};
787};
788
789} // namespace seqan3::detail
Provides seqan3::detail::align_config_band.
Provides seqan3::align_cfg::scoring_scheme.
Provides seqan3::detail::align_result_selector.
Provides seqan3::aligned_allocator.
Provides seqan3::detail::aligned_sequence_builder.
Includes customized exception types for the alignment module .
Provides concepts needed internally for the alignment algorithms.
Provides helper type traits for the configuration and execution of the alignment algorithm.
Configuration element for setting a fixed size band.
Definition: align_config_band.hpp:63
Allocates uninitialized storage whose memory-alignment is specified by alignment.
Definition: aligned_allocator.hpp:77
Implements an internal alignment coordinate that can be used as an argument to the std::ranges::iota_...
Definition: advanceable_alignment_coordinate.hpp:66
Builds the alignment for a given pair of sequences and the respective trace.
Definition: aligned_sequence_builder.hpp:117
The alignment algorithm type to compute standard pairwise alignment using dynamic programming.
Definition: alignment_algorithm.hpp:78
constexpr alignment_algorithm(alignment_algorithm &&)=default
Defaulted.
constexpr alignment_algorithm & operator=(alignment_algorithm const &)=default
Defaulted.
constexpr void finalise_last_cell_in_column(bool const at_last_row) noexcept
Finalises the last cell of the current alignment column.
Definition: alignment_algorithm.hpp:561
trace_debug_matrix_t trace_debug_matrix
The debug matrix for the traces.
Definition: alignment_algorithm.hpp:784
constexpr alignment_algorithm(alignment_algorithm const &)=default
Defaulted.
typename traits_t::alignment_result_type alignment_result_t
The alignment result type.
Definition: alignment_algorithm.hpp:102
void compute_alignment_column(sequence1_value_t const &seq1_value, sequence2_t &&sequence2)
Computes a single alignment column.
Definition: alignment_algorithm.hpp:525
constexpr void compute_single_pair(size_t const idx, sequence1_t &&sequence1, sequence2_t &&sequence2, callback_t &callback)
Computes the pairwise sequence alignment for a single pair of sequences.
Definition: alignment_algorithm.hpp:291
void operator()(indexed_sequence_pairs_t &&indexed_sequence_pairs, callback_t &&callback)
This is an overloaded member function, provided for convenience. It differs from the above function o...
Definition: alignment_algorithm.hpp:211
score_debug_matrix_t score_debug_matrix
The debug matrix for the scores.
Definition: alignment_algorithm.hpp:782
constexpr auto convert_batch_of_sequences_to_simd_vector(sequence_range_t &sequences)
Converts a batch of sequences to a sequence of simd vectors.
Definition: alignment_algorithm.hpp:256
alignment_column_iterator_t alignment_column_it
Stores the state of the currently processed alignment column.
Definition: alignment_algorithm.hpp:780
constexpr alignment_algorithm & operator=(alignment_algorithm &&)=default
Defaulted.
constexpr void check_valid_band_parameter(sequence1_t &&sequence1, sequence2_t &&sequence2, align_cfg::band_fixed_size const &band)
Checks if the band parameters are valid for the given sequences.
Definition: alignment_algorithm.hpp:339
constexpr void finalise_alignment() noexcept
Checks the last cell, respectively column for the alignment optimum.
Definition: alignment_algorithm.hpp:571
decltype(_alignment_column_t()) alignment_column_t
The type of an alignment column as defined by the respective matrix policy.
Definition: alignment_algorithm.hpp:98
auto initialise_first_alignment_column(sequence2_t &&sequence2)
Initialises the first column of the alignment matrix.
Definition: alignment_algorithm.hpp:487
constexpr void make_alignment_result(index_t const idx, sequence1_t &sequence1, sequence2_t &sequence2, callback_t &callback)
Creates a new alignment result from the current alignment optimum and for the given pair of sequences...
Definition: alignment_algorithm.hpp:611
~alignment_algorithm()=default
Defaulted.
constexpr auto make_alignment_result(indexed_sequence_pair_range_t &&index_sequence_pairs, callback_t &callback)
Creates a new alignment result from the current alignment optimum and for the given indexed sequence ...
Definition: alignment_algorithm.hpp:705
void compute_matrix(sequence1_t &sequence1, sequence2_t &sequence2)
Compute the alignment by iterating over the alignment matrix in a column wise manner.
Definition: alignment_algorithm.hpp:396
constexpr alignment_algorithm(config_t const &cfg)
Constructs the algorithm with the passed configuration.
Definition: alignment_algorithm.hpp:140
static auto _alignment_column_t() -> decltype(std::declval< alignment_algorithm_t >().current_alignment_column())
Helper function to access ((some_policy *)this)->current_alignment_column().
void compute_matrix(sequence1_t &sequence1, sequence2_t &sequence2, align_cfg::band_fixed_size const &band)
This is an overloaded member function, provided for convenience. It differs from the above function o...
Definition: alignment_algorithm.hpp:427
std::pair< size_t, size_t > max_size_in_collection
The maximal size within the first and the second sequence collection.
Definition: alignment_algorithm.hpp:786
std::shared_ptr< config_t > cfg_ptr
The alignment configuration stored on the heap.
Definition: alignment_algorithm.hpp:776
alignment_column_t alignment_column
Stores the currently processed alignment column.
Definition: alignment_algorithm.hpp:778
constexpr alignment_algorithm()=default
Defaulted.
constexpr void initialise_debug_matrices(sequence1_t &sequence1, sequence2_t &sequence2)
Initialises the debug matrices for the given sequences.
Definition: alignment_algorithm.hpp:379
std::ranges::iterator_t< alignment_column_t > alignment_column_iterator_t
The iterator type over the alignment column.
Definition: alignment_algorithm.hpp:100
void dump_alignment_column()
Dumps the current alignment matrix in the debug score matrix and if requested debug trace matrix.
Definition: alignment_algorithm.hpp:744
A two dimensional matrix used inside of alignment algorithms.
Definition: two_dimensional_matrix.hpp:65
Thrown if the configuration of the alignment algorithm is invalid.
Definition: exception.hpp:34
Provides seqan3::detail::deferred_crtp_base.
Provides seqan3::views::elements.
Provides seqan3::detail::empty_type.
Provides various type traits for use on functions.
@ band
ID for the band option.
@ column
The corresponding alignment coordinate will be incrementable/decrementable in the column index.
@ column
Accesses matrix in column major order.
typename deferred_crtp_base_t::template invoke< derived_t > invoke_deferred_crtp_base
Template alias to instantiate the deferred crtp base with the derived class.
Definition: deferred_crtp_base.hpp:99
@ offset
Sequence (seqan3::field::seq) relative start position (0-based), unsigned value.
typename decltype(detail::split_after< i >(list_t{}))::first_type take
Return a seqan3::type_list of the first n types in the input type list.
Definition: traits.hpp:392
typename decltype(detail::split_after< i >(list_t{}))::second_type drop
Return a seqan3::type_list of the types in the input type list, except the first n.
Definition: traits.hpp:412
decltype(detail::transform< trait_t >(list_t{})) transform
Apply a transformation trait to every type in the list and return a seqan3::type_list of the results.
Definition: traits.hpp:495
constexpr auto slice
A view adaptor that returns a half-open interval on the underlying range.
Definition: slice.hpp:183
A helper concept to check if a type is a sequence pair.
The generic simd concept.
Refines the seqan3::simd::simd_concept requiring the underlying scalar type to model std::integral.
The internal SeqAn3 namespace.
Definition: aligned_sequence_concept.hpp:29
constexpr auto const & get(configuration< configs_t... > const &config) noexcept
This is an overloaded member function, provided for convenience. It differs from the above function o...
Definition: configuration.hpp:429
T push_back(T... args)
The <ranges> header from C++20's standard library.
Provides seqan3::simd::simd_type.
Provides seqan3::simd::simd_traits.
A traits type for the alignment algorithm that exposes static information stored within the alignment...
Definition: type_traits.hpp:87
static constexpr bool is_banded
Flag indicating whether banded alignment mode is enabled.
Definition: type_traits.hpp:130
static constexpr bool is_vectorised
Flag to indicate vectorised mode.
Definition: type_traits.hpp:121
std::conditional_t< is_vectorised, simd_type_t< original_score_type >, original_score_type > score_type
The score type for the alignment algorithm.
Definition: type_traits.hpp:143
static constexpr bool output_sequence2_id
Flag indicating whether the id of the second sequence shall be returned.
Definition: type_traits.hpp:180
static constexpr bool compute_sequence_alignment
Flag indicating whether the sequence alignment shall be computed.
Definition: type_traits.hpp:174
static constexpr size_t alignments_per_vector
The number of alignments that can be computed in one simd vector.
Definition: type_traits.hpp:158
static constexpr bool compute_begin_positions
Flag indicating whether the begin positions shall be computed.
Definition: type_traits.hpp:171
static constexpr bool is_debug
Flag indicating whether debug mode is enabled.
Definition: type_traits.hpp:132
static constexpr bool output_sequence1_id
Flag indicating whether the id of the first sequence shall be returned.
Definition: type_traits.hpp:177
decltype(determine_alignment_result_type()) alignment_result_type
The alignment result type if present. Otherwise seqan3::detail::empty_type.
Definition: type_traits.hpp:147
static constexpr bool compute_end_positions
Flag indicating whether the end positions shall be computed.
Definition: type_traits.hpp:168
static constexpr bool compute_score
Flag indicating whether the score shall be computed.
Definition: type_traits.hpp:166
A strong type for designated initialisation of the column index of a matrix.
Definition: matrix_coordinate.hpp:34
An empty class type used in meta programming.
Definition: empty_type.hpp:23
A representation of a location or offset within a two-dimensional matrix.
Definition: matrix_coordinate.hpp:96
Strong type for setting the column dimension of a matrix.
Definition: two_dimensional_matrix.hpp:32
Strong type for setting the row dimension of a matrix.
Definition: two_dimensional_matrix.hpp:40
A strong type for designated initialisation of the row index of a matrix.
Definition: matrix_coordinate.hpp:65
Provides seqan3::detail::to_simd view.
Provides the declaration of seqan3::detail::trace_directions.
Provides seqan3::simd::simd_concept.