SeqAn3 3.4.0-rc.4
The Modern C++ library for sequence analysis.
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages Concepts
sequence_file/output_format_concept.hpp
Go to the documentation of this file.
1// SPDX-FileCopyrightText: 2006-2025 Knut Reinert & Freie Universität Berlin
2// SPDX-FileCopyrightText: 2016-2025 Knut Reinert & MPI für molekulare Genetik
3// SPDX-License-Identifier: BSD-3-Clause
4
10#pragma once
11
12#include <fstream>
13#include <string>
14#include <vector>
15
21
22namespace seqan3::detail
23{
24
37template <typename format_type>
38struct sequence_file_output_format_exposer : public format_type
39{
40public:
41 // Can't use `using format_type::write_sequence_record` as it produces a hard failure in the format concept check
42 // for types that do not model the format concept, i.e. don't offer the proper write_sequence_record interface.
44 template <typename... ts>
45 void write_sequence_record(ts &&... args)
46 {
47 format_type::write_sequence_record(std::forward<ts>(args)...);
48 }
49};
50
51} // namespace seqan3::detail
52
53namespace seqan3
54{
55
67template <typename t>
68concept sequence_file_output_format = requires (detail::sequence_file_output_format_exposer<t> & v,
69 std::ofstream & f,
70 sequence_file_output_options & options,
71 dna5_vector & seq,
74 std::vector<dna5q> & seq_qual) {
75 t::file_extensions;
76
77 { v.write_sequence_record(f, options, seq, id, qual) } -> std::same_as<void>;
78 { v.write_sequence_record(f, options, std::ignore, id, std::ignore) } -> std::same_as<void>;
79 // This one is required to be a valid call, but should always throw at run-time.
80 { v.write_sequence_record(f, options, std::ignore, std::ignore, std::ignore) } -> std::same_as<void>;
81};
83
84// Workaround for https://github.com/doxygen/doxygen/issues/9379
85#if SEQAN3_DOXYGEN_ONLY(1) 0
86template <typename t>
89#endif
90
125
126} // namespace seqan3
127
128namespace seqan3::detail
129{
130
136template <typename t>
137constexpr bool is_type_list_of_sequence_file_output_formats_v = false;
138
144template <typename... ts>
145constexpr bool is_type_list_of_sequence_file_output_formats_v<type_list<ts...>> =
146 (sequence_file_output_format<ts> && ...);
147
153template <typename t>
154concept type_list_of_sequence_file_output_formats = is_type_list_of_sequence_file_output_formats_v<t>;
155} // namespace seqan3::detail
Provides aliases for qualified.
The generic concept for sequence file out formats.
Definition sequence_file/output_format_concept.hpp:88
Provides seqan3::dna5, container aliases and string literals.
@ 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.
The main SeqAn3 namespace.
Definition aligned_sequence_concept.hpp:26
Provides seqan3::phred42 quality scores.
Provides seqan3::sequence_file_output_options.
Provides seqan3::type_list.
Hide me