SeqAn3  3.0.3
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 
25 
26 namespace seqan3::detail
27 {
28 
39 template <typename format_type>
40 struct structure_file_output_format_exposer : public format_type
41 {
42 public:
43  // Can't use `using format_type::write_structure_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 write_structure_record interface.
46  template <typename ...ts>
47  void write_structure_record(ts && ...args)
48  {
49  format_type::write_structure_record(std::forward<ts>(args)...);
50  }
51 };
52 
53 } // namespace seqan3::detail
54 
55 namespace seqan3
56 {
57 
69 template <typename t>
70 SEQAN3_CONCEPT structure_file_output_format = requires(detail::structure_file_output_format_exposer<t> & v,
71  std::ofstream & f,
72  structure_file_output_options & options,
73  rna5_vector & seq,
74  std::string & id,
76  std::vector<wuss51> & structure,
77  std::vector<structured_rna<rna5, wuss51>> & structured_seq,
78  double energy,
79  double react,
80  double react_err,
81  std::string & comment,
82  size_t offset)
83 {
84  t::file_extensions;
85 
86  SEQAN3_RETURN_TYPE_CONSTRAINT(v.write_structure_record(f,
87  options,
88  seq,
89  id,
90  bpp,
91  structure,
92  energy,
93  react,
94  react_err,
95  comment,
96  offset),
97  std::same_as, void);
98  SEQAN3_RETURN_TYPE_CONSTRAINT(v.write_structure_record(f,
99  options,
100  seq,
101  id,
102  bpp,
103  std::ignore,
104  std::ignore,
105  std::ignore,
106  std::ignore,
107  std::ignore,
108  std::ignore),
109  std::same_as, void);
110  SEQAN3_RETURN_TYPE_CONSTRAINT(v.write_structure_record(f,
111  options,
112  structured_seq,
113  id,
114  std::ignore,
115  structured_seq,
116  energy,
117  std::ignore,
118  std::ignore,
119  std::ignore,
120  std::ignore),
121  std::same_as, void);
122  SEQAN3_RETURN_TYPE_CONSTRAINT(v.write_structure_record(f,
123  options,
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::same_as, void);
134  // the last is required to be compile time valid, but should always throw at run-time.
135 };
137 
197 
198 } // namespace seqan3
199 
200 namespace seqan3::detail
201 {
202 
208 template <typename t>
209 constexpr bool is_type_list_of_structure_file_output_formats_v = false;
210 
216 template <typename ...ts>
217 constexpr bool is_type_list_of_structure_file_output_formats_v<type_list<ts...>>
219 
225 template <typename t>
226 SEQAN3_CONCEPT type_list_of_structure_file_output_formats = is_type_list_of_structure_file_output_formats_v<t>;
227 } // namespace seqan3::detail
meta::list< types... > type_list
Type that contains multiple types, an alias for meta::list.
Definition: type_list.hpp:31
The generic concept for structure file out formats.
The main SeqAn3 namespace.
Definition: aligned_sequence_concept.hpp:29
#define SEQAN3_RETURN_TYPE_CONSTRAINT(expression, concept_name,...)
Same as writing {expression} -> concept_name<type1[, ...]> in a concept definition.
Definition: platform.hpp:57
Provides seqan3::rna5, container aliases and string literals.
Provides seqan3::structure_file_output_options.
Provides the composite of nucleotide with structure alphabets.
Provides seqan3::type_list.
Provides the WUSS format for RNA structure.