SeqAn3 3.2.0-rc.1
The Modern C++ library for sequence analysis.
input_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
14#pragma once
15
16#include <fstream>
17#include <string>
18#include <vector>
19
25
26namespace seqan3::detail
27{
28
39template <typename format_type>
40struct sequence_file_input_format_exposer : public format_type
41{
42public:
43
44 // Can't use `using format_type::read_sequence_record` as it produces a hard failure in the format concept check
45 // for types that do not model the format concept, i.e. don't offer the proper read_sequence_record interface.
47 template <typename ...ts>
48 void read_sequence_record(ts && ...args)
49 {
50 format_type::read_sequence_record(std::forward<ts>(args)...);
51 }
52};
53
54} // namespace seqan3::detail
55
56namespace seqan3
57{
58
72template <typename t>
73concept sequence_file_input_format = requires (detail::sequence_file_input_format_exposer<t> & v,
74 std::ifstream & f,
75 sequence_file_input_options<dna5> & options,
76 std::streampos & position_buffer,
78 std::string & id,
81{
82 t::file_extensions;
83
84 {v.read_sequence_record(f, options, position_buffer, seq, id, qual)} -> std::same_as<void>;
85 {v.read_sequence_record(f, options, position_buffer, seq_qual, id, seq_qual)} -> std::same_as<void>;
86 {v.read_sequence_record(f, options, position_buffer, std::ignore, std::ignore, std::ignore)} -> std::same_as<void>;
87};
89
130
131} // namespace seqan3
132
133namespace seqan3::detail
134{
135
141template <typename t>
143
149template <typename ...ts>
152
158template <typename t>
159concept type_list_of_sequence_file_input_formats = is_type_list_of_sequence_file_input_formats_v<t>;
160} // namespace seqan3::detail
Auxiliary concept that checks whether a type is a seqan3::type_list and all types meet seqan3::sequen...
Definition: input_format_concept.hpp:159
Provides seqan3::dna5, container aliases and string literals.
constexpr bool is_type_list_of_sequence_file_input_formats_v
Auxiliary value metafuncton that checks whether a type is a seqan3::type_list and all types meet seqa...
Definition: input_format_concept.hpp:142
The generic concept for sequence file in formats.
void read_sequence_record(stream_type &stream, seqan3::sequence_file_input_options const &options, stream_pos_type &position_buffer, seq_type &sequence, id_type &id, qual_type &qualities)
Read from the specified stream and back-insert into the given field buffers.
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.
Provides quality alphabet composites.
Provides seqan3::sequence_file_input_options.
Internal class used to expose the actual format interface to read sequence records from the file.
Definition: input_format_concept.hpp:41
void read_sequence_record(ts &&...args)
Forwards to the seqan3::sequence_file_input_format::read_sequence_record interface.
Definition: input_format_concept.hpp:48
Type that contains multiple types.
Definition: type_list.hpp:29
Provides seqan3::type_list.