SeqAn3 3.3.0-rc.1
The Modern C++ library for sequence analysis.
phred42.hpp
Go to the documentation of this file.
1// -----------------------------------------------------------------------------------------------------
2// Copyright (c) 2006-2022, Knut Reinert & Freie Universität Berlin
3// Copyright (c) 2016-2022, Knut Reinert & MPI für molekulare Genetik
4// This file may be used, modified and/or redistributed under the terms of the 3-clause BSD-License
5// shipped with this file and also available at: https://github.com/seqan/seqan3/blob/master/LICENSE.md
6// -----------------------------------------------------------------------------------------------------
7
13#pragma once
14
16
17namespace seqan3
18{
19
46class phred42 : public phred_base<phred42, 42>
47{
48private:
51
53 friend base_t;
56 friend base_t::base_t;
58
59public:
63 constexpr phred42() noexcept = default;
64 constexpr phred42(phred42 const &) noexcept = default;
65 constexpr phred42(phred42 &&) noexcept = default;
66 constexpr phred42 & operator=(phred42 const &) noexcept = default;
67 constexpr phred42 & operator=(phred42 &&) noexcept = default;
68 ~phred42() noexcept = default;
69
70 // Inherit converting constructor
71 using base_t::base_t;
73
81 static constexpr phred_type offset_phred{0};
82
87 static constexpr char_type offset_char{'!'};
89};
90
91inline namespace literals
92{
93
107constexpr phred42 operator""_phred42(char const c) noexcept
108{
109 return phred42{}.assign_char(c);
110}
111
123SEQAN3_WORKAROUND_LITERAL std::vector<phred42> operator""_phred42(char const * s, std::size_t n)
124{
126 r.resize(n);
127
128 for (size_t i = 0; i < n; ++i)
129 r[i].assign_char(s[i]);
130
131 return r;
132}
134
135} // namespace literals
136
137} // namespace seqan3
constexpr derived_type & assign_char(char_type const chr) noexcept
Assign from a character, implicitly converts invalid characters.
Definition: alphabet_base.hpp:163
Quality type for traditional Sanger and modern Illumina Phred scores..
Definition: phred42.hpp:47
friend base_t
Befriend seqan3::phred_base.
Definition: phred42.hpp:53
constexpr phred42() noexcept=default
Defaulted.
static constexpr phred_type offset_phred
The projection offset between Phred and rank score representation.
Definition: phred42.hpp:81
static constexpr char_type offset_char
The projection offset between char and rank score representation.
Definition: phred42.hpp:87
A CRTP-base that refines seqan3::alphabet_base and is used by the quality alphabets.
Definition: phred_base.hpp:31
alphabet_base< phred42, size, char > base_t
The base type.
Definition: phred_base.hpp:45
int8_t phred_type
The integer representation of the quality score.
Definition: phred_base.hpp:40
The main SeqAn3 namespace.
Definition: aligned_sequence_concept.hpp:29
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:248
T resize(T... args)