SeqAn3 3.4.0-rc.1
The Modern C++ library for sequence analysis.
Loading...
Searching...
No Matches
alignment/pairwise/detail/type_traits.hpp
Go to the documentation of this file.
1// SPDX-FileCopyrightText: 2006-2024 Knut Reinert & Freie Universität Berlin
2// SPDX-FileCopyrightText: 2016-2024 Knut Reinert & MPI für molekulare Genetik
3// SPDX-License-Identifier: BSD-3-Clause
4
10#pragma once
11
12#include <ranges>
13#include <type_traits>
14
38
39namespace seqan3::detail
40{
41
42//------------------------------------------------------------------------------
43// chunked_indexed_sequence_pairs
44//------------------------------------------------------------------------------
45
58template <typename sequence_pairs_t>
61{
63 using type = decltype(views::zip(std::declval<sequence_pairs_t>(), std::views::iota(0)) | views::chunk(1));
64};
65
66//------------------------------------------------------------------------------
67// alignment_configuration_traits
68//------------------------------------------------------------------------------
69
77template <typename configuration_t>
78 requires is_type_specialisation_of_v<std::remove_cv_t<configuration_t>, configuration>
80{
81private:
92 template <arithmetic score_t>
93 using select_scalar_index_t = min_viable_uint_t<1ull << (bits_of<score_t> - 1)>;
94
96 static constexpr auto determine_alignment_result_type() noexcept
97 {
98 if constexpr (configuration_t::template exists<align_cfg::detail::result_type>())
99 {
101 std::declval<configuration_t>()))>;
102 return typename result_type_cfg_t::type{}; // Access the stored result_type.
103 }
104 else
105 {
106 return empty_type{};
107 }
108 }
109
110public:
112 static constexpr bool is_vectorised = configuration_t::template exists<align_cfg::vectorised>();
114 static constexpr bool is_parallel = configuration_t::template exists<align_cfg::parallel>();
116 static constexpr bool is_global = configuration_t::template exists<seqan3::align_cfg::method_global>();
118 static constexpr bool is_local = configuration_t::template exists<seqan3::align_cfg::method_local>();
120 static constexpr bool is_banded = configuration_t::template exists<align_cfg::band_fixed_size>();
122 static constexpr bool is_debug = configuration_t::template exists<detail::debug_mode>();
124 static constexpr bool is_one_way_execution = configuration_t::template exists<align_cfg::on_result>();
126 using scoring_scheme_type = decltype(get<align_cfg::scoring_scheme>(std::declval<configuration_t>()).scheme);
128 using scoring_scheme_alphabet_type = typename scoring_scheme_type::alphabet_type;
143 lazy_conditional_t<is_vectorised, lazy<simd_matrix_coordinate, matrix_index_type>, matrix_coordinate>;
144
146 static constexpr size_t alignments_per_vector = []() constexpr
147 {
148 if constexpr (is_vectorised)
150 else
151 return 1;
152 }();
154 static constexpr bool compute_score = configuration_t::template exists<align_cfg::output_score>();
156 static constexpr bool compute_end_positions = configuration_t::template exists<align_cfg::output_end_position>();
158 static constexpr bool compute_begin_positions =
159 configuration_t::template exists<align_cfg::output_begin_position>();
161 static constexpr bool compute_sequence_alignment = configuration_t::template exists<align_cfg::output_alignment>();
163 static constexpr bool output_sequence1_id = configuration_t::template exists<align_cfg::output_sequence1_id>();
165 static constexpr bool output_sequence2_id = configuration_t::template exists<align_cfg::output_sequence2_id>();
172};
173
174//------------------------------------------------------------------------------
175// alignment_function_traits
176//------------------------------------------------------------------------------
177
183template <typename function_t>
185{
187 using sequence_input_type = typename function_traits<function_t>::template argument_type_at<0>;
189 using callback_type = typename function_traits<function_t>::template argument_type_at<1>;
191 using alignment_result_type = typename function_traits<callback_type>::template argument_type_at<0>;
192};
193
194} // namespace seqan3::detail
Provides seqan3::detail::align_config_band.
Provides seqan3::align_cfg::detail::debug.
Provides global and local alignment configurations.
Provides seqan3::align_cfg::on_result.
Provides configuration for alignment output.
Provides seqan3::align_cfg::parallel configuration.
Provides seqan3::align_cfg::detail::result_type.
Provides alignment configuration seqan3::align_cfg::score_type.
Provides seqan3::align_cfg::scoring_scheme.
Provides seqan3::align_cfg::vectorised configuration.
Provides concepts needed internally for the alignment algorithms.
Provides utility functions for bit twiddling.
Provides seqan3::views::chunk.
A configuration element to set the score type used in the alignment algorithm.
Definition align_config_score_type.hpp:33
Collection of elements to configure an algorithm.
Definition configuration.hpp:42
Provides seqan3::configuration and utility functions.
Provides seqan3::detail::empty_type.
Provides various type traits for use on functions.
trace_directions
The possible directions a trace can have. The values can be combined by the logical |-operator.
Definition trace_directions.hpp:26
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
seqan::stl::views::chunk chunk
A view adaptor that divides a range into chunks. <dl class="no-api">This entity is not part of the Se...
Definition chunk.hpp:23
A helper concept to check if a type is a range over seqan3::detail::sequence_pair.
Provides lazy template instantiation traits.
Provides seqan3::detail::matrix_index, seqan3::detail::matrix_coordinate and associated strong types.
The internal SeqAn3 namespace.
Definition aligned_sequence_concept.hpp:26
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 alignment/pairwise/detail/type_traits.hpp:80
static constexpr bool is_banded
Flag indicating whether banded alignment mode is enabled.
Definition alignment/pairwise/detail/type_traits.hpp:120
static constexpr bool is_vectorised
Flag to indicate vectorised mode.
Definition alignment/pairwise/detail/type_traits.hpp:112
static constexpr bool is_local
Flag indicating whether local alignment mode is enabled.
Definition alignment/pairwise/detail/type_traits.hpp:118
static constexpr bool requires_trace_information
Flag indicating whether the trace matrix needs to be computed.
Definition alignment/pairwise/detail/type_traits.hpp:171
static constexpr bool has_output_configuration
Flag indicating if any output option was set.
Definition alignment/pairwise/detail/type_traits.hpp:167
static constexpr bool output_sequence2_id
Flag indicating whether the id of the second sequence shall be returned.
Definition alignment/pairwise/detail/type_traits.hpp:165
static constexpr bool is_parallel
Flag indicating whether parallel alignment mode is enabled.
Definition alignment/pairwise/detail/type_traits.hpp:114
typename scoring_scheme_type::alphabet_type scoring_scheme_alphabet_type
The alphabet of the selected scoring scheme.
Definition alignment/pairwise/detail/type_traits.hpp:128
static constexpr bool compute_sequence_alignment
Flag indicating whether the sequence alignment shall be computed.
Definition alignment/pairwise/detail/type_traits.hpp:161
static constexpr size_t alignments_per_vector
The number of alignments that can be computed in one simd vector.
Definition alignment/pairwise/detail/type_traits.hpp:146
static constexpr bool compute_begin_positions
Flag indicating whether the begin positions shall be computed.
Definition alignment/pairwise/detail/type_traits.hpp:158
static constexpr auto determine_alignment_result_type() noexcept
Helper function to determine the alignment result type.
Definition alignment/pairwise/detail/type_traits.hpp:96
static constexpr bool is_global
Flag indicating whether global alignment method is enabled.
Definition alignment/pairwise/detail/type_traits.hpp:116
static constexpr bool is_debug
Flag indicating whether debug mode is enabled.
Definition alignment/pairwise/detail/type_traits.hpp:122
decltype(get< align_cfg::scoring_scheme >(std::declval< configuration_t >()).scheme) scoring_scheme_type
The selected scoring scheme.
Definition alignment/pairwise/detail/type_traits.hpp:126
static constexpr bool output_sequence1_id
Flag indicating whether the id of the first sequence shall be returned.
Definition alignment/pairwise/detail/type_traits.hpp:163
lazy_conditional_t< is_vectorised, lazy< simd_matrix_coordinate, matrix_index_type >, matrix_coordinate > matrix_coordinate_type
The type of the matrix coordinate.
Definition alignment/pairwise/detail/type_traits.hpp:143
decltype(determine_alignment_result_type()) alignment_result_type
The alignment result type if present. Otherwise seqan3::detail::empty_type.
Definition alignment/pairwise/detail/type_traits.hpp:137
static constexpr bool is_one_way_execution
Flag indicating whether a user provided callback was given.
Definition alignment/pairwise/detail/type_traits.hpp:124
typename std::remove_reference_t< decltype(std::declval< configuration_t >().get_or(align_cfg::score_type< int32_t >{}))>::type original_score_type
The original score type selected by the user.
Definition alignment/pairwise/detail/type_traits.hpp:131
static constexpr bool compute_end_positions
Flag indicating whether the end positions shall be computed.
Definition alignment/pairwise/detail/type_traits.hpp:156
static constexpr bool compute_score
Flag indicating whether the score shall be computed.
Definition alignment/pairwise/detail/type_traits.hpp:154
A traits class to provide a uniform access to the properties of the wrapped alignment algorithm.
Definition alignment/pairwise/detail/type_traits.hpp:185
typename function_traits< function_t >::template argument_type_at< 1 > callback_type
The type of the callback function called when a result was computed.
Definition alignment/pairwise/detail/type_traits.hpp:189
typename function_traits< function_t >::template argument_type_at< 0 > sequence_input_type
The type of the sequence input to the alignment algorithm.
Definition alignment/pairwise/detail/type_traits.hpp:187
typename function_traits< callback_type >::template argument_type_at< 0 > alignment_result_type
The type of the alignment result to be computed.
Definition alignment/pairwise/detail/type_traits.hpp:191
A transformation trait to retrieve the chunked range over indexed sequence pairs.
Definition alignment/pairwise/detail/type_traits.hpp:61
decltype(views::zip(std::declval< sequence_pairs_t >(), std::views::iota(0))|views::chunk(1)) type
The transformed type that models seqan3::detail::indexed_sequence_pair_range.
Definition alignment/pairwise/detail/type_traits.hpp:63
An empty class type used in meta programming.
Definition empty_type.hpp:20
seqan3::simd::simd_traits is the trait class that provides uniform interface to the properties of sim...
Definition simd_traits.hpp:38
Provides type traits for working with templates.
Provides the declaration of seqan3::detail::trace_directions.
Provides seqan3::views::zip.
Hide me