SeqAn3 3.4.0-rc.4
The Modern C++ library for sequence analysis.
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages Concepts
structure_file/output_format_concept.hpp
Go to the documentation of this file.
1// SPDX-FileCopyrightText: 2006-2025 Knut Reinert & Freie Universität Berlin
2// SPDX-FileCopyrightText: 2016-2025 Knut Reinert & MPI für molekulare Genetik
3// SPDX-License-Identifier: BSD-3-Clause
4
10#pragma once
11
12#include <fstream>
13#include <set>
14#include <string>
15#include <vector>
16
22
23namespace seqan3::detail
24{
25
36template <typename format_type>
37struct structure_file_output_format_exposer : public format_type
38{
39public:
40 // Can't use `using format_type::write_structure_record` as it produces a hard failure in the format concept check
41 // for types that do not model the format concept, i.e. don't offer the proper write_structure_record interface.
43 template <typename... ts>
44 void write_structure_record(ts &&... args)
45 {
46 format_type::write_structure_record(std::forward<ts>(args)...);
47 }
48};
49
50} // namespace seqan3::detail
51
52namespace seqan3
53{
54
68template <typename t>
69concept 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,
77 double energy,
78 double react,
79 double react_err,
81 size_t offset) {
82 t::file_extensions;
83
84 {
85 v.write_structure_record(f, options, seq, id, bpp, structure, energy, react, react_err, comment, offset)
86 } -> std::same_as<void>;
87
88 {
89 v.write_structure_record(f,
90 options,
91 seq,
92 id,
93 bpp,
94 std::ignore,
95 std::ignore,
96 std::ignore,
97 std::ignore,
98 std::ignore,
99 std::ignore)
100 } -> std::same_as<void>;
101
102 {
103 v.write_structure_record(f,
104 options,
106 id,
107 std::ignore,
109 energy,
110 std::ignore,
111 std::ignore,
112 std::ignore,
113 std::ignore)
114 } -> std::same_as<void>;
115
116 {
117 v.write_structure_record(f,
118 options,
119 std::ignore,
120 std::ignore,
121 std::ignore,
122 std::ignore,
123 std::ignore,
124 std::ignore,
125 std::ignore,
126 std::ignore,
127 std::ignore)
128 } -> std::same_as<void>;
129 // the last is required to be compile time valid, but should always throw at run-time.
130};
132
133// Workaround for https://github.com/doxygen/doxygen/issues/9379
134#if SEQAN3_DOXYGEN_ONLY(1) 0
135template <typename t>
138#endif
139
199
200} // namespace seqan3
201
202namespace seqan3::detail
203{
204
210template <typename t>
211constexpr bool is_type_list_of_structure_file_output_formats_v = false;
212
218template <typename... ts>
219constexpr bool is_type_list_of_structure_file_output_formats_v<type_list<ts...>> =
220 (structure_file_output_format<ts> && ...);
221
227template <typename t>
228concept type_list_of_structure_file_output_formats = is_type_list_of_structure_file_output_formats_v<t>;
229} // namespace seqan3::detail
The generic concept for structure file out formats.
Definition structure_file/output_format_concept.hpp:137
@ energy
Energy of a folded sequence, represented by one float number.
@ comment
Comment field of arbitrary content, usually a string.
@ structure
Fixed interactions, usually a string of structure alphabet characters.
@ bpp
Base pair probability matrix of interactions, usually a matrix of float numbers.
@ react
Reactivity values of the sequence characters given in a vector of float numbers.
@ react_err
Reactivity error values given in a vector corresponding to seqan3::field::react.
@ offset
Sequence (seqan3::field::seq) relative start position (0-based), unsigned value.
@ structured_seq
Sequence and fixed interactions combined in one range.
@ id
The identifier, usually a string.
@ seq
The "sequence", usually a range of nucleotides or amino acids.
The main SeqAn3 namespace.
Definition aligned_sequence_concept.hpp:26
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.
Hide me