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,
76  std::vector<structured_rna<rna5, wuss51>> & structured_seq,
77  double energy,
78  double react,
79  double react_err,
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...>>
177  = (structure_file_output_format<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
meta::list< types... > type_list
Type that contains multiple types, an alias for meta::list.
Definition: type_list.hpp:31
Base pair probability matrix of interactions, usually a matrix of float numbers.
Meta-header for the structure module. It includes all headers from alphabet/structure/.
The main SeqAn3 namespace.
The "sequence", usually a range of nucleotides or amino acids.
Provides seqan3::rna5, container aliases and string literals.
Energy of a folded sequence, represented by one float number.
Provides seqan3::structure_file_output_options.
Provides seqan3::type_list.
Comment field of arbitrary content, usually a string.
Reactivity error values given in a vector corresponding to REACT.
Sequence and fixed interactions combined in one range.
Definition: aligned_sequence_concept.hpp:36
Sequence (SEQ) relative start position (0-based), unsigned value.
Fixed interactions, usually a string of structure alphabet characters.
Reactivity values of the sequence characters given in a vector of float numbers.