SeqAn3 3.1.0-rc.2
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 <string>
17#include <vector>
18
29
30namespace seqan3::detail
31{
32
43template <typename format_type>
44struct sam_file_output_format_exposer : public format_type
45{
46public:
47 // Can't use `using format_type::write_alignment_record` as it produces a hard failure in the format concept check
48 // for types that do not model the format concept, i.e. don't offer the proper write_alignment_record interface.
50 template <typename ...ts>
51 void write_alignment_record(ts && ...args)
52 {
53 format_type::write_alignment_record(std::forward<ts>(args)...);
54 }
55};
56
57} // namespace seqan3::detail
58
59namespace seqan3
60{
61
74template <typename t>
75SEQAN3_CONCEPT sam_file_output_format =
76 requires (detail::sam_file_output_format_exposer<t> & v,
77 std::ofstream & stream,
78 sam_file_output_options & options,
79 sam_file_header<> & header,
80 dna5_vector & seq,
83 int32_t & offset,
84 dna5_vector & ref_seq,
89 sam_flag & flag,
90 uint8_t & mapq,
92 sam_tag_dictionary & tag_dict,
93 double & e_value,
94 double & bit_score)
95{
96 t::file_extensions;
97
98 SEQAN3_RETURN_TYPE_CONSTRAINT(v.write_alignment_record(stream,
99 options,
100 header,
101 seq,
102 qual,
103 id,
104 offset,
105 ref_seq,
106 ref_id,
107 ref_offset,
108 align,
109 cigar,
110 flag,
111 mapq,
112 mate,
113 tag_dict,
114 e_value,
115 bit_score),
116 std::same_as, void);
117};
119
186
187} // namespace seqan3
188
189namespace seqan3::detail
190{
191
197template <typename t>
198constexpr bool is_type_list_of_sam_file_output_formats_v = false;
199
205template <typename ...ts>
206constexpr bool is_type_list_of_sam_file_output_formats_v<type_list<ts...>> = (sam_file_output_format<ts> && ...);
207
213template <typename t>
214SEQAN3_CONCEPT type_list_of_sam_file_output_formats = is_type_list_of_sam_file_output_formats_v<t>;
215} // namespace seqan3::detail
Provides aliases for qualified.
T align(T... args)
Provides the seqan3::cigar alphabet.
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:74
@ 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.
@ offset
Sequence (seqan3::field::seq) relative start position (0-based), 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 generic concept for alignment file out formats.
The main SeqAn3 namespace.
Definition: cigar_operation_table.hpp:2
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:57
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.