SeqAn3
structured_aa.hpp
Go to the documentation of this file.
1 // ============================================================================
2 // SeqAn - The Library for Sequence Analysis
3 // ============================================================================
4 //
5 // Copyright (c) 2006-2018, Knut Reinert & Freie Universitaet Berlin
6 // Copyright (c) 2016-2018, Knut Reinert & MPI Molekulare Genetik
7 // All rights reserved.
8 //
9 // Redistribution and use in source and binary forms, with or without
10 // modification, are permitted provided that the following conditions are met:
11 //
12 // * Redistributions of source code must retain the above copyright
13 // notice, this list of conditions and the following disclaimer.
14 // * Redistributions in binary form must reproduce the above copyright
15 // notice, this list of conditions and the following disclaimer in the
16 // documentation and/or other materials provided with the distribution.
17 // * Neither the name of Knut Reinert or the FU Berlin nor the names of
18 // its contributors may be used to endorse or promote products derived
19 // from this software without specific prior written permission.
20 //
21 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
22 // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
23 // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
24 // ARE DISCLAIMED. IN NO EVENT SHALL KNUT REINERT OR THE FU BERLIN BE LIABLE
25 // FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
26 // DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
27 // SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
28 // CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
29 // LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
30 // OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
31 // DAMAGE.
32 //
33 // ============================================================================
34 
40 #pragma once
41 
42 #include <iostream>
43 #include <string>
44 #include <utility>
45 
50 
51 namespace seqan3
52 {
53 
76 template <typename sequence_alphabet_t = aa27, typename structure_alphabet_t = dssp9>
78  requires alphabet_concept<sequence_alphabet_t> && alphabet_concept<structure_alphabet_t>
81  public cartesian_composition<structured_aa<sequence_alphabet_t, structure_alphabet_t>,
82  sequence_alphabet_t, structure_alphabet_t>
83 {
84 private:
87  sequence_alphabet_t, structure_alphabet_t>;
88 public:
90  using sequence_alphabet_type = sequence_alphabet_t;
92  using structure_alphabet_type = structure_alphabet_t;
93 
96 
100  constexpr structured_aa() : base_type{} {}
101  constexpr structured_aa(structured_aa const &) = default;
102  constexpr structured_aa(structured_aa &&) = default;
103  constexpr structured_aa & operator =(structured_aa const &) = default;
104  constexpr structured_aa & operator =(structured_aa &&) = default;
105  ~structured_aa() = default;
106 
107  using base_type::base_type; // Inherit non-default constructors
108 
109 
111  SEQAN3_DOXYGEN_ONLY(( constexpr structured_aa(component_type const alph) {} ))
113  SEQAN3_DOXYGEN_ONLY(( constexpr structured_aa(indirect_component_type const alph) {} ))
115  SEQAN3_DOXYGEN_ONLY(( constexpr structured_aa & operator=(component_type const alph) {} ))
117  SEQAN3_DOXYGEN_ONLY(( constexpr structured_aa & operator=(indirect_component_type const alph) {} ))
119 
120  // Inherit operators from base
121  using base_type::operator=;
122  using base_type::operator==;
123  using base_type::operator!=;
124  using base_type::operator>=;
125  using base_type::operator<=;
126  using base_type::operator<;
127  using base_type::operator>;
128 
132  constexpr structured_aa & assign_char(char_type const c)
134  {
135  seqan3::assign_char(get<0>(*this), c);
136  return *this;
137  }
139 
143  constexpr char_type to_char() const noexcept
145  {
146  return seqan3::to_char(get<0>(*this));
147  }
149 };
150 
153 template <typename sequence_alphabet_type, typename structure_alphabet_type>
155  -> structured_aa<std::decay_t<sequence_alphabet_type>, std::decay_t<structure_alphabet_type>>;
156 
157 } // namespace seqan3
A seqan3::cartesian_composition that joins an aminoacid alphabet with a protein structure alphabet...
Definition: structured_aa.hpp:80
Contains the dssp format for protein structure.
char_t char_type
The type of the alphabet when converted to char (e.g. via to_char()).
Definition: alphabet_base.hpp:87
The CRTP base for a combined alphabet that contains multiple values of different alphabets at the sam...
Definition: cartesian_composition.hpp:209
constexpr char_type to_char() const noexcept
Return a character. This reads the internal sequence letter.
Definition: structured_aa.hpp:144
The main SeqAn3 namespace.
Definition: aligned_sequence_concept.hpp:58
sequence_alphabet_t sequence_alphabet_type
First template parameter as member type.
Definition: structured_aa.hpp:90
Provides seqan3::cartesian_composition.
constexpr structured_aa & assign_char(char_type const c)
Assign from a nucleotide character. This modifies the internal sequence letter.
Definition: structured_aa.hpp:133
structure_alphabet_t structure_alphabet_type
Second template parameter as member type.
Definition: structured_aa.hpp:92
constexpr alphabet_type & assign_char(alphabet_type &alph, underlying_char_t< alphabet_type > const chr) requires requires(alphabet_type alph)
Implementation of seqan3::alphabet_concept::assign_char() that delegates to a member function...
Definition: member_exposure.hpp:178
Meta-header for the aminoacid submodule; includes all headers from alphabet/aminoacid/.
Core alphabet concept and free function/metafunction wrappers.
typename underlying_char< alphabet_type >::type underlying_char_t
The char_type of the alphabet. [type metafunction shortcut].
Definition: concept_pre.hpp:172
constexpr structured_aa(component_type const alph)
Construction via a value of one of the components.
Definition: structured_aa.hpp:111
constexpr underlying_char_t< alphabet_type > to_char(alphabet_type const alph) requires requires(alphabet_type alph)
Implementation of seqan3::alphabet_concept::to_char() that delegates to a member function.
Definition: member_exposure.hpp:165