Aminoacid

Contains seqan3::aa27, container aliases and string literals.

Author
Sara Hetzel <sara.hetzel AT fu-berlin.de>

namespace seqan3

The main SeqAn3 namespace.

Helpers for seqan3::semi_alphabet_concept

These functions and metafunctions expose member variables and types so that they satisfy seqan3::semi_alphabet_concept.

Helpers for seqan3::alphabet_concept

These functions and metafunctions expose member variables and types so that they satisfy seqan3::alphabet_concept.

Helpers for seqan3::nucleotide_concept

These functions and metafunctions expose member variables and types so that they satisfy seqan3::nucleotide_concept.

Alphabet aliases

Other names (typedefs) for seqan3::nucl16

Range concepts

Adapted from the Ranges TS.

Container concepts

Container concepts as defined by the standard library (or very close).

Container-of-container concepts

Shortcuts for multi-dimensional container concepts.

struct aa27
#include <alphabet/aminoacid/aa27.hpp>

The twenty-seven letter amino acid alphabet.

The alphabet consists of letters A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T, U, V, W, X, Y, Z, *

The alphabet may be brace initialized from the static letter members (see above). Note that you cannot assign regular characters, but additional functions for this are available.

aa27 my_letter{aa27::A};
// doesn't work:
// aa27 my_letter{'A'};

my_letter.assign_char('C'); // <- this does!

my_letter.assign_char('?'); // converted to X internally
if (my_letter.to_char() == 'X')
   std::cout << "yeah\n"; // "yeah";

Inherits from seqan3::alphabet_concept

Letter values

Static member “letters” that can be assigned to the alphabet or used in aggregate initialization.

Similar to an Enum interface . Don’t worry about the .

constexpr aa27 A = {internal_type::A}
constexpr aa27 B = {internal_type::B}
constexpr aa27 C = {internal_type::C}
constexpr aa27 D = {internal_type::D}
constexpr aa27 E = {internal_type::E}
constexpr aa27 F = {internal_type::F}
constexpr aa27 G = {internal_type::G}
constexpr aa27 H = {internal_type::H}
constexpr aa27 I = {internal_type::I}
constexpr aa27 J = {internal_type::J}
constexpr aa27 K = {internal_type::K}
constexpr aa27 L = {internal_type::L}
constexpr aa27 M = {internal_type::M}
constexpr aa27 N = {internal_type::N}
constexpr aa27 O = {internal_type::O}
constexpr aa27 P = {internal_type::P}
constexpr aa27 Q = {internal_type::Q}
constexpr aa27 R = {internal_type::R}
constexpr aa27 S = {internal_type::S}
constexpr aa27 T = {internal_type::T}
constexpr aa27 U = {internal_type::U}
constexpr aa27 V = {internal_type::V}
constexpr aa27 W = {internal_type::W}
constexpr aa27 X = {internal_type::X}
constexpr aa27 Y = {internal_type::Y}
constexpr aa27 Z = {internal_type::Z}
constexpr aa27 TERMINATOR = {internal_type::TERMINATOR}
constexpr aa27 UNKNOWN = {aa27::X}

Read functions

constexpr char_type to_char() const

Return the letter as a character of char_type.

constexpr rank_type to_rank() const

Return the letter’s numeric value or rank in the alphabet.

Write functions

constexpr aa27 &assign_char(char_type const c)

Assign from a character.

constexpr aa27 &assign_rank(rank_type const c)

Assign from a numeric value.

Comparison operators

constexpr bool operator==(aa27 const &rhs) const
constexpr bool operator!=(aa27 const &rhs) const
constexpr bool operator<(aa27 const &rhs) const
constexpr bool operator>(aa27 const &rhs) const
constexpr bool operator<=(aa27 const &rhs) const
constexpr bool operator>=(aa27 const &rhs) const

Requirements for seqan3::semi_alphabet_concept

You can expect these functions on all types that implement seqan3::semi_alphabet_concept.

Requirements for seqan3::alphabet_concept

You can expect these functions on all types that implement seqan3::alphabet_concept.

Public Types

using char_type = char

The type of the alphabet when converted to char (e.g. via to_char()).

using rank_type = uint8_t

The type of the alphabet when represented as a number (e.g. via to_rank()).

Public Static Attributes

constexpr rank_type value_size = {27}

The size of the alphabet, i.e. the number of different values it can take.

Private Types

enum internal_type

The internal type is a strictly typed enum.

This is done to prevent aggregate initialization from numbers and/or chars. It is has the drawback that it also introduces a scope which in turn makes the static “letter values ” members necessary.

Values:

A
B
C
D
E
F
G
H
I
J
K
L
M
N
O
P
Q
R
S
T
U
V
W
X
Y
Z
TERMINATOR
UNKNOWN = X

Private Members

internal_type _value

The data member.

Private Static Attributes

constexpr char_type value_to_char[value_size] = { 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', '*' }

Value to char conversion table.

constexpr std::array<internal_type, 256> char_to_value

Char to value conversion table.

Related

using aa27_vector = std::vector<aa27>

Alias for an std::vector of seqan3::aa27.

using aa27_string = std::basic_string<aa27, std::char_traits<aa27>>

Alias for an std::basic_string of seqan3::aa27.

Attention
Note that we recommend using seqan3::aa27_vector instead of aa27_string in almost all situations. While the C++ style operations on the string are well supported, you should not access the internal c-string and should not use C-Style operations on it, e.g. the char_traits::strlen function will not return the correct length of the string (while the .size() returns the correct value).

aa27_vector operator""_aa27(const char *s, std::size_t n)

aa27 literal

You can use this string literal to easily assign to aa27_vector:

Return
seqan3::aa27_vector

// these don't work:
// aa27_vector foo{"ABFUYR"};
// aa27_vector bar = "ABFUYR";

// but these do:
using namespace seqan3::literal;
aa27_vector foo{"ABFUYR"_aa27};
aa27_vector bar = "ABFUYR"_aa27;
auto bax = "ABFUYR"_aa27;

Attention
All seqan3 literals are in the namespace seqan3::literal!

aa27_string operator""_aa27s(const char *s, std::size_t n)

aa27 string literal

You can use this string literal to easily assign to aa27_vector:

Return
seqan3::aa27_string

// these don't work:
// aa27_string foo{"ABFUYR"};
// aa27_string bar = "ABFUYR";

// but these do:
using namespace seqan3::literal;
aa27_string foo{"ABFUYR"_aa27s};
aa27_string bar = "ABFUYR"_aa27s;
auto bax = "ABFUYR"_aa27s;

Please note the limitations of seqan3::aa27_string and consider using the operator”“_aa27 instead.

Attention
All seqan3 literals are in the namespace seqan3::literal!

namespace literal

The SeqAn3 namespace for literals.

SeqAn implements “user defined” literals in multiple places, e.g. auto foo = "ACGTG"_dna4. These make working with small examples and tests a lot easier, but the risk of having a name collision with another library is higher so follow the example of the standard library and define all our literals in the namespace seqan3::literal.

Attention
This means you cannot use them, unless you explicitly add using namespace seqan3::literal; (in addition to using namespace seqan3;).