SeqAn3  3.0.2
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:

Classes

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

Typedefs

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.

Introduction

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 seqan3::operator""_dna4;
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)
}
See also
For more details see alphabet_variant, which is the base class and more general than the gapped alphabet.