SeqAn3  3.0.1
The Modern C++ library for sequence analysis.
phred42.hpp
Go to the documentation of this file.
1 // -----------------------------------------------------------------------------------------------------
2 // Copyright (c) 2006-2020, Knut Reinert & Freie Universität Berlin
3 // Copyright (c) 2016-2020, 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 
17 // ------------------------------------------------------------------
18 // phred42
19 // ------------------------------------------------------------------
20 
21 namespace seqan3
22 {
23 
43 class phred42 : public quality_base<phred42, 42>
44 {
45 private:
48 
50  friend base_t;
52  friend base_t::base_t;
54 
55 public:
59  constexpr phred42() noexcept = default;
60  constexpr phred42(phred42 const &) noexcept = default;
61  constexpr phred42(phred42 &&) noexcept = default;
62  constexpr phred42 & operator=(phred42 const &) noexcept = default;
63  constexpr phred42 & operator=(phred42 &&) noexcept = default;
64  ~phred42() noexcept = default;
65 
67  constexpr phred42(phred_type const p) : base_t{p} {}
68 
69  // Inherit converting constructor
70  using base_t::base_t;
72 
76  static constexpr phred_type offset_phred{0};
78 
80  static constexpr char_type offset_char{'!'};
82 };
83 
91 constexpr phred42 operator""_phred42(char const c) noexcept
92 {
93  return phred42{}.assign_char(c);
94 }
95 
106 inline std::vector<phred42> operator""_phred42(char const * s, std::size_t n)
107 {
109  r.resize(n);
110 
111  for (size_t i = 0; i < n; ++i)
112  r[i].assign_char(s[i]);
113 
114  return r;
115 }
117 
118 } // namespace seqan3
seqan3::phred42::phred42
constexpr phred42() noexcept=default
Defaulted.
std::vector::resize
T resize(T... args)
std::vector
seqan3::alphabet_base< phred42, size, char >
seqan3::phred42::offset_char
static constexpr char_type offset_char
The projection offset between char and rank score representation.
Definition: phred42.hpp:80
seqan3::quality_base< phred42, 42 >::phred_type
int8_t phred_type
The integer representation of a quality score assignable with =operator.
Definition: quality_base.hpp:35
quality_base.hpp
Provides seqan3::phred42 quality scores.
seqan3::alphabet_base::assign_char
constexpr derived_type & assign_char(char_type const c) noexcept
Assign from a character, implicitly converts invalid characters.
Definition: alphabet_base.hpp:140
seqan3::phred42::operator=
constexpr phred42 & operator=(phred42 const &) noexcept=default
Defaulted.
seqan3
The main SeqAn3 namespace.
Definition: aligned_sequence_concept.hpp:36
seqan3::phred42
Quality type for traditional Sanger and modern Illumina Phred scores (typical range).
Definition: phred42.hpp:43
seqan3::phred42::~phred42
~phred42() noexcept=default
Defaulted.
seqan3::quality_base
A CRTP-base that refines seqan3::alphabet_base and is used by the quality alphabets.
Definition: quality_base.hpp:28
seqan3::phred42::offset_phred
static constexpr phred_type offset_phred
The projection offset between phred and rank score representation.
Definition: phred42.hpp:77
std::size_t
std::conditional_t
seqan3::phred42::phred42
constexpr phred42(phred_type const p)
Construct from phred value.
Definition: phred42.hpp:67