SeqAn3  3.2.0
The Modern C++ library for sequence analysis.
structured_aa.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 
19 
20 namespace seqan3
21 {
22 
49 template <writable_alphabet sequence_alphabet_t = aa27, writable_alphabet structure_alphabet_t = dssp9>
50  requires (!std::is_reference_v<sequence_alphabet_t>) && (!std::is_reference_v<structure_alphabet_t>)
51 class structured_aa :
52  public alphabet_tuple_base<structured_aa<sequence_alphabet_t, structure_alphabet_t>,
53  sequence_alphabet_t,
54  structure_alphabet_t>
55 {
56 private:
58  using base_type = alphabet_tuple_base<structured_aa<sequence_alphabet_t, structure_alphabet_t>,
59  sequence_alphabet_t,
60  structure_alphabet_t>;
61 
62 public:
67  using sequence_alphabet_type = sequence_alphabet_t;
72  using structure_alphabet_type = structure_alphabet_t;
73 
78  using char_type = alphabet_char_t<sequence_alphabet_type>;
79 
83  constexpr structured_aa() noexcept = default;
84  constexpr structured_aa(structured_aa const &) noexcept = default;
85  constexpr structured_aa(structured_aa &&) noexcept = default;
86  constexpr structured_aa & operator=(structured_aa const &) noexcept = default;
87  constexpr structured_aa & operator=(structured_aa &&) noexcept = default;
88  ~structured_aa() noexcept = default;
89 
90  using base_type::base_type; // Inherit non-default constructors
91 
92 #if SEQAN3_DOXYGEN_ONLY(1) 0
99  template <typename component_type>
100  constexpr structured_aa(component_type const alph)
101  {}
102 
109  template <typename indirect_component_type>
110  constexpr structured_aa(indirect_component_type const alph)
111  {}
112 
119  template <typename component_type>
120  constexpr structured_aa & operator=(component_type const alph)
121  {}
122 
129  template <typename indirect_component_type>
130  constexpr structured_aa & operator=(indirect_component_type const alph)
131  {}
132 #endif
133 
138  using base_type::operator=;
140 
148  constexpr structured_aa & assign_char(char_type const c) noexcept
149  {
150  seqan3::assign_char_to(c, get<0>(*this));
151  return *this;
152  }
154 
162  constexpr char_type to_char() const noexcept
163  {
164  return seqan3::to_char(get<0>(*this));
165  }
167 
172  static constexpr bool char_is_valid(char_type const c) noexcept
173  {
174  return char_is_valid_for<sequence_alphabet_type>(c);
175  }
176 };
177 
180 template <typename sequence_alphabet_type, typename structure_alphabet_type>
181 structured_aa(sequence_alphabet_type &&, structure_alphabet_type &&)
182  -> structured_aa<std::decay_t<sequence_alphabet_type>, std::decay_t<structure_alphabet_type>>;
183 
184 } // namespace seqan3
Provides seqan3::aa27, container aliases and string literals.
Core alphabet concept and free function/type trait wrappers.
Provides seqan3::alphabet_tuple_base.
Provides the dssp format for protein structure.
constexpr auto assign_char_to
Assign a character to an alphabet object.
Definition: alphabet/concept.hpp:524
constexpr auto to_char
Return the char representation of an alphabet object.
Definition: alphabet/concept.hpp:386
requires requires
The rank_type of the semi-alphabet; defined as the return type of seqan3::to_rank....
Definition: alphabet/concept.hpp:164
The main SeqAn3 namespace.
Definition: aligned_sequence_concept.hpp:29