SeqAn3 3.4.0-rc.1
The Modern C++ library for sequence analysis.
Loading...
Searching...
No Matches
sam_file/output_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
26
27namespace seqan3::detail
28{
29
42template <typename format_type>
43struct sam_file_output_format_exposer : public format_type
44{
45public:
46 // Can't use `using format_type::write_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 write_alignment_record interface.
49 template <typename... ts>
50 void write_alignment_record(ts &&... args)
51 {
52 format_type::write_alignment_record(std::forward<ts>(args)...);
53 }
54
56 template <typename stream_t, typename header_type>
57 void write_header(stream_t & stream, sam_file_output_options const & options, header_type & header)
58 {
59 format_type::write_header(stream, options, header);
60 }
61};
62
63} // namespace seqan3::detail
64
65namespace seqan3
66{
67
80template <typename t>
81concept sam_file_output_format = requires (detail::sam_file_output_format_exposer<t> & v,
82 std::ofstream & stream,
83 sam_file_output_options & options,
84 sam_file_header<> & header,
85 dna5_vector & seq,
88 dna5_vector & ref_seq,
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
100 {
101 v.write_alignment_record(stream,
102 options,
103 header,
104 seq,
105 qual,
106 id,
107 ref_seq,
108 ref_id,
110 cigar,
111 flag,
112 mapq,
113 mate,
114 tag_dict,
115 e_value,
116 bit_score)
117 } -> std::same_as<void>;
118 };
120
121// Workaround for https://github.com/doxygen/doxygen/issues/9379
122#if SEQAN3_DOXYGEN_ONLY(1) 0
123template <typename t>
126#endif
127
188
189} // namespace seqan3
190
191namespace seqan3::detail
192{
193
199template <typename t>
200constexpr bool is_type_list_of_sam_file_output_formats_v = false;
201
207template <typename... ts>
208constexpr bool is_type_list_of_sam_file_output_formats_v<type_list<ts...>> = (sam_file_output_format<ts> && ...);
209
215template <typename t>
216concept type_list_of_sam_file_output_formats = is_type_list_of_sam_file_output_formats_v<t>;
217} // namespace seqan3::detail
Provides aliases for qualified.
Provides the seqan3::cigar alphabet.
The generic concept for alignment file out formats.
Definition sam_file/output_format_concept.hpp:125
Provides seqan3::dna5, container aliases and string literals.
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_output_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