43 #include <seqan3/alphabet/detail/convert.hpp> 54 template <
typename derived_type, auto size>
73 constexpr quality_base(quality_base
const &) =
default;
74 constexpr quality_base(quality_base &&) =
default;
75 constexpr quality_base & operator=(quality_base
const &) =
default;
76 constexpr quality_base & operator=(quality_base &&) =
default;
77 ~quality_base() =
default;
80 constexpr quality_base(
phred_type const p) noexcept
102 template <
typename other_qual_type>
108 explicit constexpr
quality_base(other_qual_type
const & other) noexcept
158 std::array<rank_type, 256> ret{};
160 for (int64_t i = std::numeric_limits<phred_type>::lowest(); i <= std::numeric_limits<phred_type>::max(); ++i)
162 if (i < derived_type::offset_phred)
164 else if (i >= derived_type::offset_phred +
value_size)
167 ret[
static_cast<rank_type>(i)] = i - derived_type::offset_phred;
174 static std::array<rank_type, 256> constexpr
char_to_rank 178 std::array<rank_type, 256> ret{};
180 for (int64_t i = std::numeric_limits<char_type>::lowest(); i <= std::numeric_limits<char_type>::max(); ++i)
182 if (i < derived_type::offset_char)
184 else if (i >= derived_type::offset_char +
value_size)
187 ret[
static_cast<rank_type>(i)] = i - derived_type::offset_char;
static std::array< rank_type, 256 > constexpr phred_to_rank
Phred to rank conversion table.
Definition: quality_base.hpp:155
detail::min_viable_uint_t< size - 1 > rank_type
The type of the alphabet when represented as a number (e.g. via to_rank()).
Definition: alphabet_base.hpp:89
char char_type
The type of the alphabet when converted to char (e.g. via to_char()).
Definition: alphabet_base.hpp:87
constexpr char_type to_char() const noexcept
Return the letter as a character of char_type.
Definition: quality_base.hpp:120
constexpr derived_type & assign_phred(phred_type const p) noexcept
Assign from the numeric phred value.
Definition: quality_base.hpp:146
constexpr underlying_phred_t< alphabet_type > to_phred(alphabet_type const &chr)
The public getter function for the phred representation of a score.
Definition: concept.hpp:127
constexpr alphabet_type & assign_phred(alphabet_type &chr, char const in)
The public setter function of a phred score.
Definition: concept.hpp:102
int8_t phred_type
The integer representation of a quality score assignable with =operator.
Definition: quality_base.hpp:62
The main SeqAn3 namespace.
Definition: aligned_sequence_concept.hpp:58
static std::array< rank_type, 256 > constexpr char_to_rank
Char to rank conversion table.
Definition: quality_base.hpp:175
A CRTP-base that refines seqan3::alphabet_base and is used by the quality alphabets.
Definition: quality_base.hpp:55
A concept that indicates whether an alphabet represents quality scores.In addition to the requirement...
constexpr phred_type to_phred() const noexcept
Return the alphabet's value in phred representation.
Definition: quality_base.hpp:126
constexpr derived_type & assign_rank(rank_type const c) noexcept
Assign from a numeric value.
Definition: alphabet_base.hpp:189
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.
Definition: alphabet_base.hpp:198
constexpr quality_base(other_qual_type const &other) noexcept
Allow explicit construction from any other quality type by means of the phred representation.
Definition: quality_base.hpp:108
Provides seqan3::alphabet_base.
The concept std::Same<T, U> is satisfied if and only if T and U denote the same type.
constexpr rank_type to_rank() const noexcept
Return the letter's numeric value (rank in the alphabet).
Definition: alphabet_base.hpp:142
A CRTP-base that makes defining a custom alphabet easier.
Definition: alphabet_base.hpp:77
Quality alphabet concept.