SeqAn3  3.0.2
The Modern C++ library for sequence analysis.
input_format_concept.hpp
Go to the documentation of this file.
1 // -----------------------------------------------------------------------------------------------------
2 // Copyright (c) 2006-2020, Knut Reinert & Freie Universität Berlin
3 // Copyright (c) 2016-2020, 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 
13 #pragma once
14 
15 #include <fstream>
16 #include <string>
17 #include <vector>
18 
30 
31 namespace seqan3::detail
32 {
33 
44 template <typename format_type>
45 struct alignment_file_input_format_exposer : public format_type
46 {
47 public:
48  // Can't use `using format_type::read_alignment_record` as it produces a hard failure in the format concept check
49  // for types that do not model the format concept, i.e. don't offer the proper read_alignment_record interface.
51  template <typename ...ts>
52  void read_alignment_record(ts && ...args)
53  {
54  format_type::read_alignment_record(std::forward<ts>(args)...);
55  }
56 };
57 
58 } // namespace seqan3::detail
59 
60 namespace seqan3
61 {
62 
73 template <typename t>
75 SEQAN3_CONCEPT alignment_file_input_format =
76  requires (detail::alignment_file_input_format_exposer<t> & v,
77  std::ifstream & stream,
78  alignment_file_input_options<dna5> & options,
79  std::vector<dna5_vector> & ref_sequences,
80  alignment_file_header<> & header,
81  dna5_vector & seq,
82  std::vector<phred42> & qual,
83  std::string & id,
84  int32_t & offset,
85  dna5_vector & ref_seq,
86  std::optional<int32_t> & ref_id,
87  std::optional<int32_t> & ref_offset,
88  std::pair<std::vector<gapped<dna4>>, std::vector<gapped<dna4>>> & align,
89  std::vector<cigar> & cigar,
90  sam_flag & flag,
91  uint8_t & mapq,
93  sam_tag_dictionary & tag_dict,
94  double & e_value,
95  double & bit_score)
96 {
97  t::file_extensions;
98  // std::same_as<decltype(t::file_extensions), std::vector<std::string>>;
99 
100  { v.read_alignment_record(stream,
101  options,
102  ref_sequences,
103  header,
104  seq,
105  qual,
106  id,
107  offset,
108  ref_seq,
109  ref_id,
110  ref_offset,
111  align,
112  cigar,
113  flag,
114  mapq,
115  mate,
116  tag_dict,
117  e_value,
118  bit_score)};
119 
120  { v.read_alignment_record(stream,
121  options,
122  std::ignore,
123  header,
124  std::ignore,
125  std::ignore,
126  std::ignore,
127  std::ignore,
128  std::ignore,
129  std::ignore,
130  std::ignore,
131  std::ignore,
132  std::ignore,
133  std::ignore,
134  std::ignore,
135  std::ignore,
136  std::ignore,
137  std::ignore,
138  std::ignore)};
139 };
141 
217 
219 } // namespace seqan3
220 
221 namespace seqan3::detail
222 {
223 
229 template <typename t>
230 constexpr bool is_type_list_of_alignment_file_input_formats_v = false;
231 
237 template <typename ...ts>
238 constexpr bool is_type_list_of_alignment_file_input_formats_v<type_list<ts...>> =
240 
246 template <typename t>
247 SEQAN3_CONCEPT type_list_of_alignment_file_input_formats = is_type_list_of_alignment_file_input_formats_v<t>;
248 
249 } // namespace seqan3::detail
misc.hpp
Provides helper data structures for the seqan3::alignment_file_output.
dna4.hpp
Provides seqan3::dna4, container aliases and string literals.
fstream
std::string
seqan3::type_list
meta::list< types... > type_list
Type that contains multiple types, an alias for meta::list.
Definition: type_list.hpp:31
sam_tag_dictionary.hpp
Provides the seqan3::sam_tag_dictionary class and auxiliaries.
std::pair
vector
seqan3::sam_flag
sam_flag
An enum flag that describes the properties of an aligned read (given as a SAM record).
Definition: misc.hpp:71
std::tuple
alignment_file_input_format
The generic concept for alignment file input formats.
seqan3::seq
constexpr sequenced_policy seq
Global execution policy object for sequenced execution policy.
Definition: execution.hpp:54
gapped.hpp
Provides seqan3::gapped.
dna5.hpp
Provides seqan3::dna5, container aliases and string literals.
header.hpp
Provides the seqan3::alignment_file_header class.
seqan3
The main SeqAn3 namespace.
Definition: aligned_sequence_concept.hpp:29
cigar.hpp
Provides the seqan3::cigar alphabet.
aliases.hpp
Provides aliases for qualified.
std::optional
alignment_file_input_format::read_alignment_record
void read_alignment_record(stream_type &stream, alignment_file_input_options< seq_legal_alph_type > const &options, ref_seqs_type &ref_seqs, header_type &header, seq_type &seq, qual_type &qual, id_type &id, offset_type &offset, ref_seq_type &ref_seq, ref_id_type &ref_id, ref_offset_type &ref_offset, align_type &align, cigar_type &cigar_vector, flag_type &flag, mapq_type &mapq, mate_type &mate, tag_dict_type &tag_dict, e_value_type &e_value, bit_score_type &bit_score)
Read from the specified stream and back-insert into the given field buffers.
input_options.hpp
Provides seqan3::alignment_file_input_options.
phred42.hpp
Provides seqan3::phred42 quality scores.
type_list.hpp
Provides seqan3::type_list.
std::ifstream
string