SeqAn3 3.4.0-rc.3
The Modern C++ library for sequence analysis.
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages Concepts
sequence_file/input_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
11#pragma once
12
13#include <fstream>
14#include <string>
15#include <vector>
16
22
23namespace seqan3::detail
24{
25
36template <typename format_type>
37struct sequence_file_input_format_exposer : public format_type
38{
39public:
40 // Can't use `using format_type::read_sequence_record` as it produces a hard failure in the format concept check
41 // for types that do not model the format concept, i.e. don't offer the proper read_sequence_record interface.
43 template <typename... ts>
44 void read_sequence_record(ts &&... args)
45 {
46 format_type::read_sequence_record(std::forward<ts>(args)...);
47 }
48};
49
50} // namespace seqan3::detail
51
52namespace seqan3
53{
54
68template <typename t>
69concept sequence_file_input_format = requires (detail::sequence_file_input_format_exposer<t> & v,
70 std::ifstream & f,
71 sequence_file_input_options<dna5> & options,
72 std::streampos & position_buffer,
77 t::file_extensions;
78
79 { v.read_sequence_record(f, options, position_buffer, seq, id, qual) } -> std::same_as<void>;
80 { v.read_sequence_record(f, options, position_buffer, seq_qual, id, seq_qual) } -> std::same_as<void>;
81 {
82 v.read_sequence_record(f, options, position_buffer, std::ignore, std::ignore, std::ignore)
83 } -> std::same_as<void>;
84};
86
87// Workaround for https://github.com/doxygen/doxygen/issues/9379
88#if SEQAN3_DOXYGEN_ONLY(1) 0
89template <typename t>
92#endif
93
134
135} // namespace seqan3
136
137namespace seqan3::detail
138{
139
145template <typename t>
146constexpr bool is_type_list_of_sequence_file_input_formats_v = false;
147
153template <typename... ts>
154constexpr bool is_type_list_of_sequence_file_input_formats_v<type_list<ts...>> =
155 (sequence_file_input_format<ts> && ...);
156
162template <typename t>
163concept type_list_of_sequence_file_input_formats = is_type_list_of_sequence_file_input_formats_v<t>;
164} // namespace seqan3::detail
The generic concept for sequence file in formats.
Definition sequence_file/input_format_concept.hpp:91
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 quality alphabet composites.
Provides seqan3::sequence_file_input_options.
Provides seqan3::type_list.
Hide me