SeqAn3  3.0.3
The Modern C++ library for sequence analysis.

Provides the gap alphabet and functionality to make an alphabet a gapped alphabet. More...

+ Collaboration diagram for Gap:


class  seqan3::gap
 The alphabet of a gap character '-'. More...


template<typename alphabet_t >
using seqan3::gapped = alphabet_variant< alphabet_t, gap >
 Extends a given alphabet with a gap character. More...

Detailed Description

Provides the gap alphabet and functionality to make an alphabet a gapped alphabet.


The gap symbol (-) is used in alignments to represent an interruption in an alignment, usually the result of an insertion or deletion. The seqan3::gap alphabet represents this (single) gap symbol and satisfies the seqan3::alphabet.

The main purpose of seqan3::gap is to be combined with other alphabets. This can easily be achieved by using the seqan3::gapped<> template which transforms any other alphabet to be a composite of that alphabet + the gap character.

Typedef Documentation

◆ gapped

template<typename alphabet_t >
using seqan3::gapped = typedef alphabet_variant<alphabet_t, gap>

Extends a given alphabet with a gap character.

Template Parameters
alphabet_tType of the letter, e.g. dna4; must satisfy seqan3::writable_alphabet.

The gapped alphabet represents the variant of a given alphabet and the seqan3::gap alphabet (e.g. the four letter DNA alphabet + a gap character).

The gapped alphabet may be brace initialized from the static letter members of the underlying alphabet and the seqan3::gap alphabet. Note that you cannot assign the alphabet by using letters of type char, but you instead have to use the function assign_char() of the underlying alphabet or seqan3::gap::assign_char().

int main()
using namespace seqan3::literals;
seqan3::gapped<seqan3::dna4> converted_letter{'C'_dna4};
seqan3::gapped<seqan3::dna4>{}.assign_char('-'); // gap character
seqan3::gapped<seqan3::dna4>{}.assign_char('K'); // unknown characters map to the default/unknown
// character of the given alphabet type (i.e. A of dna4)
constexpr derived_type & assign_char(char_type const chr) noexcept
Assign from a character, implicitly converts invalid characters.
Definition: alphabet_base.hpp:211
A combined alphabet that can hold values of either of its alternatives.
Definition: alphabet_variant.hpp:131
The alphabet of a gap character '-'.
Definition: gap.hpp:39
Provides seqan3::dna4, container aliases and string literals.
Provides seqan3::gapped.
The SeqAn namespace for literals.
See also
For more details see alphabet_variant, which is the base class and more general than the gapped alphabet.

This entity is stable. Since version 3.1.