SeqAn3  3.0.2
The Modern C++ library for sequence analysis.
Configuration

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

+ Collaboration diagram for Configuration:

Classes

struct  seqan3::align_cfg::aligned_ends< end_gaps_t >
 The configuration for aligned sequence ends. More...
 
struct  seqan3::back_end_first< value_t >
 The penalty configuration for aligning the back of the first sequence with a gap. More...
 
struct  seqan3::back_end_second< value_t >
 The penalty configuration for aligning the back of the second sequence with a gap. More...
 
struct  seqan3::align_cfg::band< band_t >
 Configuration element for setting the band. More...
 
class  seqan3::end_gaps< ends_t >
 Wraps the sequence end-gap specifiers and provides ordered access to the respective values. More...
 
struct  seqan3::front_end_first< value_t >
 The penalty configuration for aligning the front of the first sequence with a gap. More...
 
struct  seqan3::front_end_second< value_t >
 The penalty configuration for aligning the front of the second sequence with a gap. More...
 
struct  seqan3::align_cfg::gap< gap_scheme_t >
 A configuration element for the gap scheme. More...
 
struct  seqan3::align_cfg::max_error
 Sets the maximal errors allowed during an edit distance computation. More...
 
struct  seqan3::align_cfg::mode< mode_type >
 Sets the alignment mode. More...
 
class  seqan3::align_cfg::result< alignment_result_tag_t, score_t >
 Sets the result of the alignment computation. More...
 
struct  seqan3::sequence_end_gap_specifier_base< value_t, _is_static, _value >
 A mixin class which can maintain a static or a dynamic bool state. More...
 

Typedefs

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

Variables

constexpr configuration seqan3::align_cfg::edit
 Shortcut for edit distance configuration. More...
 
constexpr detail::global_alignment_type seqan3::global_alignment
 Helper variable to select the global alignment. More...
 
constexpr detail::local_alignment_type seqan3::local_alignment
 Helper variable to select the local alignment. More...
 
constexpr detail::vectorise_tag seqan3::align_cfg::vectorise {}
 Enables the vectorised alignment computation if possible for the current configuration. More...
 

Detailed Description

Provides configuration elements for the pairwise alignment configuration.

See also
Alignment

Typedef Documentation

◆ parallel

using seqan3::align_cfg::parallel = typedef seqan3::detail::parallel_mode<std::integral_constant<detail::align_config_id, detail::align_config_id::parallel> >

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

With this configuration you can enable the parallel execution of the pairwise sequence alignment. This means that for a batch of pairwise sequence alignments the specified number of threads will be spawned to compute them in parallel. 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

#include <thread>
int main()
{
// Enables parallel computation with two threads.
// Enables parallel computation with the number of concurrent threads supported by the current architecture.
;
}

Variable Documentation

◆ edit

constexpr configuration seqan3::align_cfg::edit
inline
Initial value:
nucleotide_scoring_scheme() -> nucleotide_scoring_scheme< int8_t >
Default constructed objects deduce to int8_t.
gap_score(score_type) -> gap_score< score_type >
Deduce the score type from the given argument.
constexpr detail::global_alignment_type global_alignment
Helper variable to select the global alignment.
Definition: align_config_mode.hpp:54
gap(scheme_t) -> gap< scheme_t >
Deduces the gap scheme from the constructor argument.
mode(mode_type) -> mode< mode_type >
Deduces the alignment mode from the given constructor argument.
scoring(scheme_t) -> scoring< remove_cvref_t< scheme_t >>
Deduces the scoring scheme type from the constructor argument.
gap_scheme() -> gap_scheme< int8_t >
Default constructed objects deduce to int8_t.

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 and semi-global alignments with free ends in the first sequence.

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

int main()
{
// Computes semi global edit distance using fast-bit vector algorithm.
auto cfg_fast = seqan3::align_cfg::edit | seqan3::align_cfg::aligned_ends{seqan3::free_ends_first};
// Computes semi global edit distance using slower standard pairwise algorithm.
auto cfg_slow = seqan3::align_cfg::edit | seqan3::align_cfg::aligned_ends{seqan3::free_ends_second};
// Computes global edit distance allowing maximal 3 errors.
}
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.

◆ global_alignment

constexpr detail::global_alignment_type seqan3::global_alignment
inline

Helper variable to select the global alignment.

Example

◆ local_alignment

constexpr detail::local_alignment_type seqan3::local_alignment
inline

Helper variable to select the local alignment.

Example

◆ vectorise

constexpr detail::vectorise_tag seqan3::align_cfg::vectorise {}
inline

Enables the vectorised alignment computation if possible for the current configuration.

In the vectorised alignment computation several pairwise sequence alignments are processed simultaneously in one invocation. To do so, we pack the alignments in so called extended SIMD registers which allow to compute a single instruction on multiple data at the same time. Depending on your processor architecture you can gain a significant speed-up, e.g. by running up to 64 alignments in parallel on the latest intel CPUs. In our mode we vectorise multiple alignments and not a single alignment. This means that you should provide many sequences to compute as one batch rather than computing them separately as there won't be performance gains.

See also
For further information on SIMD see https://en.wikipedia.org/wiki/SIMD.

Example

int main()
{
// Enable SIMD vectorised alignment computation.
}