SeqAn3 3.4.0-rc.1
The Modern C++ library for sequence analysis.
Loading...
Searching...
No Matches
phred42.hpp
Go to the documentation of this file.
1// SPDX-FileCopyrightText: 2006-2024 Knut Reinert & Freie Universität Berlin
2// SPDX-FileCopyrightText: 2016-2024 Knut Reinert & MPI für molekulare Genetik
3// SPDX-License-Identifier: BSD-3-Clause
4
10#pragma once
11
13
14namespace seqan3
15{
16
43class phred42 : public phred_base<phred42, 42>
44{
45private:
48
50 friend base_t;
53 friend base_t::base_t;
55
56public:
60 constexpr phred42() noexcept = default;
61 constexpr phred42(phred42 const &) noexcept = default;
62 constexpr phred42(phred42 &&) noexcept = default;
63 constexpr phred42 & operator=(phred42 const &) noexcept = default;
64 constexpr phred42 & operator=(phred42 &&) noexcept = default;
65 ~phred42() noexcept = default;
66
67 // Inherit converting constructor
68 using base_t::base_t;
70
78 static constexpr phred_type offset_phred{0};
79
84 static constexpr char_type offset_char{'!'};
86};
87
88inline namespace literals
89{
90
104constexpr phred42 operator""_phred42(char const c) noexcept
105{
106 return phred42{}.assign_char(c);
107}
108
120SEQAN3_WORKAROUND_LITERAL std::vector<phred42> operator""_phred42(char const * s, std::size_t n)
121{
123 r.resize(n);
124
125 for (size_t i = 0; i < n; ++i)
126 r[i].assign_char(s[i]);
127
128 return r;
129}
131
132} // namespace literals
133
134} // namespace seqan3
constexpr derived_type & assign_char(char_type const chr) noexcept
Assign from a character, implicitly converts invalid characters.
Definition alphabet_base.hpp:160
Quality type for traditional Sanger and modern Illumina Phred scores.
Definition phred42.hpp:44
constexpr phred42() noexcept=default
Defaulted.
static constexpr phred_type offset_phred
The projection offset between Phred and rank score representation.
Definition phred42.hpp:78
static constexpr char_type offset_char
The projection offset between char and rank score representation.
Definition phred42.hpp:84
A CRTP-base that refines seqan3::alphabet_base and is used by the quality alphabets.
Definition phred_base.hpp:30
int8_t phred_type
The integer representation of the quality score.
Definition phred_base.hpp:39
The main SeqAn3 namespace.
Definition aligned_sequence_concept.hpp:26
Provides seqan3::phred42 quality scores.
#define SEQAN3_WORKAROUND_LITERAL
Our char literals returning std::vector should be constexpr if constexpr std::vector is supported.
Definition platform.hpp:269
T resize(T... args)
Hide me