SeqAn3  3.1.0
The Modern C++ library for sequence analysis.
record.hpp
Go to the documentation of this file.
1 // -----------------------------------------------------------------------------------------------------
2 // Copyright (c) 2006-2021, Knut Reinert & Freie Universität Berlin
3 // Copyright (c) 2016-2021, 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 <seqan3/io/record.hpp>
16 
17 namespace seqan3
18 {
27 template <typename field_types, typename field_ids>
28 class structure_record : public record<field_types, field_ids>
29 {
32 
34  using tuple_base_t = typename base_t::base_type;
35 
37  template <field f>
38  using field_constant = typename base_t::template field_constant<f>;
39 
40  using base_t::get_impl;
41 public:
45  structure_record() = default;
46  structure_record(structure_record const &) = default;
50  ~structure_record() = default;
51 
53  using base_t::base_t;
55 
57  decltype(auto) id() &&
58  {
59  return get_impl(field_constant<seqan3::field::id>{}, static_cast<tuple_base_t &&>(*this));
60  }
62  decltype(auto) id() const &&
63  {
64  return get_impl(field_constant<seqan3::field::id>{}, static_cast<tuple_base_t const &&>(*this));
65  }
67  decltype(auto) id() &
68  {
69  return get_impl(field_constant<seqan3::field::id>{}, static_cast<tuple_base_t &>(*this));
70  }
72  decltype(auto) id() const &
73  {
74  return get_impl(field_constant<seqan3::field::id>{}, static_cast<tuple_base_t const &>(*this));
75  }
76 
78  decltype(auto) sequence() &&
79  {
80  return get_impl(field_constant<seqan3::field::seq>{}, static_cast<tuple_base_t &&>(*this));
81  }
83  decltype(auto) sequence() const &&
84  {
85  return get_impl(field_constant<seqan3::field::seq>{}, static_cast<tuple_base_t const &&>(*this));
86  }
88  decltype(auto) sequence() &
89  {
90  return get_impl(field_constant<seqan3::field::seq>{}, static_cast<tuple_base_t &>(*this));
91  }
93  decltype(auto) sequence() const &
94  {
95  return get_impl(field_constant<seqan3::field::seq>{}, static_cast<tuple_base_t const &>(*this));
96  }
97 
99  decltype(auto) sequence_structure() &&
100  {
101  return get_impl(field_constant<seqan3::field::structure>{}, static_cast<tuple_base_t &&>(*this));
102  }
104  decltype(auto) sequence_structure() const &&
105  {
106  return get_impl(field_constant<seqan3::field::structure>{}, static_cast<tuple_base_t const &&>(*this));
107  }
109  decltype(auto) sequence_structure() &
110  {
111  return get_impl(field_constant<seqan3::field::structure>{}, static_cast<tuple_base_t &>(*this));
112  }
114  decltype(auto) sequence_structure() const &
115  {
116  return get_impl(field_constant<seqan3::field::structure>{}, static_cast<tuple_base_t const &>(*this));
117  }
118 
120  decltype(auto) energy() &&
121  {
122  return get_impl(field_constant<seqan3::field::energy>{}, static_cast<tuple_base_t &&>(*this));
123  }
125  decltype(auto) energy() const &&
126  {
127  return get_impl(field_constant<seqan3::field::energy>{}, static_cast<tuple_base_t const &&>(*this));
128  }
130  decltype(auto) energy() &
131  {
132  return get_impl(field_constant<seqan3::field::energy>{}, static_cast<tuple_base_t &>(*this));
133  }
135  decltype(auto) energy() const &
136  {
137  return get_impl(field_constant<seqan3::field::energy>{}, static_cast<tuple_base_t const &>(*this));
138  }
139 
141  decltype(auto) base_pair_probability_matrix() &&
142  {
143  // this is computed
144  return get_impl(field_constant<seqan3::field::bpp>{}, static_cast<tuple_base_t &&>(*this));
145  }
147  decltype(auto) base_pair_probability_matrix() const &&
148  {
149  return get_impl(field_constant<seqan3::field::bpp>{}, static_cast<tuple_base_t const &&>(*this));
150  }
152  decltype(auto) base_pair_probability_matrix() &
153  {
154  return get_impl(field_constant<seqan3::field::bpp>{}, static_cast<tuple_base_t &>(*this));
155  }
157  decltype(auto) base_pair_probability_matrix() const &
158  {
159  return get_impl(field_constant<seqan3::field::bpp>{}, static_cast<tuple_base_t const &>(*this));
160  }
161 
162  // decltype(auto) reactivity(); // unused
163  // decltype(auto) reactivity_errors(); // unused
164  // decltype(auto) comment(); // unused
165  // decltype(auto) base_qualities(); // unused
166 };
167 } // namespace seqan3
168 
169 namespace std
170 {
171 
177 template <typename field_types, typename field_ids>
178 struct tuple_size<seqan3::structure_record<field_types, field_ids>>
179  : tuple_size<typename seqan3::structure_record<field_types, field_ids>::base_type>
180 {};
181 
187 template <size_t elem_no, typename field_types, typename field_ids>
188 struct tuple_element<elem_no, seqan3::structure_record<field_types, field_ids>>
189  : tuple_element<elem_no, typename seqan3::structure_record<field_types, field_ids>::base_type>
190 {};
191 
192 } // namespace std
The record type of seqan3::structure_file_input.
Definition: record.hpp:29
structure_record()=default
Defaulted.
decltype(auto) base_pair_probability_matrix() &&
Base pair probability matrix of interactions, usually a matrix of float numbers.
Definition: record.hpp:141
decltype(auto) energy() &&
Energy of a folded sequence, represented by one float number.
Definition: record.hpp:120
structure_record & operator=(structure_record const &)=default
Defaulted.
decltype(auto) id() &&
The identifier, usually a string.
Definition: record.hpp:57
structure_record(structure_record &&)=default
Defaulted.
~structure_record()=default
Defaulted.
decltype(auto) sequence_structure() &&
Fixed interactions, usually a string of structure alphabet characters.
Definition: record.hpp:99
structure_record & operator=(structure_record &&)=default
Defaulted.
structure_record(structure_record const &)=default
Defaulted.
The generic concept for a (biological) sequence.
The main SeqAn3 namespace.
Definition: aligned_sequence_concept.hpp:29
SeqAn specific customisations in the standard namespace.
Provides the seqan3::record template and the seqan3::field enum.
The class template that file records are based on; behaves like a std::tuple.
Definition: record.hpp:191
detail::transfer_template_args_onto_t< field_types, std::tuple > base_type
A specialisation of std::tuple.
Definition: record.hpp:215