SeqAn3 3.4.0-rc.1
The Modern C++ library for sequence analysis.
Loading...
Searching...
No Matches
sam_file/record.hpp
Go to the documentation of this file.
1// SPDX-FileCopyrightText: 2006-2024 Knut Reinert & Freie Universität Berlin
2// SPDX-FileCopyrightText: 2016-2024 Knut Reinert & MPI für molekulare Genetik
3// SPDX-License-Identifier: BSD-3-Clause
4
10#pragma once
11
12#include <seqan3/io/record.hpp>
13
14namespace seqan3
15{
24template <typename field_types, typename field_ids>
25class sam_record : public record<field_types, field_ids>
26{
29
31 using tuple_base_t = typename base_t::base_type;
32
34 template <field f>
35 using field_constant = typename base_t::template field_constant<f>;
36
37 using base_t::get_impl;
38
39public:
43 sam_record() = default;
44 sam_record(sam_record const &) = default;
45 sam_record & operator=(sam_record const &) = default;
46 sam_record(sam_record &&) = default;
48 ~sam_record() = default;
49
51 using base_t::base_t;
53
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
80 decltype(auto) sequence() &&
81 {
82 return get_impl(field_constant<seqan3::field::seq>{}, static_cast<tuple_base_t &&>(*this));
83 }
85 decltype(auto) sequence() const &&
86 {
87 return get_impl(field_constant<seqan3::field::seq>{}, static_cast<tuple_base_t const &&>(*this));
88 }
90 decltype(auto) sequence() &
91 {
92 return get_impl(field_constant<seqan3::field::seq>{}, static_cast<tuple_base_t &>(*this));
93 }
95 decltype(auto) sequence() const &
96 {
97 return get_impl(field_constant<seqan3::field::seq>{}, static_cast<tuple_base_t const &>(*this));
98 }
99
103 decltype(auto) base_qualities() &&
104 {
105 return get_impl(field_constant<seqan3::field::qual>{}, static_cast<tuple_base_t &&>(*this));
106 }
108 decltype(auto) base_qualities() const &&
109 {
110 return get_impl(field_constant<seqan3::field::qual>{}, static_cast<tuple_base_t const &&>(*this));
111 }
113 decltype(auto) base_qualities() &
114 {
115 return get_impl(field_constant<seqan3::field::qual>{}, static_cast<tuple_base_t &>(*this));
116 }
118 decltype(auto) base_qualities() const &
119 {
120 return get_impl(field_constant<seqan3::field::qual>{}, static_cast<tuple_base_t const &>(*this));
121 }
122
134 {
135 return static_cast<int32_t>(0);
136 }
138 SEQAN3_DEPRECATED_340 decltype(auto) sequence_position() const &&
139 {
140 return static_cast<int32_t>(0);
141 }
144 {
145 return static_cast<int32_t>(0);
146 }
149 {
150 return static_cast<int32_t>(0);
151 }
152
158 {}
160 SEQAN3_DEPRECATED_340 decltype(auto) alignment() const &&
161 {}
164 {}
166 SEQAN3_DEPRECATED_340 decltype(auto) alignment() const &
167 {}
168
173 decltype(auto) reference_id() &&
174 {
175 return get_impl(field_constant<seqan3::field::ref_id>{}, static_cast<tuple_base_t &&>(*this));
176 }
178 decltype(auto) reference_id() const &&
179 {
180 return get_impl(field_constant<seqan3::field::ref_id>{}, static_cast<tuple_base_t const &&>(*this));
181 }
183 decltype(auto) reference_id() &
184 {
185 return get_impl(field_constant<seqan3::field::ref_id>{}, static_cast<tuple_base_t &>(*this));
186 }
188 decltype(auto) reference_id() const &
189 {
190 return get_impl(field_constant<seqan3::field::ref_id>{}, static_cast<tuple_base_t const &>(*this));
191 }
192
196 decltype(auto) reference_sequence() = delete;
197
202 decltype(auto) reference_position() &&
203 {
204 return get_impl(field_constant<seqan3::field::ref_offset>{}, static_cast<tuple_base_t &&>(*this));
205 }
207 decltype(auto) reference_position() const &&
208 {
209 return get_impl(field_constant<seqan3::field::ref_offset>{}, static_cast<tuple_base_t const &&>(*this));
210 }
212 decltype(auto) reference_position() &
213 {
214 return get_impl(field_constant<seqan3::field::ref_offset>{}, static_cast<tuple_base_t &>(*this));
215 }
217 decltype(auto) reference_position() const &
218 {
219 return get_impl(field_constant<seqan3::field::ref_offset>{}, static_cast<tuple_base_t const &>(*this));
220 }
221
227 decltype(auto) header_ptr() &&
228 {
229 return get_impl(field_constant<seqan3::field::header_ptr>{}, static_cast<tuple_base_t &&>(*this));
230 }
232 decltype(auto) header_ptr() const &&
233 {
234 return get_impl(field_constant<seqan3::field::header_ptr>{}, static_cast<tuple_base_t const &&>(*this));
235 }
237 decltype(auto) header_ptr() &
238 {
239 return get_impl(field_constant<seqan3::field::header_ptr>{}, static_cast<tuple_base_t &>(*this));
240 }
242 decltype(auto) header_ptr() const &
243 {
244 return get_impl(field_constant<seqan3::field::header_ptr>{}, static_cast<tuple_base_t const &>(*this));
245 }
246
250 decltype(auto) flag() &&
251 {
252 return get_impl(field_constant<seqan3::field::flag>{}, static_cast<tuple_base_t &&>(*this));
253 }
255 decltype(auto) flag() const &&
256 {
257 return get_impl(field_constant<seqan3::field::flag>{}, static_cast<tuple_base_t const &&>(*this));
258 }
260 decltype(auto) flag() &
261 {
262 return get_impl(field_constant<seqan3::field::flag>{}, static_cast<tuple_base_t &>(*this));
263 }
265 decltype(auto) flag() const &
266 {
267 return get_impl(field_constant<seqan3::field::flag>{}, static_cast<tuple_base_t const &>(*this));
268 }
269
277 decltype(auto) mate_reference_id() &&
278 {
279 return std::get<0>(get_impl(field_constant<seqan3::field::mate>{}, static_cast<tuple_base_t &&>(*this)));
280 }
282 decltype(auto) mate_reference_id() const &&
283 {
284 return std::get<0>(get_impl(field_constant<seqan3::field::mate>{}, static_cast<tuple_base_t const &&>(*this)));
285 }
287 decltype(auto) mate_reference_id() &
288 {
289 return std::get<0>(get_impl(field_constant<seqan3::field::mate>{}, static_cast<tuple_base_t &>(*this)));
290 }
292 decltype(auto) mate_reference_id() const &
293 {
294 return std::get<0>(get_impl(field_constant<seqan3::field::mate>{}, static_cast<tuple_base_t const &>(*this)));
295 }
296
300 decltype(auto) mate_position() &&
301 {
302 return std::get<1>(get_impl(field_constant<seqan3::field::mate>{}, static_cast<tuple_base_t &&>(*this)));
303 }
305 decltype(auto) mate_position() const &&
306 {
307 return std::get<1>(get_impl(field_constant<seqan3::field::mate>{}, static_cast<tuple_base_t const &&>(*this)));
308 }
310 decltype(auto) mate_position() &
311 {
312 return std::get<1>(get_impl(field_constant<seqan3::field::mate>{}, static_cast<tuple_base_t &>(*this)));
313 }
315 decltype(auto) mate_position() const &
316 {
317 return std::get<1>(get_impl(field_constant<seqan3::field::mate>{}, static_cast<tuple_base_t const &>(*this)));
318 }
319
323 decltype(auto) template_length() &&
324 {
325 return std::get<2>(get_impl(field_constant<seqan3::field::mate>{}, static_cast<tuple_base_t &&>(*this)));
326 }
328 decltype(auto) template_length() const &&
329 {
330 return std::get<2>(get_impl(field_constant<seqan3::field::mate>{}, static_cast<tuple_base_t const &&>(*this)));
331 }
333 decltype(auto) template_length() &
334 {
335 return std::get<2>(get_impl(field_constant<seqan3::field::mate>{}, static_cast<tuple_base_t &>(*this)));
336 }
338 decltype(auto) template_length() const &
339 {
340 return std::get<2>(get_impl(field_constant<seqan3::field::mate>{}, static_cast<tuple_base_t const &>(*this)));
341 }
342
346 decltype(auto) mapping_quality() &&
347 {
348 return get_impl(field_constant<seqan3::field::mapq>{}, static_cast<tuple_base_t &&>(*this));
349 }
351 decltype(auto) mapping_quality() const &&
352 {
353 return get_impl(field_constant<seqan3::field::mapq>{}, static_cast<tuple_base_t const &&>(*this));
354 }
356 decltype(auto) mapping_quality() &
357 {
358 return get_impl(field_constant<seqan3::field::mapq>{}, static_cast<tuple_base_t &>(*this));
359 }
361 decltype(auto) mapping_quality() const &
362 {
363 return get_impl(field_constant<seqan3::field::mapq>{}, static_cast<tuple_base_t const &>(*this));
364 }
365
369 decltype(auto) cigar_sequence() &&
370 {
371 return get_impl(field_constant<seqan3::field::cigar>{}, static_cast<tuple_base_t &&>(*this));
372 }
374 decltype(auto) cigar_sequence() const &&
375 {
376 return get_impl(field_constant<seqan3::field::cigar>{}, static_cast<tuple_base_t const &&>(*this));
377 }
379 decltype(auto) cigar_sequence() &
380 {
381 return get_impl(field_constant<seqan3::field::cigar>{}, static_cast<tuple_base_t &>(*this));
382 }
384 decltype(auto) cigar_sequence() const &
385 {
386 return get_impl(field_constant<seqan3::field::cigar>{}, static_cast<tuple_base_t const &>(*this));
387 }
388
392 decltype(auto) tags() &&
393 {
394 return get_impl(field_constant<seqan3::field::tags>{}, static_cast<tuple_base_t &&>(*this));
395 }
397 decltype(auto) tags() const &&
398 {
399 return get_impl(field_constant<seqan3::field::tags>{}, static_cast<tuple_base_t const &&>(*this));
400 }
402 decltype(auto) tags() &
403 {
404 return get_impl(field_constant<seqan3::field::tags>{}, static_cast<tuple_base_t &>(*this));
405 }
407 decltype(auto) tags() const &
408 {
409 return get_impl(field_constant<seqan3::field::tags>{}, static_cast<tuple_base_t const &>(*this));
410 }
411};
412} // namespace seqan3
413
414namespace std
415{
416
422template <typename field_types, typename field_ids>
423struct tuple_size<seqan3::sam_record<field_types, field_ids>> :
424 tuple_size<typename seqan3::sam_record<field_types, field_ids>::base_type>
425{};
426
432template <size_t elem_no, typename field_types, typename field_ids>
433struct tuple_element<elem_no, seqan3::sam_record<field_types, field_ids>> :
434 tuple_element<elem_no, typename seqan3::sam_record<field_types, field_ids>::base_type>
435{};
436
437} // namespace std
The record type of seqan3::sam_file_input.
Definition sam_file/record.hpp:26
decltype(auto) reference_position() const &
(Reference) Sequence (seqan3::sam_record::reference_sequence) relative start position (0-based),...
Definition sam_file/record.hpp:217
decltype(auto) header_ptr() const &&
A pointer to the seqan3::sam_file_header object storing header information.
Definition sam_file/record.hpp:232
SEQAN3_DEPRECATED_340 decltype(auto) sequence_position() &
[DEPRECATED] Sequence (seqan3::sam_record::sequence) relative start position (0-based),...
Definition sam_file/record.hpp:143
SEQAN3_DEPRECATED_340 decltype(auto) sequence_position() const &&
[DEPRECATED] Sequence (seqan3::sam_record::sequence) relative start position (0-based),...
Definition sam_file/record.hpp:138
decltype(auto) flag() const &
The alignment flag (bit information), uint16_t value. (SAM Column ID: FLAG)
Definition sam_file/record.hpp:265
SEQAN3_DEPRECATED_340 decltype(auto) alignment() &
[DEPRECATED] The (pairwise) alignment stored in an object that models seqan3::detail::pairwise_alignm...
Definition sam_file/record.hpp:163
decltype(auto) cigar_sequence() &
The cigar vector representing the alignment. (SAM Column ID: CIGAR)
Definition sam_file/record.hpp:379
decltype(auto) mate_reference_id() &&
The identifier of the (reference) sequence of the mate. (SAM Column ID: RNEXT)
Definition sam_file/record.hpp:277
decltype(auto) cigar_sequence() &&
The cigar vector representing the alignment. (SAM Column ID: CIGAR)
Definition sam_file/record.hpp:369
SEQAN3_DEPRECATED_340 decltype(auto) sequence_position() const &
[DEPRECATED] Sequence (seqan3::sam_record::sequence) relative start position (0-based),...
Definition sam_file/record.hpp:148
decltype(auto) reference_id() const &&
The identifier of the (reference) sequence that seqan3::sam_record::sequence was aligned to....
Definition sam_file/record.hpp:178
decltype(auto) base_qualities() const &
The qualities, usually in Phred score notation. (SAM Column ID: QUAL)
Definition sam_file/record.hpp:118
decltype(auto) header_ptr() &&
A pointer to the seqan3::sam_file_header object storing header information.
Definition sam_file/record.hpp:227
decltype(auto) base_qualities() const &&
The qualities, usually in Phred score notation. (SAM Column ID: QUAL)
Definition sam_file/record.hpp:108
decltype(auto) template_length() const &
The observed template length. (SAM Column ID: TLEN)
Definition sam_file/record.hpp:338
decltype(auto) mate_reference_id() const &&
The identifier of the (reference) sequence of the mate. (SAM Column ID: RNEXT)
Definition sam_file/record.hpp:282
decltype(auto) sequence() &
The "sequence", usually a range of nucleotides or amino acids. (SAM Column ID: SEQ)
Definition sam_file/record.hpp:90
decltype(auto) mapping_quality() &&
The mapping quality of the alignment, usually a Phred-scaled score. (SAM Column ID: MAPQ)
Definition sam_file/record.hpp:346
decltype(auto) reference_id() &
The identifier of the (reference) sequence that seqan3::sam_record::sequence was aligned to....
Definition sam_file/record.hpp:183
decltype(auto) sequence() const &&
The "sequence", usually a range of nucleotides or amino acids. (SAM Column ID: SEQ)
Definition sam_file/record.hpp:85
decltype(auto) reference_position() &&
(Reference) Sequence (seqan3::sam_record::reference_sequence) relative start position (0-based),...
Definition sam_file/record.hpp:202
sam_record & operator=(sam_record &&)=default
Defaulted.
decltype(auto) template_length() const &&
The observed template length. (SAM Column ID: TLEN)
Definition sam_file/record.hpp:328
decltype(auto) mate_position() &
(Reference) Sequence relative start position (0-based) of the mate. (SAM Column ID: PNEXT)
Definition sam_file/record.hpp:310
sam_record(sam_record const &)=default
Defaulted.
decltype(auto) tags() const &
The optional tags in the SAM format.
Definition sam_file/record.hpp:407
decltype(auto) reference_id() &&
The identifier of the (reference) sequence that seqan3::sam_record::sequence was aligned to....
Definition sam_file/record.hpp:173
decltype(auto) flag() &&
The alignment flag (bit information), uint16_t value. (SAM Column ID: FLAG)
Definition sam_file/record.hpp:250
decltype(auto) tags() &
The optional tags in the SAM format.
Definition sam_file/record.hpp:402
decltype(auto) flag() const &&
The alignment flag (bit information), uint16_t value. (SAM Column ID: FLAG)
Definition sam_file/record.hpp:255
decltype(auto) header_ptr() const &
A pointer to the seqan3::sam_file_header object storing header information.
Definition sam_file/record.hpp:242
decltype(auto) base_qualities() &&
The qualities, usually in Phred score notation. (SAM Column ID: QUAL)
Definition sam_file/record.hpp:103
decltype(auto) mapping_quality() &
The mapping quality of the alignment, usually a Phred-scaled score. (SAM Column ID: MAPQ)
Definition sam_file/record.hpp:356
SEQAN3_DEPRECATED_340 decltype(auto) alignment() &&
[DEPRECATED] The (pairwise) alignment stored in an object that models seqan3::detail::pairwise_alignm...
Definition sam_file/record.hpp:157
decltype(auto) template_length() &
The observed template length. (SAM Column ID: TLEN)
Definition sam_file/record.hpp:333
decltype(auto) tags() const &&
The optional tags in the SAM format.
Definition sam_file/record.hpp:397
decltype(auto) tags() &&
The optional tags in the SAM format.
Definition sam_file/record.hpp:392
decltype(auto) flag() &
The alignment flag (bit information), uint16_t value. (SAM Column ID: FLAG)
Definition sam_file/record.hpp:260
sam_record()=default
Defaulted.
sam_record(sam_record &&)=default
Defaulted.
decltype(auto) reference_position() &
(Reference) Sequence (seqan3::sam_record::reference_sequence) relative start position (0-based),...
Definition sam_file/record.hpp:212
decltype(auto) cigar_sequence() const &
The cigar vector representing the alignment. (SAM Column ID: CIGAR)
Definition sam_file/record.hpp:384
decltype(auto) reference_id() const &
The identifier of the (reference) sequence that seqan3::sam_record::sequence was aligned to....
Definition sam_file/record.hpp:188
SEQAN3_DEPRECATED_340 decltype(auto) sequence_position() &&
[DEPRECATED] Sequence (seqan3::sam_record::sequence) relative start position (0-based),...
Definition sam_file/record.hpp:133
decltype(auto) mate_position() &&
(Reference) Sequence relative start position (0-based) of the mate. (SAM Column ID: PNEXT)
Definition sam_file/record.hpp:300
decltype(auto) reference_sequence()=delete
The (reference) "sequence" information, usually a range of nucleotides or amino acids....
sam_record & operator=(sam_record const &)=default
Defaulted.
decltype(auto) cigar_sequence() const &&
The cigar vector representing the alignment. (SAM Column ID: CIGAR)
Definition sam_file/record.hpp:374
decltype(auto) sequence() const &
The "sequence", usually a range of nucleotides or amino acids. (SAM Column ID: SEQ)
Definition sam_file/record.hpp:95
SEQAN3_DEPRECATED_340 decltype(auto) alignment() const &
[DEPRECATED] The (pairwise) alignment stored in an object that models seqan3::detail::pairwise_alignm...
Definition sam_file/record.hpp:166
SEQAN3_DEPRECATED_340 decltype(auto) alignment() const &&
[DEPRECATED] The (pairwise) alignment stored in an object that models seqan3::detail::pairwise_alignm...
Definition sam_file/record.hpp:160
decltype(auto) mate_position() const &
(Reference) Sequence relative start position (0-based) of the mate. (SAM Column ID: PNEXT)
Definition sam_file/record.hpp:315
~sam_record()=default
Defaulted.
decltype(auto) header_ptr() &
A pointer to the seqan3::sam_file_header object storing header information.
Definition sam_file/record.hpp:237
decltype(auto) mate_position() const &&
(Reference) Sequence relative start position (0-based) of the mate. (SAM Column ID: PNEXT)
Definition sam_file/record.hpp:305
decltype(auto) mapping_quality() const &
The mapping quality of the alignment, usually a Phred-scaled score. (SAM Column ID: MAPQ)
Definition sam_file/record.hpp:361
decltype(auto) mate_reference_id() &
The identifier of the (reference) sequence of the mate. (SAM Column ID: RNEXT)
Definition sam_file/record.hpp:287
decltype(auto) mapping_quality() const &&
The mapping quality of the alignment, usually a Phred-scaled score. (SAM Column ID: MAPQ)
Definition sam_file/record.hpp:351
decltype(auto) sequence() &&
The "sequence", usually a range of nucleotides or amino acids. (SAM Column ID: SEQ)
Definition sam_file/record.hpp:80
decltype(auto) reference_position() const &&
(Reference) Sequence (seqan3::sam_record::reference_sequence) relative start position (0-based),...
Definition sam_file/record.hpp:207
decltype(auto) base_qualities() &
The qualities, usually in Phred score notation. (SAM Column ID: QUAL)
Definition sam_file/record.hpp:113
decltype(auto) template_length() &&
The observed template length. (SAM Column ID: TLEN)
Definition sam_file/record.hpp:323
decltype(auto) mate_reference_id() const &
The identifier of the (reference) sequence of the mate. (SAM Column ID: RNEXT)
Definition sam_file/record.hpp:292
The main SeqAn3 namespace.
Definition aligned_sequence_concept.hpp:26
SeqAn specific customisations in the standard namespace.
#define SEQAN3_DEPRECATED_340
Deprecation message for SeqAn 3.4.0 release.
Definition platform.hpp:194
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:190
detail::transfer_template_args_onto_t< field_types, std::tuple > base_type
A specialisation of std::tuple.
Definition record.hpp:193
Hide me