SeqAn3  3.0.2
The Modern C++ library for sequence analysis.
seqan3::end_gaps< ends_t > Class Template Reference

Wraps the sequence end-gap specifiers and provides ordered access to the respective values. More...

#include <seqan3/alignment/configuration/align_config_aligned_ends.hpp>

Public Member Functions

Constructors, destructor and assignment
constexpr end_gaps () noexcept
 Default constructor.
 
constexpr end_gaps (end_gaps const &) noexcept=default
 Defaulted.
 
constexpr end_gaps (end_gaps &&) noexcept=default
 Defaulted.
 
constexpr end_gapsoperator= (end_gaps const &) noexcept=default
 Defaulted.
 
constexpr end_gapsoperator= (end_gaps &&) noexcept=default
 Defaulted.
 
 ~end_gaps () noexcept=default
 Defaulted.
 
constexpr end_gaps (ends_t const ...args) noexcept requires(sizeof...(ends_t) > 0)
 Construction from at least one sequence end-gap specifier.
 

Static Public Member Functions

template<size_t pos>
static constexpr bool is_static () noexcept
 Returns whether a value at the given position was set statically. More...
 

Related Functions

(Note that these are not member functions.)

Predefined end-gaps configurations

These variables are pre-configured end-gaps that are frequently used in pairwise sequence alignments.

constexpr end_gaps free_ends_all
 All ends are free. More...
 
constexpr end_gaps free_ends_none
 All ends are penalised. More...
 
constexpr end_gaps free_ends_first
 Ends of the first sequence are free. More...
 
constexpr end_gaps free_ends_second
 Ends for the second sequence are free. More...
 
Type deduction guides
template<typename ... ends_t>
 end_gaps (ends_t const &...) -> end_gaps< ends_t... >
 Deduces the end-gap specifier from the constructor arguments. More...
 

Element access

constexpr bool operator[] (size_t const pos) const noexcept
 Returns the value for the specifier at the given position. More...
 
template<size_t pos>
static constexpr bool get_static () noexcept
 Returns the static value for the specifier at the given position. More...
 

Detailed Description

template<typename ... ends_t>
class seqan3::end_gaps< ends_t >

Wraps the sequence end-gap specifiers and provides ordered access to the respective values.

Template Parameters
ends_tA parameter pack containing at most 4 sequence end-gap specifier.

A wrapper for providing ordered access to the end-gap specifiers independent of the input order. The possible input types can be: seqan3::front_end_first, seqan3::back_end_first, seqan3::front_end_second and seqan3::back_end_second. The types in the parameter pack ends_t are deduced by the corresponding constructor argument. If a specifier is not set it will default to false and thus the respective end-gap will be penalised in the pairwise alignment.

Static vs runtime configuration

The end_gaps class preserves the static/non-static property of the respective end-gap specifier. Those specifiers can, depending on how they are constructed, contain a static information or a runtime information whether or not a specific end-gap is enabled. To check whether the information was static the function end_gaps::is_static can be used. If it was static the function end_gaps::get_static can be used to obtain the respective value at compile time. Note that both functions are static and thus need to be called on the type and not on an instance of the type.

int main()
{
// Create an end_gaps object with one user defined static value and one user defined non-static value.
// Check if the front_end_first parameter contains static information.
if constexpr (decltype(eg)::is_static<0>())
{
seqan3::debug_stream << "The leading gaps of the first sequence are static and the value is: " <<
std::boolalpha << decltype(eg)::get_static<0>() << '\n';
}
// Defaulted parameters will always be false and static.
seqan3::debug_stream << "The leading gaps of the first sequence are static and the value is " <<
std::boolalpha << decltype(eg)::get_static<0>() << '\n';
// Non-static parameters won't be captured as static. Trying to access it via get_static will trigger a static assert.
if constexpr (!decltype(eg)::is_static<2>())
{
seqan3::debug_stream << "The leading gaps of the second sequence is not static! The value is: " <<
std::boolalpha << eg[2] << '\n';
}
seqan3::debug_stream << "The value can always be determined at runtime like for the trailing gaps of the second sequence: " <<
std::boolalpha << eg[3] << '\n';
}

To get the respective value at runtime use the []-operator. This function returns always the respective value independent of whether the value was provided by a static variable or a runtime variable. Also note that static and non-static end-gap specifier can be mixed within the end_gaps class template.

It is strongly recommended to use the static information if possible and only make those specifiers depend on runtime parameters that cannot be resolved at compile time. This will reduce the compile time while configuring the alignment algorithm since the runtime information need to be translated into static information for the alignment algorithm.

See also
seqan3::front_end_first
seqan3::back_end_first
seqan3::front_end_second
seqan3::back_end_second

Member Function Documentation

◆ get_static()

template<typename ... ends_t>
template<size_t pos>
static constexpr bool seqan3::end_gaps< ends_t >::get_static ( )
inlinestaticconstexprnoexcept

Returns the static value for the specifier at the given position.

Template Parameters
posThe position to get the value for the respective end-gap for.

The sequence end-gap specifier are stored in an ordered fashion. The following position mapping will be used to access the respective values: seqan3::front_end_first → 0; seqan3::back_end_first → 1; seqan3::front_end_second → 2; seqan3::back_end_second → 3.

Returns
true if the respective sequence end-gap is set to be free, false otherwise.

◆ is_static()

template<typename ... ends_t>
template<size_t pos>
static constexpr bool seqan3::end_gaps< ends_t >::is_static ( )
inlinestaticconstexprnoexcept

Returns whether a value at the given position was set statically.

\ name Observers

Template Parameters
posThe position to get the value for the respective end-gap for.
Template Parameters
posThe position to get the value for the respective end-gap for.

The sequence end-gap specifier are stored in an ordered fashion. The following position mapping will be used to access the respective values: seqan3::front_end_first → 0; seqan3::back_end_first → 1; seqan3::front_end_second → 2; seqan3::back_end_second → 3.

Returns
true if the respective sequence end-gap is set to be free, false otherwise.
true if the respective sequence end-gap was set in a static context, false otherwise.

◆ operator[]()

template<typename ... ends_t>
constexpr bool seqan3::end_gaps< ends_t >::operator[] ( size_t const  pos) const
inlineconstexprnoexcept

Returns the value for the specifier at the given position.

Parameters
[in]posThe position to get the value for the respective end-gap for.

The sequence end-gap specifier are stored in an ordered fashion. The following position mapping will be used to access the respective values: seqan3::front_end_first → 0; seqan3::back_end_first → 1; seqan3::front_end_second → 2; seqan3::back_end_second → 3.

Returns
true if the respective sequence end-gap is set to be free, false otherwise.

Friends And Related Function Documentation

◆ end_gaps()

template<typename ... ends_t>
end_gaps ( ends_t const &  ...) -> end_gaps< ends_t... >
related

Deduces the end-gap specifier from the constructor arguments.

Template Parameters
ends_tA template parameter pack containing at most 4 sequence end-gap specifiers.

◆ free_ends_all

template<typename ... ends_t>
constexpr end_gaps free_ends_all
related
Initial value:
{front_end_first<std::true_type>{},
back_end_first<std::true_type>{},
front_end_second<std::true_type>{},
back_end_second<std::true_type>{}}

All ends are free.

Computes an overlap alignment where the end of one sequence can overlap with the end of the other sequence. In the following example the gaps at the ends are not penalised and the sequences are aligned such that the prefix of the first sequences matches the suffix of the second sequence.

-----ACGTAAAACGT
|||||
TTTTTACGTA------

◆ free_ends_first

template<typename ... ends_t>
constexpr end_gaps free_ends_first
related
Initial value:
{front_end_first<std::true_type>{},
back_end_first<std::true_type>{},
front_end_second<std::false_type>{},
back_end_second<std::false_type>{}}

Ends of the first sequence are free.

Computes a semi-global alignment where the ends of the first sequence can align to gaps without additional costs. For example in the following alignment, the leading and trailing gaps are not penalised and the smaller sequence can be aligned such that it matches the middle part of the longer sequence.

TTTTTACGT---ATGTCCCCC
|||| | ||
-----ACGTAAAACGT-----

◆ free_ends_none

template<typename ... ends_t>
constexpr end_gaps free_ends_none
related
Initial value:
{front_end_first<std::false_type>{},
back_end_first<std::false_type>{},
front_end_second<std::false_type>{},
back_end_second<std::false_type>{}}

All ends are penalised.

Computes a global alignment where all end-gaps are penalised. For example in the following alignment, the alignment is forced to cover the entire sequences and the leading gaps will be penalised.

---ACG--TAAAACGT
||| || | |||
AAAACGTATAGACCGT

◆ free_ends_second

template<typename ... ends_t>
constexpr end_gaps free_ends_second
related
Initial value:
{front_end_first<std::false_type>{},
back_end_first<std::false_type>{},
front_end_second<std::true_type>{},
back_end_second<std::true_type>{}}

Ends for the second sequence are free.

Computes a semi-global alignment where the ends of the second sequence can align to gaps without additional costs. For example in the following alignment, the leading and trailing gaps are not penalised and the smaller sequence can be aligned such that it matches the middle part of the longer sequence.

-----ACGTAAAACGT-----
|||| | ||
TTTTTACGT---ATGTCCCCC

The documentation for this class was generated from the following file:
debug_stream.hpp
Provides seqan3::debug_stream and related types.
std::true_type
seqan3::front_end_second
The penalty configuration for aligning the front of the second sequence with a gap.
Definition: align_config_aligned_ends.hpp:157
align_config_aligned_ends.hpp
Provides seqan3::align_cfg::aligned_ends.
seqan3::end_gaps
Wraps the sequence end-gap specifiers and provides ordered access to the respective values.
Definition: align_config_aligned_ends.hpp:254
std::boolalpha
T boolalpha(T... args)
seqan3::debug_stream
debug_stream_type debug_stream
A global instance of seqan3::debug_stream_type.
Definition: debug_stream.hpp:42
seqan3::front_end_first
The penalty configuration for aligning the front of the first sequence with a gap.
Definition: align_config_aligned_ends.hpp:95