SeqAn3  3.2.0-rc.1
The Modern C++ library for sequence analysis.
sequence_file/record.hpp
Go to the documentation of this file.
1 // -----------------------------------------------------------------------------------------------------
2 // Copyright (c) 2006-2022, Knut Reinert & Freie Universität Berlin
3 // Copyright (c) 2016-2022, 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 sequence_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 
42 public:
46  sequence_record() = default;
47  sequence_record(sequence_record const &) = default;
48  sequence_record & operator=(sequence_record const &) = default;
51  ~sequence_record() = default;
52 
54  using base_t::base_t;
56 
58  decltype(auto) id() &&
59  {
60  return get_impl(field_constant<seqan3::field::id>{}, static_cast<tuple_base_t &&>(*this));
61  }
63  decltype(auto) id() const &&
64  {
65  return get_impl(field_constant<seqan3::field::id>{}, static_cast<tuple_base_t const &&>(*this));
66  }
68  decltype(auto) id() &
69  {
70  return get_impl(field_constant<seqan3::field::id>{}, static_cast<tuple_base_t &>(*this));
71  }
73  decltype(auto) id() const &
74  {
75  return get_impl(field_constant<seqan3::field::id>{}, static_cast<tuple_base_t const &>(*this));
76  }
77 
79  decltype(auto) sequence() &&
80  {
81  return get_impl(field_constant<seqan3::field::seq>{}, static_cast<tuple_base_t &&>(*this));
82  }
84  decltype(auto) sequence() const &&
85  {
86  return get_impl(field_constant<seqan3::field::seq>{}, static_cast<tuple_base_t const &&>(*this));
87  }
89  decltype(auto) sequence() &
90  {
91  return get_impl(field_constant<seqan3::field::seq>{}, static_cast<tuple_base_t &>(*this));
92  }
94  decltype(auto) sequence() const &
95  {
96  return get_impl(field_constant<seqan3::field::seq>{}, static_cast<tuple_base_t const &>(*this));
97  }
98 
100  decltype(auto) base_qualities() &&
101  {
102  return get_impl(field_constant<seqan3::field::qual>{}, static_cast<tuple_base_t &&>(*this));
103  }
105  decltype(auto) base_qualities() const &&
106  {
107  return get_impl(field_constant<seqan3::field::qual>{}, static_cast<tuple_base_t const &&>(*this));
108  }
110  decltype(auto) base_qualities() &
111  {
112  return get_impl(field_constant<seqan3::field::qual>{}, static_cast<tuple_base_t &>(*this));
113  }
115  decltype(auto) base_qualities() const &
116  {
117  return get_impl(field_constant<seqan3::field::qual>{}, static_cast<tuple_base_t const &>(*this));
118  }
119 };
120 } // namespace seqan3
121 
122 namespace std
123 {
124 
130 template <typename field_types, typename field_ids>
131 struct tuple_size<seqan3::sequence_record<field_types, field_ids>> :
132  tuple_size<typename seqan3::sequence_record<field_types, field_ids>::base_type>
133 {};
134 
140 template <size_t elem_no, typename field_types, typename field_ids>
141 struct tuple_element<elem_no, seqan3::sequence_record<field_types, field_ids>> :
142  tuple_element<elem_no, typename seqan3::sequence_record<field_types, field_ids>::base_type>
143 {};
144 
145 } // namespace std
The record type of seqan3::sequence_file_input.
Definition: sequence_file/record.hpp:29
sequence_record & operator=(sequence_record &&)=default
Defaulted.
sequence_record()=default
Defaulted.
sequence_record(sequence_record const &)=default
Defaulted.
~sequence_record()=default
Defaulted.
decltype(auto) base_qualities() &&
The qualities, usually in Phred score notation.
Definition: sequence_file/record.hpp:100
sequence_record & operator=(sequence_record const &)=default
Defaulted.
decltype(auto) id() &&
The identifier, usually a string.
Definition: sequence_file/record.hpp:58
sequence_record(sequence_record &&)=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:192
detail::transfer_template_args_onto_t< field_types, std::tuple > base_type
A specialisation of std::tuple.
Definition: record.hpp:217