SeqAn3 3.4.0-rc.1
The Modern C++ library for sequence analysis.
Loading...
Searching...
No Matches
Configuration

Provides configuration elements for the pairwise alignment configuration. More...

+ Collaboration diagram for Configuration:

Classes

class  seqan3::align_cfg::band_fixed_size
 Configuration element for setting a fixed size band. More...
 
struct  seqan3::align_cfg::extension_score
 A strong type of underlying type int32_t that represents the score (usually negative) of any character against a gap character. More...
 
struct  seqan3::align_cfg::free_end_gaps_sequence1_leading
 A strong type representing free_end_gaps_sequence1_leading of the seqan3::align_cfg::method_global. More...
 
struct  seqan3::align_cfg::free_end_gaps_sequence1_trailing
 A strong type representing free_end_gaps_sequence1_trailing of the seqan3::align_cfg::method_global. More...
 
struct  seqan3::align_cfg::free_end_gaps_sequence2_leading
 A strong type representing free_end_gaps_sequence2_leading of the seqan3::align_cfg::method_global. More...
 
struct  seqan3::align_cfg::free_end_gaps_sequence2_trailing
 A strong type representing free_end_gaps_sequence2_trailing of the seqan3::align_cfg::method_global. More...
 
class  seqan3::align_cfg::gap_cost_affine
 A configuration element for the affine gap cost scheme. More...
 
struct  seqan3::align_cfg::lower_diagonal
 A strong type representing the lower diagonal of the seqan3::align_cfg::band_fixed_size. More...
 
class  seqan3::align_cfg::method_global
 Sets the global alignment method. More...
 
class  seqan3::align_cfg::method_local
 Sets the local alignment method. More...
 
class  seqan3::align_cfg::min_score
 Sets the minimal score (maximal errors) allowed during an distance computation e.g. edit distance. More...
 
class  seqan3::align_cfg::on_result< callback_t >
 Configuration element to provide a user defined callback function for the alignment. More...
 
struct  seqan3::align_cfg::open_score
 A strong type of underlying type int32_t that represents a score (usually negative) that is incurred once per stretch of consecutive gaps. More...
 
class  seqan3::align_cfg::output_alignment
 Configures the alignment result to output the alignment. More...
 
class  seqan3::align_cfg::output_begin_position
 Configures the alignment result to output the begin positions. More...
 
class  seqan3::align_cfg::output_end_position
 Configures the alignment result to output the end position. More...
 
class  seqan3::align_cfg::output_score
 Configures the alignment result to output the score. More...
 
class  seqan3::align_cfg::output_sequence1_id
 Configures the alignment result to output the id of the first sequence. More...
 
class  seqan3::align_cfg::output_sequence2_id
 Configures the alignment result to output the id of the second sequence. More...
 
class  seqan3::align_cfg::detail::result_type< alignment_result_t >
 Configuration element capturing the configured seqan3::alignment_result for the alignment algorithm. More...
 
class  seqan3::align_cfg::score_type< score_t >
 A configuration element to set the score type used in the alignment algorithm. More...
 
class  seqan3::align_cfg::scoring_scheme< scoring_scheme_t >
 Sets the scoring scheme for the alignment algorithm. More...
 
struct  seqan3::align_cfg::upper_diagonal
 A strong type representing the upper diagonal of the seqan3::align_cfg::band_fixed_size. More...
 
class  seqan3::align_cfg::vectorised
 Enables the vectorised alignment computation if possible for the current configuration. More...
 

Typedefs

using seqan3::align_cfg::detail::debug = seqan3::detail::debug_mode< std::integral_constant< seqan3::detail::align_config_id, seqan3::detail::align_config_id::debug > >
 Configuration element for debugging the alignment algorithm.
 
using seqan3::align_cfg::parallel = seqan3::detail::parallel_mode< std::integral_constant< seqan3::detail::align_config_id, seqan3::detail::align_config_id::parallel > >
 Enables the parallel execution of the alignment algorithm if possible for the given configuration.
 

Enumerations

enum struct  seqan3::detail::align_config_id : uint8_t {
  seqan3::detail::align_config_id::band , seqan3::detail::align_config_id::debug , seqan3::detail::align_config_id::gap , seqan3::detail::align_config_id::global ,
  seqan3::detail::align_config_id::local , seqan3::detail::align_config_id::min_score , seqan3::detail::align_config_id::on_result , seqan3::detail::align_config_id::output_alignment ,
  seqan3::detail::align_config_id::output_begin_position , seqan3::detail::align_config_id::output_end_position , seqan3::detail::align_config_id::output_sequence1_id , seqan3::detail::align_config_id::output_sequence2_id ,
  seqan3::detail::align_config_id::output_score , seqan3::detail::align_config_id::parallel , seqan3::detail::align_config_id::result_type , seqan3::detail::align_config_id::score_type ,
  seqan3::detail::align_config_id::scoring , seqan3::detail::align_config_id::vectorised , seqan3::detail::align_config_id::SIZE
}
 An internal enum to check for a consistent configuration object. More...
 

Variables

template<>
constexpr std::array< std::array< bool, static_cast< uint8_t >(align_config_id::SIZE)>, static_cast< uint8_t >(align_config_id::SIZE)> seqan3::detail::compatibility_table< align_config_id >
 Declaration of algorithm specific compatibility table.
 
constexpr configuration seqan3::align_cfg::edit_scheme
 Shortcut for edit distance configuration.
 

Detailed Description

Provides configuration elements for the pairwise alignment configuration.

See the detailed Pairwise Alignments documentation for more details.

See also
Pairwise Alignments

Typedef Documentation

◆ debug

Configuration element for debugging the alignment algorithm.

Using this configuration allows to output the alignment matrices from the DP algorithm using the returned seqan3::alignment_result. The score matrix is always accessible, while the trace matrix can only be computed if an alignment was requested via the seqan3::align_cfg::output_alignment configuration.

Note
This configuration is only useful for debugging purposes as it can have a significant impact on the performance.

◆ parallel

Enables the parallel execution of the alignment algorithm if possible for the given configuration.

SeqAn's pairwise sequence alignment algorithm is internally accelerated using multi-threading. The parallel execution can be selected by specifying the seqan3::align_cfg::parallel configuration element. This will enable the asynchronous execution of the alignments in the backend. For the user interface nothing changes as the returned seqan3::algorithm_result_generator_range will preserve the order of the computed alignment results, i.e. the first result corresponds to the first alignment given by the input range. By default, a thread pool with std::thread::hardware_concurrency many threads will be created on a call to seqan3::align_pairwise and destructed when all alignments have been processed and the seqan3::algorithm_result_generator_range goes out of scope. The configuration element seqan3::align_cfg::parallel can be initialised with a custom thread count which determines the number of threads that will be spawned in the background.
Note that only independent alignment computations can be executed in parallel, i.e. you use this method when computing a batch of alignments rather than executing them separately.
Depending on your processor architecture you can gain a significant speed-up.

The value represents the number of threads to be used and must be greater than 0.

Example

// SPDX-FileCopyrightText: 2006-2024 Knut Reinert & Freie Universität Berlin
// SPDX-FileCopyrightText: 2016-2024 Knut Reinert & MPI für molekulare Genetik
// SPDX-License-Identifier: CC0-1.0
#include <thread>
int main()
{
// Enables parallel computation with two threads.
// Enables parallel computation with the number of concurrent threads supported by the current architecture.
;
}
Provides seqan3::align_cfg::parallel configuration.
A global configuration type used to enable parallel execution of algorithms.
Definition configuration_element_parallel_mode.hpp:29
T hardware_concurrency(T... args)
Remarks
For a complete overview, take a look at Pairwise Alignments.

Enumeration Type Documentation

◆ align_config_id

enum struct seqan3::detail::align_config_id : uint8_t
strong

An internal enum to check for a consistent configuration object.

Enumerator
band 

ID for the band option.

debug 

ID for the debug option.

gap 

ID for the gap_cost_affine option.

global 

ID for the global alignment option.

local 

ID for the local alignment option.

min_score 

ID for the min_score option.

on_result 

ID for the on_result option.

output_alignment 

ID for the alignment output option.

output_begin_position 

ID for the begin position output option.

output_end_position 

ID for the end position output option.

output_sequence1_id 

ID for the sequence1 id output option.

output_sequence2_id 

ID for the sequence2 id output option.

output_score 

ID for the score output option.

parallel 

ID for the parallel option.

result_type 

ID for the result_type option.

score_type 

ID for the score_type option.

scoring 

ID for the scoring_scheme option.

vectorised 

ID for the vectorised option.

SIZE 

Represents the number of configuration elements.

Variable Documentation

◆ compatibility_table< align_config_id >

template<>
constexpr std::array<std::array<bool, static_cast<uint8_t>(align_config_id::SIZE)>, static_cast<uint8_t>(align_config_id::SIZE)> seqan3::detail::compatibility_table< align_config_id >
inlineconstexpr

Declaration of algorithm specific compatibility table.

Template Parameters
algorithm_id_typeThe type of the algorithm specific id. Algorithm configurations must maintain this table to allow validation checks.

◆ edit_scheme

constexpr configuration seqan3::align_cfg::edit_scheme
inlineconstexpr
Initial value:
=
scoring_scheme{nucleotide_scoring_scheme{}} | gap_cost_affine{open_score{0}, extension_score{-1}}

Shortcut for edit distance configuration.

The edit distance computation is a specific sub-problem of the alignment computation with the aim to count the number of edits to transform one sequence into another. An edit operation can be a substitution, an insertion, or a deletion. Accordingly, this algorithm uses a predefined scoring scheme as well as a gap scheme, where the score for a match is 0, for a mismatch -1, for a gap -1, and for a gap open 0.

Performance

Under the hood SeqAn uses a fast bit-vector algorithm to compute the edit distance whenever possible. This depends on the final alignment configuration. Currently, the fast edit distance algorithm is only triggered for global alignments with the with free ends in the first sequence. So make sure to configure the seqan3::align_cfg::method_global configuration element accordingly (see class documentation).

The performance of the algorithm can further be improved if the number of maximal errors (edits) is known by using the align_cfg::min_score configuration.

// SPDX-FileCopyrightText: 2006-2024 Knut Reinert & Freie Universität Berlin
// SPDX-FileCopyrightText: 2016-2024 Knut Reinert & MPI für molekulare Genetik
// SPDX-License-Identifier: CC0-1.0
int main()
{
// Computes semi global edit distance using fast-bit vector algorithm.
// Computes semi global edit distance using slower standard pairwise algorithm.
// Computes global distance allowing a minimal score of 3 (Default: edit distance).
auto cfg_errors =
}
Provides seqan3::align_cfg::edit_scheme.
Provides global and local alignment configurations.
Provides seqan3::align_cfg::min_score configuration.
Sets the global alignment method.
Definition align_config_method.hpp:119
Sets the minimal score (maximal errors) allowed during an distance computation e.g....
Definition align_config_min_score.hpp:36
constexpr configuration edit_scheme
Shortcut for edit distance configuration.
Definition align_config_edit.hpp:48
A strong type representing free_end_gaps_sequence1_leading of the seqan3::align_cfg::method_global.
Definition align_config_method.hpp:65
A strong type representing free_end_gaps_sequence1_trailing of the seqan3::align_cfg::method_global.
Definition align_config_method.hpp:85
A strong type representing free_end_gaps_sequence2_leading of the seqan3::align_cfg::method_global.
Definition align_config_method.hpp:75
A strong type representing free_end_gaps_sequence2_trailing of the seqan3::align_cfg::method_global.
Definition align_config_method.hpp:95
Attention
If the edit distance configuration is combined with any other configuration element or setting, the algorithm falls back to the slower standard pairwise algorithm. For example the cfg_slow in the above example will trigger the slower algorithm which can handle the case if the ends are free in the second sequence instead of the first sequence.
Hide me