SeqAn3 3.3.0-rc.1
The Modern C++ library for sequence analysis.
sam_file/input_format_concept.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 <fstream>
16#include <optional>
17#include <string>
18#include <vector>
19
31
32namespace seqan3::detail
33{
34
45template <typename format_type>
46struct sam_file_input_format_exposer : public format_type
47{
48public:
49 // Can't use `using format_type::read_alignment_record` as it produces a hard failure in the format concept check
50 // for types that do not model the format concept, i.e. don't offer the proper read_alignment_record interface.
52 template <typename... ts>
53 void read_alignment_record(ts &&... args)
54 {
55 format_type::read_alignment_record(std::forward<ts>(args)...);
56 }
57};
58
59} // namespace seqan3::detail
60
61namespace seqan3
62{
63
77template <typename t>
78concept sam_file_input_format = requires (detail::sam_file_input_format_exposer<t> & v,
79 std::ifstream & stream,
80 sam_file_input_options<dna5> & options,
81 std::vector<dna5_vector> & ref_sequences,
82 sam_file_header<> & header,
83 std::streampos & position_buffer,
84 dna5_vector & seq,
86 std::string & id,
87 int32_t & offset,
88 dna5_vector & ref_seq,
90 std::optional<int32_t> & ref_offset,
91 std::vector<cigar> & cigar,
92 sam_flag & flag,
93 uint8_t & mapq,
95 sam_tag_dictionary & tag_dict,
96 double & e_value,
97 double & bit_score) {
98 t::file_extensions;
99 // std::same_as<decltype(t::file_extensions), std::vector<std::string>>;
100
101 {
102 v.read_alignment_record(stream,
103 options,
104 ref_sequences,
105 header,
106 position_buffer,
107 seq,
108 qual,
109 id,
110 offset,
111 ref_seq,
112 ref_id,
113 ref_offset,
114 cigar,
115 flag,
116 mapq,
117 mate,
118 tag_dict,
119 e_value,
120 bit_score)
121 };
122
123 {
124 v.read_alignment_record(stream,
125 options,
126 std::ignore,
127 header,
128 position_buffer,
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 std::ignore,
139 std::ignore,
140 std::ignore,
141 std::ignore,
142 std::ignore)
143 };
144 };
146
147// Workaround for https://github.com/doxygen/doxygen/issues/9379
148#if SEQAN3_DOXYGEN_ONLY(1) 0
149template <typename t>
151{};
152#endif
153
230
231} // namespace seqan3
232
233namespace seqan3::detail
234{
235
241template <typename t>
243
249template <typename... ts>
251
257template <typename t>
258concept type_list_of_sam_file_input_formats = is_type_list_of_sam_file_input_formats_v<t>;
259
260} // 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:151
Auxiliary concept that checks whether a type is a seqan3::type_list and all types meet seqan3::sam_fi...
Definition: sam_file/input_format_concept.hpp:258
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:76
constexpr bool is_type_list_of_sam_file_input_formats_v
Auxiliary value metafuncton that checks whether a type is a seqan3::type_list and all types meet seqa...
Definition: sam_file/input_format_concept.hpp:242
Provides the seqan3::sam_file_header class.
The internal SeqAn3 namespace.
Definition: aligned_sequence_concept.hpp:29
The main SeqAn3 namespace.
Definition: aligned_sequence_concept.hpp:29
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.
Internal class used to expose the actual format interface to read alignment records from the file.
Definition: sam_file/input_format_concept.hpp:47
void read_alignment_record(ts &&... args)
Forwards to the seqan3::sam_file_input_format::read_alignment_record interface.
Definition: sam_file/input_format_concept.hpp:53
Type that contains multiple types.
Definition: type_list.hpp:29
Provides seqan3::type_list.