SeqAn3
3.4.0
The Modern C++ library for sequence analysis.
Toggle main menu visibility
Loading...
Searching...
No Matches
dssp9.hpp
Go to the documentation of this file.
1
// SPDX-FileCopyrightText: 2006-2025 Knut Reinert & Freie Universität Berlin
2
// SPDX-FileCopyrightText: 2016-2025 Knut Reinert & MPI für molekulare Genetik
3
// SPDX-License-Identifier: BSD-3-Clause
4
9
10
#pragma once
11
12
#include <
vector
>
13
14
#include <
seqan3/alphabet/alphabet_base.hpp
>
15
#include <
seqan3/alphabet/concept.hpp
>
16
#include <
seqan3/utility/char_operations/transform.hpp
>
17
18
// ------------------------------------------------------------------
19
// dssp9
20
// ------------------------------------------------------------------
21
22
namespace
seqan3
23
{
24
58
class
dssp9
:
public
alphabet_base
<dssp9, 9>
59
{
60
private
:
62
using
base_t =
alphabet_base<dssp9, 9>
;
63
65
friend
base_t;
66
67
public
:
71
constexpr
dssp9
() noexcept = default;
72
constexpr
dssp9
(
dssp9
const &) noexcept = default;
73
constexpr
dssp9
(
dssp9
&&) noexcept = default;
74
constexpr
dssp9
& operator=(
dssp9
const &) noexcept = default;
75
constexpr
dssp9
& operator=(
dssp9
&&) noexcept = default;
76
~
dssp9
() noexcept = default;
77
79
80
private:
82
static constexpr
char_type
rank_to_char_table[
alphabet_size
]{
'H'
,
'B'
,
'E'
,
'G'
,
'I'
,
'T'
,
'S'
,
'C'
,
'X'
};
83
85
static
constexpr
char_type
rank_to_char(
rank_type
const
rank)
86
{
87
return
rank_to_char_table[rank];
88
}
89
91
static
constexpr
rank_type
char_to_rank(
char_type
const
chr)
92
{
93
using
index_t =
std::make_unsigned_t<char_type>
;
94
return
char_to_rank_table[
static_cast<
index_t
>
(chr)];
95
}
96
98
static
constexpr
std::array<rank_type, 256> char_to_rank_table{
99
[]()
constexpr
100
{
101
std::array<rank_type, 256> ret{};
102
103
ret.
fill
(8u);
104
105
// reverse mapping for characters
106
for
(
rank_type
rnk = 0u; rnk <
alphabet_size
; ++rnk)
107
ret[
static_cast<
rank_type
>
(rank_to_char_table[rnk])] = rnk;
108
109
return
ret;
110
}()};
111
};
112
113
inline
namespace
literals
114
{
115
129
constexpr
dssp9
operator
""
_dssp9(
char
const
ch)
noexcept
130
{
131
return
dssp9
{}.assign_char(ch);
132
}
133
145
SEQAN3_WORKAROUND_LITERAL
std::vector<dssp9>
operator
""
_dssp9(
char
const
* str,
std::size_t
len)
146
{
147
std::vector<dssp9>
vec;
148
vec.
resize
(len);
149
150
for
(
size_t
idx = 0u; idx < len; ++idx)
151
vec[idx].
assign_char
(str[idx]);
152
153
return
vec;
154
}
155
156
157
}
// namespace literals
158
159
}
// namespace seqan3
concept.hpp
Core alphabet concept and free function/type trait wrappers.
alphabet_base.hpp
Provides seqan3::alphabet_base.
seqan3::alphabet_base< dssp9, 9 >::assign_char
constexpr dssp9 & assign_char(char_type const chr) noexcept
Definition
alphabet_base.hpp:160
seqan3::alphabet_base< dssp9, 9 >::alphabet_base
constexpr alphabet_base() noexcept=default
seqan3::alphabet_base< dssp9, 9 >::rank_type
detail::min_viable_uint_t< size - 1 > rank_type
Definition
alphabet_base.hpp:77
seqan3::alphabet_base< dssp9, 9 >::alphabet_size
static constexpr detail::min_viable_uint_t< size > alphabet_size
Definition
alphabet_base.hpp:196
seqan3::alphabet_base< dssp9, 9 >::char_type
std::conditional_t< std::same_as< char, void >, char, char > char_type
Definition
alphabet_base.hpp:69
seqan3::dssp9::dssp9
constexpr dssp9() noexcept=default
Defaulted.
std::array::fill
T fill(T... args)
std::make_unsigned_t
seqan3::literals
The SeqAn namespace for literals.
seqan3
The main SeqAn3 namespace.
Definition
aligned_sequence_concept.hpp:26
SEQAN3_WORKAROUND_LITERAL
#define SEQAN3_WORKAROUND_LITERAL
Our char literals returning std::vector should be constexpr if constexpr std::vector is supported.
Definition
platform.hpp:310
std::vector::resize
T resize(T... args)
std::size_t
transform.hpp
Provides utilities for modifying characters.
vector
Hide me
Version:
seqan3
alphabet
structure
dssp9.hpp
Generated on
for SeqAn3 by
1.17.0