SeqAn3  3.0.1
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 <set>
17 #include <string>
18 #include <utility>
19 #include <vector>
20 
26 
27 namespace seqan3::detail
28 {
29 
40 template <typename format_type>
41 struct structure_file_input_format_exposer : public format_type
42 {
43 public:
44  // Can't use `using format_type::read_structure_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_structure_record interface.
47  template <typename ...ts>
48  void read_structure_record(ts && ...args)
49  {
50  format_type::read_structure_record(std::forward<ts>(args)...);
51  }
52 };
53 
54 } // namespace seqan3::detail
55 
56 namespace seqan3
57 {
58 
69 template <typename t>
71 SEQAN3_CONCEPT structure_file_input_format = requires(detail::structure_file_input_format_exposer<t> & v,
72  std::ifstream & f,
73  structure_file_input_options<rna5, false> & options,
74  rna5_vector & seq,
75  std::string & id,
77  std::vector<wuss51> & structure,
78  std::vector<structured_rna<rna5, wuss51>> & structured_seq,
79  double energy,
80  double react,
81  double react_err,
82  std::string & comment,
83  size_t offset)
84 {
85  t::file_extensions;
86 
87  { v.read_structure_record(f, options, seq, id, bpp, structure,
88  energy, react, react_err, comment, offset) } -> void;
89 
90  { v.read_structure_record(f, options, seq, id, bpp, std::ignore,
91  std::ignore, std::ignore, std::ignore, std::ignore, std::ignore) } -> void;
92 
93  { v.read_structure_record(f, options, structured_seq, id, std::ignore, structured_seq,
94  energy, std::ignore, std::ignore, std::ignore, std::ignore) } -> void;
95 
96  { v.read_structure_record(f, options, std::ignore, std::ignore, std::ignore, std::ignore,
97  std::ignore, std::ignore, std::ignore, std::ignore, std::ignore) } -> void;
98  // the last is required to be compile time valid, but should always throw at run-time.
99 };
101 
161 
163 } // namespace seqan3
164 
165 namespace seqan3::detail
166 {
167 
173 template <typename t>
174 constexpr bool is_type_list_of_structure_file_input_formats_v = false;
175 
181 template <typename ...ts>
182 constexpr bool is_type_list_of_structure_file_input_formats_v<type_list<ts...>>
184 
190 template <typename t>
191 SEQAN3_CONCEPT type_list_of_structure_file_input_formats = is_type_list_of_structure_file_input_formats_v<t>;
192 } // namespace seqan3::detail
wuss.hpp
Provides the WUSS format for RNA structure.
structure_file_input_format::read_structure_record
void read_structure_record(stream_type &stream, structure_file_input_options< seq_legal_alph_type, structured_seq_combined > const &options, seq_type &seq, id_type &id, bpp_type &bpp, structure_type &structure, energy_type &energy, react_type &react, react_type &react_err, comment_type &comment, offset_type &offset)
Read from the specified stream and back-insert into the given field buffers.
fstream
std::string
utility
seqan3::type_list
meta::list< types... > type_list
Type that contains multiple types, an alias for meta::list.
Definition: type_list.hpp:31
std::pair
vector
structure_file_input_format
The generic concept for structure file in formats.
seqan3::seq
constexpr sequenced_policy seq
Global execution policy object for sequenced execution policy.
Definition: execution.hpp:54
input_options.hpp
Provides seqan3::structure_file_input_options.
seqan3
The main SeqAn3 namespace.
Definition: aligned_sequence_concept.hpp:36
rna5.hpp
Provides seqan3::rna5, container aliases and string literals.
structured_rna.hpp
Provides the composite of nucleotide with structure alphabets.
set
type_list.hpp
Provides seqan3::type_list.
std::ifstream
string