SeqAn3  3.0.0
The Modern C++ library for sequence analysis.
structured_aa.hpp
Go to the documentation of this file.
1 // -----------------------------------------------------------------------------------------------------
2 // Copyright (c) 2006-2019, Knut Reinert & Freie Universität Berlin
3 // Copyright (c) 2016-2019, 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 
15 #include <iostream>
16 #include <string>
17 #include <utility>
18 
23 
24 namespace seqan3
25 {
26 
51 template <WritableAlphabet sequence_alphabet_t = aa27, WritableAlphabet structure_alphabet_t = dssp9>
53  requires (!std::is_reference_v<sequence_alphabet_t>) && (!std::is_reference_v<structure_alphabet_t>)
57  sequence_alphabet_t, structure_alphabet_t>
58 {
59 private:
62  sequence_alphabet_t, structure_alphabet_t>;
63 public:
65  using sequence_alphabet_type = sequence_alphabet_t;
67  using structure_alphabet_type = structure_alphabet_t;
68 
71 
75  constexpr structured_aa() noexcept = default;
76  constexpr structured_aa(structured_aa const &) noexcept = default;
77  constexpr structured_aa(structured_aa &&) noexcept = default;
78  constexpr structured_aa & operator =(structured_aa const &) noexcept = default;
79  constexpr structured_aa & operator =(structured_aa &&) noexcept = default;
80  ~structured_aa() noexcept = default;
81 
82  using base_type::base_type; // Inherit non-default constructors
83 
84 
86  SEQAN3_DOXYGEN_ONLY(( constexpr structured_aa(component_type const alph) {} ))
88  SEQAN3_DOXYGEN_ONLY(( constexpr structured_aa(indirect_component_type const alph) {} ))
90  SEQAN3_DOXYGEN_ONLY(( constexpr structured_aa & operator=(component_type const alph) {} ))
92  SEQAN3_DOXYGEN_ONLY(( constexpr structured_aa & operator=(indirect_component_type const alph) {} ))
94 
95  // Inherit operators from base
96  using base_type::operator=;
97  using base_type::operator==;
98  using base_type::operator!=;
99  using base_type::operator>=;
100  using base_type::operator<=;
101  using base_type::operator<;
102  using base_type::operator>;
103 
107  constexpr structured_aa & assign_char(char_type const c) noexcept
109  {
110  seqan3::assign_char_to(c, get<0>(*this));
111  return *this;
112  }
114 
118  constexpr char_type to_char() const noexcept
120  {
121  return seqan3::to_char(get<0>(*this));
122  }
124 
126  static constexpr bool char_is_valid(char_type const c) noexcept
127  {
128  return char_is_valid_for<sequence_alphabet_type>(c);
129  }
130 };
131 
134 template <typename sequence_alphabet_type, typename structure_alphabet_type>
135 structured_aa(sequence_alphabet_type &&, structure_alphabet_type &&)
136  -> structured_aa<std::decay_t<sequence_alphabet_type>, std::decay_t<structure_alphabet_type>>;
137 
138 } // namespace seqan3
A seqan3::alphabet_tuple_base that joins an aminoacid alphabet with a protein structure alphabet...
Definition: structured_aa.hpp:55
Provides the dssp format for protein structure.
constexpr auto to_char
Return the char representation of an alphabet object.
Definition: concept.hpp:285
The main SeqAn3 namespace.
sequence_alphabet_t sequence_alphabet_type
First template parameter as member type.
Definition: structured_aa.hpp:65
The CRTP base for a combined alphabet that contains multiple values of different alphabets at the sam...
Definition: alphabet_tuple_base.hpp:188
constexpr structured_aa(indirect_component_type const alph)
Construction via a value of a subtype that is assignable to one of the components.
Definition: structured_aa.hpp:88
decltype(seqan3::to_char(std::declval< alphabet_type const >())) alphabet_char_t
The char_type of the alphabet; defined as the return type of seqan3::to_char.
Definition: concept.hpp:294
structure_alphabet_t structure_alphabet_type
Second template parameter as member type.
Definition: structured_aa.hpp:67
Meta-header for the aminoacid submodule; includes all headers from alphabet/aminoacid/.
Core alphabet concept and free function/type trait wrappers.
static constexpr bool char_is_valid(char_type const c) noexcept
Validate whether a character is valid in the sequence alphabet.
Definition: structured_aa.hpp:126
Provides seqan3::alphabet_tuple_base.
constexpr auto assign_char_to
Assign a character to an alphabet object.
Definition: concept.hpp:395