SeqAn3  3.0.1
The Modern C++ library for sequence analysis.
structured_aa.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 
19 
20 namespace seqan3
21 {
22 
47 template <writable_alphabet sequence_alphabet_t = aa27, writable_alphabet structure_alphabet_t = dssp9>
49  requires (!std::is_reference_v<sequence_alphabet_t>) && (!std::is_reference_v<structure_alphabet_t>)
53  sequence_alphabet_t, structure_alphabet_t>
54 {
55 private:
58  sequence_alphabet_t, structure_alphabet_t>;
59 public:
61  using sequence_alphabet_type = sequence_alphabet_t;
63  using structure_alphabet_type = structure_alphabet_t;
64 
67 
71  constexpr structured_aa() noexcept = default;
72  constexpr structured_aa(structured_aa const &) noexcept = default;
73  constexpr structured_aa(structured_aa &&) noexcept = default;
74  constexpr structured_aa & operator =(structured_aa const &) noexcept = default;
75  constexpr structured_aa & operator =(structured_aa &&) noexcept = default;
76  ~structured_aa() noexcept = default;
77 
78  using base_type::base_type; // Inherit non-default constructors
79 
80 
82  SEQAN3_DOXYGEN_ONLY(( constexpr structured_aa(component_type const alph) {} ))
84  SEQAN3_DOXYGEN_ONLY(( constexpr structured_aa(indirect_component_type const alph) {} ))
86  SEQAN3_DOXYGEN_ONLY(( constexpr structured_aa & operator=(component_type const alph) {} ))
88  SEQAN3_DOXYGEN_ONLY(( constexpr structured_aa & operator=(indirect_component_type const alph) {} ))
90 
91  // Inherit operators from base
92  using base_type::operator=;
93 
97  constexpr structured_aa & assign_char(char_type const c) noexcept
99  {
100  seqan3::assign_char_to(c, get<0>(*this));
101  return *this;
102  }
104 
108  constexpr char_type to_char() const noexcept
110  {
111  return seqan3::to_char(get<0>(*this));
112  }
114 
116  static constexpr bool char_is_valid(char_type const c) noexcept
117  {
118  return char_is_valid_for<sequence_alphabet_type>(c);
119  }
120 };
121 
124 template <typename sequence_alphabet_type, typename structure_alphabet_type>
125 structured_aa(sequence_alphabet_type &&, structure_alphabet_type &&)
126  -> structured_aa<std::decay_t<sequence_alphabet_type>, std::decay_t<structure_alphabet_type>>;
127 
128 } // namespace seqan3
seqan3::structured_aa::structured_aa
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:84
seqan3::alphabet_tuple_base
The CRTP base for a combined alphabet that contains multiple values of different alphabets at the sam...
Definition: alphabet_tuple_base.hpp:120
seqan3::structured_aa::sequence_alphabet_type
sequence_alphabet_t sequence_alphabet_type
First template parameter as member type.
Definition: structured_aa.hpp:61
seqan3::to_char
constexpr auto to_char
Return the char representation of an alphabet object.
Definition: concept.hpp:320
seqan3::structured_aa::char_is_valid
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:116
aa27.hpp
Provides seqan3::aa27, container aliases and string literals.
seqan3::alphabet_char_t
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:329
seqan3
The main SeqAn3 namespace.
Definition: aligned_sequence_concept.hpp:36
std::decay_t
dssp9.hpp
Provides the dssp format for protein structure.
alphabet_tuple_base.hpp
Provides seqan3::alphabet_tuple_base.
seqan3::structured_aa::structure_alphabet_type
structure_alphabet_t structure_alphabet_type
Second template parameter as member type.
Definition: structured_aa.hpp:63
seqan3::assign_char_to
constexpr auto assign_char_to
Assign a character to an alphabet object.
Definition: concept.hpp:416
std::conditional_t
seqan3::structured_aa
A seqan3::alphabet_tuple_base that joins an aminoacid alphabet with a protein structure alphabet.
Definition: structured_aa.hpp:51
concept.hpp
Core alphabet concept and free function/type trait wrappers.