BioC++ core-0.7.0
The Modern C++ libraries for Bioinformatics.
 
Loading...
Searching...
No Matches

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

+ Collaboration diagram for Gap:

Classes

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

Typedefs

template<typename alphabet_t >
using bio::alphabet::gapped = 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.

Introduction

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

The main purpose of bio::alphabet::gap is to be combined with other alphabets. This can easily be achieved by using the bio::alphabet::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 bio::alphabet::gapped = typedef variant<alphabet_t, gap>

Extends a given alphabet with a gap character.

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

The gapped alphabet represents the variant of a given alphabet and the bio::alphabet::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 bio::alphabet::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 bio::alphabet::gap::assign_char().

int main()
{
using namespace bio::alphabet::literals;
bio::alphabet::gapped<bio::alphabet::dna4> converted_letter{'C'_dna4};
bio::alphabet::gapped<bio::alphabet::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 c) noexcept
Assign from a character, implicitly converts invalid characters.
Definition: base.hpp:145
The alphabet of a gap character '-'.
Definition: gap.hpp:38
A combined alphabet that can hold values of either of its alternatives..
Definition: variant.hpp:104
Provides bio::alphabet::dna4, container aliases and string literals.
Provides bio::alphabet::gapped.
An inline namespace for alphabet literals. It exists to safely allow using namespace.
Definition: aa10li.hpp:183
See also
For more details see variant, which is the base class and more general than the gapped alphabet.