SeqAn3  3.2.0
The Modern C++ library for sequence analysis.
structure_file/output_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 
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 
71 template <typename t>
73  requires (detail::structure_file_output_format_exposer<t> & v,
74  std::ofstream & f,
75  structure_file_output_options & options,
76  rna5_vector & seq,
77  std::string & id,
79  std::vector<wuss51> & structure,
80  std::vector<structured_rna<rna5, wuss51>> & structured_seq,
81  double energy,
82  double react,
83  double react_err,
84  std::string & comment,
85  size_t offset) {
86  t::file_extensions;
87 
88  {
89  v.write_structure_record(f, options, seq, id, bpp, structure, energy, react, react_err, comment, offset)
90  } -> std::same_as<void>;
91 
92  {
93  v.write_structure_record(f,
94  options,
95  seq,
96  id,
97  bpp,
98  std::ignore,
99  std::ignore,
100  std::ignore,
101  std::ignore,
102  std::ignore,
103  std::ignore)
104  } -> std::same_as<void>;
105 
106  {
107  v.write_structure_record(f,
108  options,
109  structured_seq,
110  id,
111  std::ignore,
112  structured_seq,
113  energy,
114  std::ignore,
115  std::ignore,
116  std::ignore,
117  std::ignore)
118  } -> std::same_as<void>;
119 
120  {
121  v.write_structure_record(f,
122  options,
123  std::ignore,
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::same_as<void>;
133  // the last is required to be compile time valid, but should always throw at run-time.
134  };
136 
196 
197 } // namespace seqan3
198 
199 namespace seqan3::detail
200 {
201 
207 template <typename t>
208 constexpr bool is_type_list_of_structure_file_output_formats_v = false;
209 
215 template <typename... ts>
216 constexpr bool is_type_list_of_structure_file_output_formats_v<type_list<ts...>> =
218 
224 template <typename t>
225 concept type_list_of_structure_file_output_formats = is_type_list_of_structure_file_output_formats_v<t>;
226 } // namespace seqan3::detail
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 structure file out formats.
The main SeqAn3 namespace.
Definition: aligned_sequence_concept.hpp:29
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.