SeqAn3  3.0.3
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 {
25 template <typename field_types, typename field_ids>
26 class structure_record : public record<field_types, field_ids>
27 {
30 
32  using tuple_base_t = typename base_t::base_type;
33 
35  template <field f>
36  using field_constant = typename base_t::template field_constant<f>;
37 
38  using base_t::get_impl;
39 public:
43  structure_record() = default;
44  structure_record(structure_record const &) = default;
48  ~structure_record() = default;
49 
51  using base_t::base_t;
53 
55  decltype(auto) id() &&
56  {
57  return get_impl(field_constant<seqan3::field::id>{}, static_cast<tuple_base_t &&>(*this));
58  }
60  decltype(auto) id() const &&
61  {
62  return get_impl(field_constant<seqan3::field::id>{}, static_cast<tuple_base_t const &&>(*this));
63  }
65  decltype(auto) id() &
66  {
67  return get_impl(field_constant<seqan3::field::id>{}, static_cast<tuple_base_t &>(*this));
68  }
70  decltype(auto) id() const &
71  {
72  return get_impl(field_constant<seqan3::field::id>{}, static_cast<tuple_base_t const &>(*this));
73  }
74 
76  decltype(auto) sequence() &&
77  {
78  return get_impl(field_constant<seqan3::field::seq>{}, static_cast<tuple_base_t &&>(*this));
79  }
81  decltype(auto) sequence() const &&
82  {
83  return get_impl(field_constant<seqan3::field::seq>{}, static_cast<tuple_base_t const &&>(*this));
84  }
86  decltype(auto) sequence() &
87  {
88  return get_impl(field_constant<seqan3::field::seq>{}, static_cast<tuple_base_t &>(*this));
89  }
91  decltype(auto) sequence() const &
92  {
93  return get_impl(field_constant<seqan3::field::seq>{}, static_cast<tuple_base_t const &>(*this));
94  }
95 
97  decltype(auto) sequence_structure() &&
98  {
99  return get_impl(field_constant<seqan3::field::structure>{}, static_cast<tuple_base_t &&>(*this));
100  }
102  decltype(auto) sequence_structure() const &&
103  {
104  return get_impl(field_constant<seqan3::field::structure>{}, static_cast<tuple_base_t const &&>(*this));
105  }
107  decltype(auto) sequence_structure() &
108  {
109  return get_impl(field_constant<seqan3::field::structure>{}, static_cast<tuple_base_t &>(*this));
110  }
112  decltype(auto) sequence_structure() const &
113  {
114  return get_impl(field_constant<seqan3::field::structure>{}, static_cast<tuple_base_t const &>(*this));
115  }
116 
118  decltype(auto) energy() &&
119  {
120  return get_impl(field_constant<seqan3::field::energy>{}, static_cast<tuple_base_t &&>(*this));
121  }
123  decltype(auto) energy() const &&
124  {
125  return get_impl(field_constant<seqan3::field::energy>{}, static_cast<tuple_base_t const &&>(*this));
126  }
128  decltype(auto) energy() &
129  {
130  return get_impl(field_constant<seqan3::field::energy>{}, static_cast<tuple_base_t &>(*this));
131  }
133  decltype(auto) energy() const &
134  {
135  return get_impl(field_constant<seqan3::field::energy>{}, static_cast<tuple_base_t const &>(*this));
136  }
137 
139  decltype(auto) base_pair_probability_matrix() &&
140  {
141  // this is computed
142  return get_impl(field_constant<seqan3::field::bpp>{}, static_cast<tuple_base_t &&>(*this));
143  }
145  decltype(auto) base_pair_probability_matrix() const &&
146  {
147  return get_impl(field_constant<seqan3::field::bpp>{}, static_cast<tuple_base_t const &&>(*this));
148  }
150  decltype(auto) base_pair_probability_matrix() &
151  {
152  return get_impl(field_constant<seqan3::field::bpp>{}, static_cast<tuple_base_t &>(*this));
153  }
155  decltype(auto) base_pair_probability_matrix() const &
156  {
157  return get_impl(field_constant<seqan3::field::bpp>{}, static_cast<tuple_base_t const &>(*this));
158  }
159 
160  // decltype(auto) reactivity(); // unused
161  // decltype(auto) reactivity_errors(); // unused
162  // decltype(auto) comment(); // unused
163  // decltype(auto) base_qualities(); // unused
164 };
165 } // namespace seqan3
166 
167 namespace std
168 {
169 
175 template <typename field_types, typename field_ids>
176 struct tuple_size<seqan3::structure_record<field_types, field_ids>>
177  : tuple_size<typename seqan3::structure_record<field_types, field_ids>::base_type>
178 {};
179 
185 template <size_t elem_no, typename field_types, typename field_ids>
186 struct tuple_element<elem_no, seqan3::structure_record<field_types, field_ids>>
187  : tuple_element<elem_no, typename seqan3::structure_record<field_types, field_ids>::base_type>
188 {};
189 
190 } // namespace std
The record type of seqan3::structure_file_input.
Definition: record.hpp:27
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:139
decltype(auto) energy() &&
Energy of a folded sequence, represented by one float number.
Definition: record.hpp:118
structure_record & operator=(structure_record const &)=default
Defaulted.
decltype(auto) id() &&
The identifier, usually a string.
Definition: record.hpp:55
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:97
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 an std::tuple.
Definition: record.hpp:235
detail::transfer_template_args_onto_t< field_types, std::tuple > base_type
A specialisation of std::tuple.
Definition: record.hpp:259