SeqAn3 3.1.0
The Modern C++ library for sequence analysis.
phred63.hpp
Go to the documentation of this file.
1// -----------------------------------------------------------------------------------------------------
2// Copyright (c) 2006-2021, Knut Reinert & Freie Universität Berlin
3// Copyright (c) 2016-2021, 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 phred63 : public phred_base<phred63, 63>
47{
48private:
51
53 friend base_t;
55 friend base_t::base_t;
57
58public:
62 constexpr phred63() noexcept = default;
63 constexpr phred63(phred63 const &) noexcept = default;
64 constexpr phred63(phred63 &&) noexcept = default;
65 constexpr phred63 & operator=(phred63 const &) noexcept = default;
66 constexpr phred63 & operator=(phred63 &&) noexcept = default;
67 ~phred63() noexcept = default;
68
69 // Inherit converting constructor
70 using base_t::base_t;
72
80 static constexpr phred_type offset_phred{0};
81
86 static constexpr char_type offset_char{'!'};
88};
89
90inline namespace literals
91{
92
106constexpr phred63 operator""_phred63(char const c) noexcept
107{
108 return phred63{}.assign_char(c);
109}
110
122inline std::vector<phred63> operator""_phred63(char const * s, std::size_t n)
123{
125 r.resize(n);
126
127 for (size_t i = 0; i < n; ++i)
128 r[i].assign_char(s[i]);
129
130 return r;
131}
133
134} // inline namespace literals
135
136} // namespace seqan3
A CRTP-base that makes defining a custom alphabet easier.
Definition: alphabet_base.hpp:57
constexpr derived_type & assign_char(char_type const chr) noexcept
Assign from a character, implicitly converts invalid characters.
Definition: alphabet_base.hpp:165
Quality type for traditional Sanger and modern Illumina Phred scores..
Definition: phred63.hpp:47
static constexpr char_type offset_char
The projection offset between char and rank score representation.
Definition: phred63.hpp:86
static constexpr phred_type offset_phred
The projection offset between Phred and rank score representation.
Definition: phred63.hpp:80
constexpr phred63() noexcept=default
Defaulted.
A CRTP-base that refines seqan3::alphabet_base and is used by the quality alphabets.
Definition: phred_base.hpp:31
int8_t phred_type
The integer representation of the quality score.
Definition: phred_base.hpp:40
The main SeqAn3 namespace.
Definition: cigar_operation_table.hpp:2
Provides seqan3::phred42 quality scores.
T resize(T... args)