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...
 
class  seqan3::align_cfg::band_fixed_size
 Configuration element for setting a fixed size 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::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...
 
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::lower_diagonal
 A strong type representing the lower diagonal of the seqan3::align_cfg::band_fixed_size. More...
 
struct  seqan3::align_cfg::max_error
 Sets the maximal errors allowed during an edit distance computation. More...
 
struct  seqan3::align_cfg::method_global
 Sets the global alignment method. More...
 
struct  seqan3::align_cfg::on_result< callback_t >
 Configuration element to provide a user defined callback function for the alignment. 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...
 
struct  seqan3::align_cfg::upper_diagonal
 A strong type representing the upper diagonal of the seqan3::align_cfg::band_fixed_size. 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_scheme = scoring{nucleotide_scoring_scheme{}} | gap{gap_scheme{gap_score{-1}}}
 Shortcut for edit distance configuration. More...
 
constexpr seqan3::detail::method_local_tag seqan3::align_cfg::method_local {}
 Sets the local alignment method. 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_scheme

constexpr configuration seqan3::align_cfg::edit_scheme = scoring{nucleotide_scoring_scheme{}} | gap{gap_scheme{gap_score{-1}}}
inlineconstexpr

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.
seqan3::align_cfg::aligned_ends{seqan3::free_ends_first};
// Computes semi global edit distance using slower standard pairwise algorithm.
seqan3::align_cfg::aligned_ends{seqan3::free_ends_second};
// Computes global edit distance allowing maximal 3 errors.
auto cfg_errors = seqan3::align_cfg::method_global{} |
}
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.

◆ method_local

constexpr seqan3::detail::method_local_tag seqan3::align_cfg::method_local {}
inlineconstexpr

Sets the local alignment method.

The alignment algorithm can be categorised in different methods. For example, the local and the global alignment are two different methods, while the semi-global alignment is a variation of the global alignment. This differentiation makes it possible to define a subset of configurations that can work with a particular method. Since it is not possible to guess what the desired method for a user is, this configuration must be provided for the alignment algorithm and cannot be defaulted.

Example

◆ vectorise

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

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.
}
debug_stream.hpp
Provides seqan3::debug_stream and related types.
dna4.hpp
Provides seqan3::dna4, container aliases and string literals.
align_pairwise.hpp
Provides pairwise alignment function.
seqan3::align_cfg::parallel
seqan3::detail::parallel_mode< std::integral_constant< detail::align_config_id, detail::align_config_id::parallel > > parallel
Enables the parallel execution of the alignment algorithm if possible for the given configuration.
Definition: align_config_parallel.hpp:40
align_config_method.hpp
Provides global and local alignment configurations.
seqan3::nucleotide_scoring_scheme
A data structure for managing and computing the score of two nucleotides.
Definition: nucleotide_scoring_scheme.hpp:37
align_config_scoring.hpp
Provides seqan3::align_cfg::scoring.
nucleotide_scoring_scheme.hpp
Provides seqan3::nucleotide_scoring_scheme.
seqan3::align_cfg::edit_scheme
constexpr configuration edit_scheme
Shortcut for edit distance configuration.
Definition: align_config_edit.hpp:51
seqan3::align_pairwise
constexpr auto align_pairwise(sequence_t &&seq, alignment_config_t const &config)
Computes the pairwise alignment for a pair of sequences or a range over sequence pairs.
Definition: align_pairwise.hpp:139
align_config_max_error.hpp
Provides seqan3::align_cfg::max_error configuration.
seqan3::align_cfg::vectorise
constexpr detail::vectorise_tag vectorise
Enables the vectorised alignment computation if possible for the current configuration.
Definition: align_config_vectorise.hpp:55
std::tie
T tie(T... args)
seqan3::align_cfg::scoring
Sets the scoring scheme for the alignment algorithm.
Definition: align_config_scoring.hpp:41
align_config_aligned_ends.hpp
Provides seqan3::align_cfg::aligned_ends.
seqan3::mismatch_score
A strong type of underlying type score_type that represents the score two different characters.
Definition: scoring_scheme_base.hpp:65
align_config_vectorise.hpp
Provides seqan3::align_cfg::vectorise configuration.
thread
std::thread::hardware_concurrency
T hardware_concurrency(T... args)
seqan3::align_cfg::aligned_ends
The configuration for aligned sequence ends.
Definition: align_config_aligned_ends.hpp:548
align_config_parallel.hpp
Provides seqan3::align_cfg::parallel configuration.
seqan3::align_cfg::max_error
Sets the maximal errors allowed during an edit distance computation.
Definition: align_config_max_error.hpp:36
seqan3::debug_stream
debug_stream_type debug_stream
A global instance of seqan3::debug_stream_type.
Definition: debug_stream.hpp:42
seqan3::align_cfg::method_global
Sets the global alignment method.
Definition: align_config_method.hpp:102
seqan3::match_score
A strong type of underlying type score_type that represents the score of two matching characters.
Definition: scoring_scheme_base.hpp:40
align_config_edit.hpp
Provides seqan3::align_cfg::edit_scheme.