SeqAn3 3.2.0-rc.1
The Modern C++ library for sequence analysis.
output_format_concept.hpp
Go to the documentation of this file.
1// -----------------------------------------------------------------------------------------------------
2// Copyright (c) 2006-2021, Knut Reinert & Freie Universität Berlin
3// Copyright (c) 2016-2021, 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
26namespace seqan3::detail
27{
28
39template <typename format_type>
40struct structure_file_output_format_exposer : public format_type
41{
42public:
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
55namespace seqan3
56{
57
71template <typename t>
72concept structure_file_output_format = requires(detail::structure_file_output_format_exposer<t> & v,
73 std::ofstream & f,
74 structure_file_output_options & options,
75 rna5_vector & seq,
76 std::string & id,
78 std::vector<wuss51> & structure,
80 double energy,
81 double react,
82 double react_err,
83 std::string & comment,
84 size_t offset)
85{
86 t::file_extensions;
87
89 options,
90 seq,
91 id,
92 bpp,
93 structure,
94 energy,
95 react,
96 react_err,
97 comment,
98 offset)} -> std::same_as<void>;
99
100 {v.write_structure_record(f,
101 options,
102 seq,
103 id,
104 bpp,
105 std::ignore,
106 std::ignore,
107 std::ignore,
108 std::ignore,
109 std::ignore,
110 std::ignore)} -> std::same_as<void>;
111
112 {v.write_structure_record(f,
113 options,
114 structured_seq,
115 id,
116 std::ignore,
117 structured_seq,
118 energy,
119 std::ignore,
120 std::ignore,
121 std::ignore,
122 std::ignore)} -> std::same_as<void>;
123
124 {v.write_structure_record(f,
125 options,
126 std::ignore,
127 std::ignore,
128 std::ignore,
129 std::ignore,
130 std::ignore,
131 std::ignore,
132 std::ignore,
133 std::ignore,
134 std::ignore)} -> std::same_as<void>;
135 // the last is required to be compile time valid, but should always throw at run-time.
136};
138
198
199} // namespace seqan3
200
201namespace seqan3::detail
202{
203
209template <typename t>
211
217template <typename ...ts>
220
226template <typename t>
227concept type_list_of_structure_file_output_formats = is_type_list_of_structure_file_output_formats_v<t>;
228} // namespace seqan3::detail
Auxiliary concept that checks whether a type is a seqan3::type_list and all types meet seqan3::struct...
Definition: output_format_concept.hpp:227
constexpr bool is_type_list_of_structure_file_output_formats_v
Auxiliary value metafuncton that checks whether a type is a seqan3::type_list and all types meet seqa...
Definition: output_format_concept.hpp:210
The generic concept for structure file out formats.
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.
The internal SeqAn3 namespace.
Definition: aligned_sequence_concept.hpp:29
The main SeqAn3 namespace.
Definition: aligned_sequence_concept.hpp:29
Provides seqan3::rna5, container aliases and string literals.
Internal class used to expose the actual format interface to write structure records into the file.
Definition: output_format_concept.hpp:41
void write_structure_record(ts &&...args)
Forwards to the seqan3::structure_file_output_format::write_structure_record interface.
Definition: output_format_concept.hpp:47
Type that contains multiple types.
Definition: type_list.hpp:29
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.