BioC++ core-0.7.0
The Modern C++ libraries for Bioinformatics.
 
Loading...
Searching...
No Matches
phred63.hpp
Go to the documentation of this file.
1// -----------------------------------------------------------------------------------------------------
2// Copyright (c) 2022 deCODE Genetics
3// Copyright (c) 2006-2020, Knut Reinert & Freie Universität Berlin
4// Copyright (c) 2016-2020, Knut Reinert & MPI für molekulare Genetik
5// This file may be used, modified and/or redistributed under the terms of the 3-clause BSD-License
6// shipped with this file and also available at: https://github.com/biocpp/biocpp-core/blob/main/LICENSE.md
7// -----------------------------------------------------------------------------------------------------
8
14#pragma once
15
17
18// ------------------------------------------------------------------
19// phred63
20// ------------------------------------------------------------------
21
22namespace bio::alphabet
23{
24
42class phred63 : public quality_base<phred63, 63>
43{
44private:
47
49 friend base_t;
51 friend base_t::base_t;
53
54public:
58 constexpr phred63() noexcept = default;
59 constexpr phred63(phred63 const &) noexcept = default;
60 constexpr phred63(phred63 &&) noexcept = default;
61 constexpr phred63 & operator=(phred63 const &) noexcept = default;
62 constexpr phred63 & operator=(phred63 &&) noexcept = default;
63 ~phred63() noexcept = default;
64
66 constexpr phred63(phred_type const p) : base_t{p} {}
67
68 // Inherit converting constructor
69 using base_t::base_t;
71
76 static constexpr phred_type offset_phred{0};
77
79 static constexpr char_type offset_char{'!'};
81};
82
83} // namespace bio::alphabet
84
85// ------------------------------------------------------------------
86// literals
87// ------------------------------------------------------------------
88
89namespace bio::alphabet
90{
91
92inline namespace literals
93{
94
103consteval phred63 operator""_phred63(char const c)
104{
105 if (!char_is_valid_for<phred63>(c))
106 throw std::invalid_argument{"Illegal character in character literal."};
107
108 return phred63{}.assign_char(c);
109}
110
120template <meta::detail::literal_buffer_string str>
121constexpr std::vector<phred63> operator""_phred63()
122{
123 return detail::string_literal<str, phred63>();
124}
126
127} // namespace literals
128} // namespace bio::alphabet
constexpr derived_type & assign_char(char_type const c) noexcept
Assign from a character, implicitly converts invalid characters.
Definition: base.hpp:145
Quality type for traditional Sanger and modern Illumina Phred scores (full range)....
Definition: phred63.hpp:43
static constexpr char_type offset_char
The projection offset between char and rank score representation.
Definition: phred63.hpp:79
constexpr phred63() noexcept=default
Defaulted.
static constexpr phred_type offset_phred
The projection offset between phred and rank score representation.
Definition: phred63.hpp:76
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
The alphabet module's namespace.
Definition: aa10li.hpp:23
Provides bio::alphabet::phred42 quality scores.