SeqAn3 3.4.0-rc.1
The Modern C++ library for sequence analysis.
Loading...
Searching...
No Matches
sequence_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 <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 {
78 v.write_sequence_record(f, options, seq, id, qual)
79 } -> std::same_as<void>;
80 {
81 v.write_sequence_record(f, options, std::ignore, id, std::ignore)
82 } -> std::same_as<void>;
83 {
84 v.write_sequence_record(f, options, std::ignore, std::ignore, std::ignore)
85 } -> std::same_as<void>;
86 // the last is required to be compile time valid, but should always throw at run-time.
87 };
89
90// Workaround for https://github.com/doxygen/doxygen/issues/9379
91#if SEQAN3_DOXYGEN_ONLY(1) 0
92template <typename t>
95#endif
96
131
132} // namespace seqan3
133
134namespace seqan3::detail
135{
136
142template <typename t>
143constexpr bool is_type_list_of_sequence_file_output_formats_v = false;
144
150template <typename... ts>
151constexpr bool is_type_list_of_sequence_file_output_formats_v<type_list<ts...>> =
152 (sequence_file_output_format<ts> && ...);
153
159template <typename t>
160concept type_list_of_sequence_file_output_formats = is_type_list_of_sequence_file_output_formats_v<t>;
161} // namespace seqan3::detail
Provides aliases for qualified.
The generic concept for sequence file out formats.
Definition sequence_file/output_format_concept.hpp:94
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