SeqAn3  3.0.1
The Modern C++ library for sequence analysis.
output_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 <vector>
19 
24 
25 namespace seqan3::detail
26 {
27 
38 template <typename format_type>
39 struct structure_file_output_format_exposer : public format_type
40 {
41 public:
42  // Can't use `using format_type::write_structure_record` as it produces a hard failure in the format concept check
43  // for types that do not model the format concept, i.e. don't offer the proper write_structure_record interface.
45  template <typename ...ts>
46  void write_structure_record(ts && ...args)
47  {
48  format_type::write_structure_record(std::forward<ts>(args)...);
49  }
50 };
51 
52 } // namespace seqan3::detail
53 
54 namespace seqan3
55 {
56 
67 template <typename t>
69 SEQAN3_CONCEPT structure_file_output_format = requires(detail::structure_file_output_format_exposer<t> & v,
70  std::ofstream & f,
71  structure_file_output_options & options,
72  rna5_vector & seq,
73  std::string & id,
75  std::vector<wuss51> & structure,
76  std::vector<structured_rna<rna5, wuss51>> & structured_seq,
77  double energy,
78  double react,
79  double react_err,
80  std::string & comment,
81  size_t offset)
82 {
83  t::file_extensions;
84 
85  { v.write_structure_record(f, options, seq, id, bpp, structure,
86  energy, react, react_err, comment, offset) } -> void;
87  { v.write_structure_record(f, options, seq, id, bpp, std::ignore,
88  std::ignore, std::ignore, std::ignore, std::ignore, std::ignore) } -> void;
89  { v.write_structure_record(f, options, structured_seq, id, std::ignore, structured_seq,
90  energy, std::ignore, std::ignore, std::ignore, std::ignore) } -> void;
91  { v.write_structure_record(f, options, std::ignore, std::ignore, std::ignore, std::ignore,
92  std::ignore, std::ignore, std::ignore, std::ignore, std::ignore) } -> void;
93  // the last is required to be compile time valid, but should always throw at run-time.
94 };
96 
155 
157 } // namespace seqan3
158 
159 namespace seqan3::detail
160 {
161 
167 template <typename t>
168 constexpr bool is_type_list_of_structure_file_output_formats_v = false;
169 
175 template <typename ...ts>
176 constexpr bool is_type_list_of_structure_file_output_formats_v<type_list<ts...>>
178 
184 template <typename t>
185 SEQAN3_CONCEPT type_list_of_structure_file_output_formats = is_type_list_of_structure_file_output_formats_v<t>;
186 } // namespace seqan3::detail
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
std::pair
vector
seqan3::seq
constexpr sequenced_policy seq
Global execution policy object for sequenced execution policy.
Definition: execution.hpp:54
all.hpp
Meta-header for the structure module. It includes all headers from alphabet/structure/.
output_options.hpp
Provides seqan3::structure_file_output_options.
std::ofstream
structure_file_output_format::write_structure_record
void write_structure_record(stream_type &stream, structure_file_output_options 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)
Write the given fields to the specified stream.
seqan3
The main SeqAn3 namespace.
Definition: aligned_sequence_concept.hpp:36
structure_file_output_format
The generic concept for structure file out formats.
rna5.hpp
Provides seqan3::rna5, container aliases and string literals.
set
type_list.hpp
Provides seqan3::type_list.
string