SeqAn3 3.2.0-rc.1
The Modern C++ library for sequence analysis.
output_format_concept.hpp
Go to the documentation of this file.
1// -----------------------------------------------------------------------------------------------------
2// Copyright (c) 2006-2021, Knut Reinert & Freie Universität Berlin
3// Copyright (c) 2016-2021, 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
30
31namespace seqan3::detail
32{
33
46template <typename format_type>
47struct sam_file_output_format_exposer : public format_type
48{
49public:
50 // Can't use `using format_type::write_alignment_record` as it produces a hard failure in the format concept check
51 // for types that do not model the format concept, i.e. don't offer the proper write_alignment_record interface.
53 template <typename ...ts>
54 void write_alignment_record(ts && ...args)
55 {
56 format_type::write_alignment_record(std::forward<ts>(args)...);
57 }
58};
59
60} // namespace seqan3::detail
61
62namespace seqan3
63{
64
77template <typename t>
79 requires (detail::sam_file_output_format_exposer<t> & v,
80 std::ofstream & stream,
81 sam_file_output_options & options,
82 sam_file_header<> & header,
83 dna5_vector & seq,
85 std::string & id,
86 int32_t & offset,
87 dna5_vector & ref_seq,
89 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{
99 t::file_extensions;
100
101 SEQAN3_RETURN_TYPE_CONSTRAINT(v.write_alignment_record(stream,
102 options,
103 header,
104 seq,
105 qual,
106 id,
107 offset,
108 ref_seq,
109 ref_id,
110 ref_offset,
111 align,
112 cigar,
113 flag,
114 mapq,
115 mate,
116 tag_dict,
117 e_value,
118 bit_score),
119 std::same_as, void);
120};
122
189
190} // namespace seqan3
191
192namespace seqan3::detail
193{
194
200template <typename t>
202
208template <typename ...ts>
210
216template <typename t>
217concept type_list_of_sam_file_output_formats = is_type_list_of_sam_file_output_formats_v<t>;
218} // namespace seqan3::detail
Provides aliases for qualified.
Provides the seqan3::cigar alphabet.
Auxiliary concept that checks whether a type is a seqan3::type_list and all types meet seqan3::sam_fi...
Definition: output_format_concept.hpp:217
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_output_formats_v
Auxiliary value metafuncton that checks whether a type is a seqan3::type_list and all types meet seqa...
Definition: output_format_concept.hpp:201
Provides the seqan3::sam_file_header class.
The generic concept for alignment file out formats.
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.
#define SEQAN3_RETURN_TYPE_CONSTRAINT(expression, concept_name,...)
Same as writing {expression} -> concept_name<type1[, ...]> in a concept definition.
Definition: platform.hpp:77
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.
Internal class used to expose the actual format interface to write alignment records into the file.
Definition: output_format_concept.hpp:48
void write_alignment_record(ts &&...args)
Forwards to the seqan3::sam_file_output_format::write_alignment_record interface.
Definition: output_format_concept.hpp:54
Type that contains multiple types.
Definition: type_list.hpp:29
Provides seqan3::type_list.