BioC++ core-0.7.0
The Modern C++ libraries for Bioinformatics.
 
Loading...
Searching...
No Matches
phred68legacy.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// phred68legacy
20// ------------------------------------------------------------------
21
22namespace bio::alphabet
23{
24
42class phred68legacy : public quality_base<phred68legacy, 68>
43{
44private:
47
49 friend base_t;
51 friend base_t::base_t;
53
54public:
58 constexpr phred68legacy() noexcept = default;
59 constexpr phred68legacy(phred68legacy const &) noexcept = default;
60 constexpr phred68legacy(phred68legacy &&) noexcept = default;
61 constexpr phred68legacy & operator=(phred68legacy const &) noexcept = default;
62 constexpr phred68legacy & operator=(phred68legacy &&) noexcept = default;
63 ~phred68legacy() noexcept = default;
64
66 constexpr phred68legacy(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{-5};
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 phred68legacy operator""_phred68legacy(char const c)
104{
105 if (!char_is_valid_for<phred68legacy>(c))
106 throw std::invalid_argument{"Illegal character in character literal."};
107
108 return phred68legacy{}.assign_char(c);
109}
110
120template <meta::detail::literal_buffer_string str>
121constexpr std::vector<phred68legacy> operator""_phred68legacy()
122{
123 return detail::string_literal<str, phred68legacy>();
124}
126
127} // namespace literals
128
129} // 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 Solexa and deprecated Illumina formats..
Definition: phred68legacy.hpp:43
static constexpr phred_type offset_phred
The projection offset between phred and rank score representation.
Definition: phred68legacy.hpp:76
static constexpr char_type offset_char
The projection offset between char and rank score representation.
Definition: phred68legacy.hpp:79
constexpr phred68legacy() noexcept=default
Defaulted.
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.