SeqAn3
seqan3::quality_base< derived_type, size > Class Template Reference

A CRTP-base that refines seqan3::alphabet_base and is used by the quality alphabets. More...

#include <seqan3/alphabet/quality/quality_base.hpp>

Inheritance diagram for seqan3::quality_base< derived_type, size >:
[legend]

Public Types

using char_type = char_t
 The type of the alphabet when converted to char (e.g. via to_char()).
 
using rank_type = detail::min_viable_uint_t< size - 1 >
 The type of the alphabet when represented as a number (e.g. via to_rank()).
 
Member types
using phred_type = int8_t
 The integer representation of a quality score assignable with =operator.
 

Public Member Functions

Read functions
constexpr char_type to_char () const noexcept
 Return the letter as a character of char_type. More...
 
constexpr phred_type to_phred () const noexcept
 Return the alphabet's value in phred representation.
 
Write functions
constexpr derived_type & assign_phred (phred_type const p) noexcept
 Assign from the numeric phred value. More...
 
Read functions
constexpr rank_type to_rank () const noexcept
 Return the letter's numeric value (rank in the alphabet). More...
 
Write functions
constexpr derived_type & assign_char (std::conditional_t< std::Same< char_type, void >, char, char_type > const c) noexcept
 Assign from a character. More...
 
constexpr derived_type & assign_rank (rank_type const c) noexcept
 Assign from a numeric value. More...
 

Static Public Attributes

static detail::min_viable_uint_t< size > constexpr value_size
 The size of the alphabet, i.e. the number of different values it can take.
 

Static Protected Attributes

static std::array< rank_type, 256 > constexpr char_to_rank
 Char to rank conversion table. More...
 
static std::array< rank_type, 256 > constexpr phred_to_rank
 Phred to rank conversion table. More...
 

Constructors, destructor and assignment

template<typename other_qual_type >
constexpr quality_base (other_qual_type const &other) noexcept
 Allow explicit construction from any other quality type by means of the phred representation.
 

Detailed Description

template<typename derived_type, auto size>
class seqan3::quality_base< derived_type, size >

A CRTP-base that refines seqan3::alphabet_base and is used by the quality alphabets.

Template Parameters
derived_typeThe CRTP parameter type.
sizeThe size of the alphabet.

Member Function Documentation

◆ assign_char()

constexpr derived_type& seqan3::alphabet_base< derived_type, size, char >::assign_char ( std::conditional_t< std::Same< char_type, void >, char, char_type > const  c)
inlinenoexceptinherited

Assign from a character.

Satisfies the seqan3::alphabet_concept::assign_char() requirement via the seqan3::assign_char() wrapper.

Complexity

Constant.

Exceptions

Guaranteed not to throw.

◆ assign_phred()

template<typename derived_type, auto size>
constexpr derived_type& seqan3::quality_base< derived_type, size >::assign_phred ( phred_type const  p)
inlinenoexcept

Assign from the numeric phred value.

Satisfies the seqan3::quality_concept::assign_phred() requirement via the seqan3::assign_rank() wrapper.

Complexity

Constant.

◆ assign_rank()

constexpr derived_type& seqan3::alphabet_base< derived_type, size, char >::assign_rank ( rank_type const  c)
inlinenoexceptinherited

Assign from a numeric value.

Satisfies the seqan3::semi_alphabet_concept::assign_rank() requirement via the seqan3::assign_rank() wrapper.

Complexity

Constant.

Exceptions

Guaranteed not to throw.

◆ to_char()

template<typename derived_type, auto size>
constexpr char_type seqan3::quality_base< derived_type, size >::to_char ( ) const
inlinenoexcept

Return the letter as a character of char_type.

Satisfies the seqan3::alphabet_concept::to_char() requirement via the seqan3::to_char() wrapper.

Complexity

Constant.

Exceptions

Guaranteed not to throw.

◆ to_rank()

constexpr rank_type seqan3::alphabet_base< derived_type, size, char >::to_rank ( ) const
inlinenoexceptinherited

Return the letter's numeric value (rank in the alphabet).

Satisfies the seqan3::semi_alphabet_concept::to_rank() requirement via the to_rank() wrapper.

Complexity

Constant.

Exceptions

Guaranteed not to throw.

Member Data Documentation

◆ char_to_rank

template<typename derived_type, auto size>
std::array<rank_type, 256> constexpr seqan3::quality_base< derived_type, size >::char_to_rank
staticprotected
Initial value:
{
[] () constexpr
{
std::array<rank_type, 256> ret{};
for (int64_t i = std::numeric_limits<char_type>::lowest(); i <= std::numeric_limits<char_type>::max(); ++i)
{
if (i < derived_type::offset_char)
ret[static_cast<rank_type>(i)] = 0;
else if (i >= derived_type::offset_char + value_size)
ret[static_cast<rank_type>(i)] = value_size - 1;
else
ret[static_cast<rank_type>(i)] = i - derived_type::offset_char;
}
return ret;
}()
}

Char to rank conversion table.

◆ phred_to_rank

template<typename derived_type, auto size>
std::array<rank_type, 256> constexpr seqan3::quality_base< derived_type, size >::phred_to_rank
staticprotected
Initial value:
{
[] () constexpr
{
std::array<rank_type, 256> ret{};
for (int64_t i = std::numeric_limits<phred_type>::lowest(); i <= std::numeric_limits<phred_type>::max(); ++i)
{
if (i < derived_type::offset_phred)
ret[static_cast<rank_type>(i)] = 0;
else if (i >= derived_type::offset_phred + value_size)
ret[static_cast<rank_type>(i)] = value_size - 1;
else
ret[static_cast<rank_type>(i)] = i - derived_type::offset_phred;
}
return ret;
}()
}

Phred to rank conversion table.


The documentation for this class was generated from the following file: