17#include <bio/alphabet/detail/convert.hpp>
28template <
typename derived_type, auto size>
73 template <meta::different_from<derived_type> other_qual_type>
75 explicit constexpr quality_base(other_qual_type
const & other)
noexcept
117 if (i < derived_type::offset_phred)
119 else if (i >= derived_type::offset_phred +
123 ret[
static_cast<rank_type>(i)] = i - derived_type::offset_phred;
136 if (i < derived_type::offset_char)
138 else if (i >= derived_type::offset_char +
142 ret[
static_cast<rank_type>(i)] = i - derived_type::offset_char;
154 ret[i] = i + derived_type::offset_phred;
165 ret[i] = i + derived_type::offset_char;
173 return alph.to_phred();
179 derived_type & alph)
noexcept
181 return alph.assign_phred(p);
Quality alphabet concept.
Provides bio::alphabet::base.
A CRTP-base that makes defining a custom alphabet easier.
Definition: base.hpp:55
constexpr derived_type & assign_rank(rank_type const c) noexcept
Assign from a numeric value.
Definition: base.hpp:168
static constexpr size_t alphabet_size
The size of the alphabet, i.e. the number of different values it can take.
Definition: base.hpp:177
meta::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: base.hpp:65
std::conditional_t< std::same_as< char, void >, char, char > char_type
The char representation; conditional needed to make semi alphabet definitions legal.
Definition: base.hpp:63
constexpr rank_type to_rank() const noexcept
Return the letter's numeric value (rank in the alphabet).
Definition: base.hpp:124
A CRTP-base that refines bio::alphabet::base and is used by the quality alphabets.
Definition: quality_base.hpp:30
int8_t phred_type
The integer representation of a quality score assignable with =operator.
Definition: quality_base.hpp:36
friend constexpr phred_type tag_invoke(custom::to_phred, derived_type const alph) noexcept
tag_invoke() wrapper around member.
Definition: quality_base.hpp:171
static constexpr std::array< rank_type, 256 > char_to_rank
Char to rank conversion table.
Definition: quality_base.hpp:129
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:75
static constexpr std::array< char_type, alphabet_size > rank_to_char
Rank to char conversion table.
Definition: quality_base.hpp:160
static constexpr std::array< phred_type, alphabet_size > rank_to_phred
Rank to phred conversion table.
Definition: quality_base.hpp:149
static constexpr std::array< rank_type, 256 > phred_to_rank
Phred to rank conversion table.
Definition: quality_base.hpp:110
constexpr derived_type & assign_phred(phred_type const p) noexcept
Assign from the numeric phred value.
Definition: quality_base.hpp:102
friend constexpr derived_type & tag_invoke(custom::assign_phred_to, phred_type const p, derived_type &alph) noexcept
tag_invoke() wrapper around member.
Definition: quality_base.hpp:177
constexpr phred_type to_phred() const noexcept
Return the alphabet's value in phred representation.
Definition: quality_base.hpp:85
A concept that indicates whether an alphabet represents quality scores.
Definition: concept.hpp:171
constexpr auto assign_phred_to
Assign a phred score to a quality alphabet object.
Definition: concept.hpp:128
constexpr auto to_phred
The public getter function for the phred representation of a quality score.
Definition: concept.hpp:65
The alphabet module's namespace.
Definition: aa10li.hpp:23
Customisation tag for bio::alphabet::assign_char_to.
Definition: tag.hpp:57
Customisation tag for bio::alphabet::assign_char_to.
Definition: tag.hpp:53