SeqAn3  3.2.0-rc.1
The Modern C++ library for sequence analysis.
sequence_file/input_format_concept.hpp
Go to the documentation of this file.
1 // -----------------------------------------------------------------------------------------------------
2 // Copyright (c) 2006-2022, Knut Reinert & Freie Universität Berlin
3 // Copyright (c) 2016-2022, 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 
26 namespace seqan3::detail
27 {
28 
39 template <typename format_type>
40 struct sequence_file_input_format_exposer : public format_type
41 {
42 public:
43  // Can't use `using format_type::read_sequence_record` as it produces a hard failure in the format concept check
44  // for types that do not model the format concept, i.e. don't offer the proper read_sequence_record interface.
46  template <typename... ts>
47  void read_sequence_record(ts &&... args)
48  {
49  format_type::read_sequence_record(std::forward<ts>(args)...);
50  }
51 };
52 
53 } // namespace seqan3::detail
54 
55 namespace seqan3
56 {
57 
71 template <typename t>
73  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,
77  std::vector<dna5> & seq,
78  std::string & id,
79  std::vector<phred42> & qual,
80  std::vector<qualified<dna5, phred42>> & seq_qual) {
81  t::file_extensions;
82 
83  {
84  v.read_sequence_record(f, options, position_buffer, seq, id, qual)
85  } -> std::same_as<void>;
86  {
87  v.read_sequence_record(f, options, position_buffer, seq_qual, id, seq_qual)
88  } -> std::same_as<void>;
89  {
90  v.read_sequence_record(f, options, position_buffer, std::ignore, std::ignore, std::ignore)
91  } -> std::same_as<void>;
92  };
94 
135 
136 } // namespace seqan3
137 
138 namespace seqan3::detail
139 {
140 
146 template <typename t>
147 constexpr bool is_type_list_of_sequence_file_input_formats_v = false;
148 
154 template <typename... ts>
155 constexpr bool is_type_list_of_sequence_file_input_formats_v<type_list<ts...>> =
157 
163 template <typename t>
164 concept type_list_of_sequence_file_input_formats = is_type_list_of_sequence_file_input_formats_v<t>;
165 } // namespace seqan3::detail
Provides seqan3::dna5, container aliases and string literals.
requires requires
The rank_type of the semi-alphabet; defined as the return type of seqan3::to_rank....
Definition: alphabet/concept.hpp:164
The generic concept for sequence file in formats.
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.
Provides seqan3::type_list.