SeqAn3 3.4.0-rc.1
The Modern C++ library for sequence analysis.
Loading...
Searching...
No Matches
sam_file/input_format_concept.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 <fstream>
13#include <optional>
14#include <string>
15#include <vector>
16
28
29namespace seqan3::detail
30{
31
42template <typename format_type>
43struct sam_file_input_format_exposer : public format_type
44{
45public:
46 // Can't use `using format_type::read_alignment_record` as it produces a hard failure in the format concept check
47 // for types that do not model the format concept, i.e. don't offer the proper read_alignment_record interface.
49 template <typename... ts>
50 void read_alignment_record(ts &&... args)
51 {
52 format_type::read_alignment_record(std::forward<ts>(args)...);
53 }
54};
55
56} // namespace seqan3::detail
57
58namespace seqan3
59{
60
74template <typename t>
75concept sam_file_input_format = requires (detail::sam_file_input_format_exposer<t> & v,
76 std::ifstream & stream,
77 sam_file_input_options<dna5> & options,
78 std::vector<dna5_vector> & ref_sequences,
79 sam_file_header<> & header,
80 std::streampos & position_buffer,
81 dna5_vector & seq,
84 dna5_vector & ref_seq,
88 sam_flag & flag,
89 uint8_t & mapq,
91 sam_tag_dictionary & tag_dict,
92 double & e_value,
93 double & bit_score) {
94 t::file_extensions;
95 // std::same_as<decltype(t::file_extensions), std::vector<std::string>>;
96
97 {
98 v.read_alignment_record(stream,
99 options,
100 ref_sequences,
101 header,
102 position_buffer,
103 seq,
104 qual,
105 id,
106 ref_seq,
107 ref_id,
109 cigar,
110 flag,
111 mapq,
112 mate,
113 tag_dict,
114 e_value,
115 bit_score)
116 };
117
118 {
119 v.read_alignment_record(stream,
120 options,
121 std::ignore,
122 header,
123 position_buffer,
124 std::ignore,
125 std::ignore,
126 std::ignore,
127 std::ignore,
128 std::ignore,
129 std::ignore,
130 std::ignore,
131 std::ignore,
132 std::ignore,
133 std::ignore,
134 std::ignore,
135 std::ignore,
136 std::ignore,
137 std::ignore)
138 };
139 };
141
142// Workaround for https://github.com/doxygen/doxygen/issues/9379
143#if SEQAN3_DOXYGEN_ONLY(1) 0
144template <typename t>
147#endif
148
222
223} // namespace seqan3
224
225namespace seqan3::detail
226{
227
233template <typename t>
234constexpr bool is_type_list_of_sam_file_input_formats_v = false;
235
241template <typename... ts>
242constexpr bool is_type_list_of_sam_file_input_formats_v<type_list<ts...>> = (sam_file_input_format<ts> && ...);
243
249template <typename t>
250concept type_list_of_sam_file_input_formats = is_type_list_of_sam_file_input_formats_v<t>;
251
252} // namespace seqan3::detail
Provides aliases for qualified.
Provides the seqan3::cigar alphabet.
The generic concept for alignment file input formats.
Definition sam_file/input_format_concept.hpp:146
Provides seqan3::dna4, container aliases and string literals.
Provides seqan3::dna5, container aliases and string literals.
Provides seqan3::gapped.
sam_flag
An enum flag that describes the properties of an aligned read (given as a SAM record).
Definition sam_flag.hpp:73
@ flag
The alignment flag (bit information), uint16_t value.
@ ref_offset
Sequence (seqan3::field::ref_seq) relative start position (0-based), unsigned value.
@ ref_seq
The (reference) "sequence" information, usually a range of nucleotides or amino acids.
@ cigar
The cigar vector (std::vector<seqan3::cigar>) representing the alignment in SAM/BAM format.
@ mapq
The mapping quality of the seqan3::field::seq alignment, usually a Phred-scaled score.
@ bit_score
The bit score (statistical significance indicator), unsigned value.
@ mate
The mate pair information given as a std::tuple of reference name, offset and template length.
@ ref_id
The identifier of the (reference) sequence that seqan3::field::seq was aligned to.
@ id
The identifier, usually a string.
@ seq
The "sequence", usually a range of nucleotides or amino acids.
@ qual
The qualities, usually in Phred score notation.
Provides the seqan3::sam_file_header class.
The main SeqAn3 namespace.
Definition aligned_sequence_concept.hpp:26
Provides seqan3::phred42 quality scores.
Provides seqan3::sam_file_input_options.
Provides helper data structures for the seqan3::sam_file_output.
Provides the seqan3::sam_tag_dictionary class and auxiliaries.
Provides seqan3::type_list.
Hide me