Loading...
Searching...
No Matches
Gap
Alphabet

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.

## Detailed Description

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

See also
  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 = alphabet_variant<alphabet_t, gap>

Extends a given alphabet with a gap character.

Template Parameters

  alphabet_t | Type 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().

// SPDX-FileCopyrightText: 2006-2025 Knut Reinert & Freie Universität Berlin
// SPDX-FileCopyrightText: 2016-2025 Knut Reinert & MPI für molekulare Genetik
// SPDX-License-Identifier: CC0-1.0
#include <seqan3/alphabet/gap/gapped.hpp>
#include <seqan3/alphabet/nucleotide/dna4.hpp>
int main()
{
using namespace seqan3::literals;
seqan3::gapped<seqan3::dna4> gapped_letter{};
seqan3::gapped<seqan3::dna4> converted_letter{'C'_dna4};
seqan3::gapped<seqan3::dna4> gap_letter{seqan3::gap{}};
seqan3::gapped<seqan3::dna4>{}.assign_char('C');
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)
}
seqan3::gap
The alphabet of a gap character '-'.
Definition gap.hpp:36
dna4.hpp
Provides seqan3::dna4, container aliases and string literals.
gapped.hpp
Provides seqan3::gapped.
seqan3::gapped
alphabet_variant< alphabet_t, gap > gapped
Extends a given alphabet with a gap character.
Definition gapped.hpp:38
seqan3::literals
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.

Hide me