SeqAn3 3.4.0-rc.1
The Modern C++ library for sequence analysis.
Loading...
Searching...
No Matches
structure_file/input_format_concept.hpp
Go to the documentation of this file.
1// SPDX-FileCopyrightText: 2006-2024 Knut Reinert & Freie Universität Berlin
2// SPDX-FileCopyrightText: 2016-2024 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 <utility>
16#include <vector>
17
23
24namespace seqan3::detail
25{
26
37template <typename format_type>
38struct structure_file_input_format_exposer : public format_type
39{
40public:
41 // Can't use `using format_type::read_structure_record` as it produces a hard failure in the format concept check
42 // for types that do not model the format concept, i.e. don't offer the proper read_structure_record interface.
44 template <typename... ts>
45 void read_structure_record(ts &&... args)
46 {
47 format_type::read_structure_record(std::forward<ts>(args)...);
48 }
49};
50
51} // namespace seqan3::detail
52
53namespace seqan3
54{
55
69template <typename t>
70concept structure_file_input_format =
71 requires (detail::structure_file_input_format_exposer<t> & v,
72 std::ifstream & f,
73 structure_file_input_options<rna5, false> & options,
74 rna5_vector & seq,
79 double energy,
80 double react,
81 double react_err,
83 size_t offset) {
84 t::file_extensions;
85
86 {
87 v.read_structure_record(f, options, seq, id, bpp, structure, energy, react, react_err, comment, offset)
88 } -> std::same_as<void>;
89
90 {
91 v.read_structure_record(f,
92 options,
93 seq,
94 id,
95 bpp,
96 std::ignore,
97 std::ignore,
98 std::ignore,
99 std::ignore,
100 std::ignore,
101 std::ignore)
102 } -> std::same_as<void>;
103
104 {
105 v.read_structure_record(f,
106 options,
108 id,
109 std::ignore,
111 energy,
112 std::ignore,
113 std::ignore,
114 std::ignore,
115 std::ignore)
116 } -> std::same_as<void>;
117
118 {
119 v.read_structure_record(f,
120 options,
121 std::ignore,
122 std::ignore,
123 std::ignore,
124 std::ignore,
125 std::ignore,
126 std::ignore,
127 std::ignore,
128 std::ignore,
129 std::ignore)
130 } -> std::same_as<void>;
131 // the last is required to be compile time valid, but should always throw at run-time.
132 };
134
135// Workaround for https://github.com/doxygen/doxygen/issues/9379
136#if SEQAN3_DOXYGEN_ONLY(1) 0
137template <typename t>
140#endif
141
202
203} // namespace seqan3
204
205namespace seqan3::detail
206{
207
213template <typename t>
214constexpr bool is_type_list_of_structure_file_input_formats_v = false;
215
221template <typename... ts>
222constexpr bool is_type_list_of_structure_file_input_formats_v<type_list<ts...>> =
223 (structure_file_input_format<ts> && ...);
224
230template <typename t>
231concept type_list_of_structure_file_input_formats = is_type_list_of_structure_file_input_formats_v<t>;
232} // namespace seqan3::detail
The generic concept for structure file in formats.
Definition structure_file/input_format_concept.hpp:139
@ 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_input_options.
Provides the composite of nucleotide with structure alphabets.
Provides seqan3::type_list.
Provides the WUSS format for RNA structure.
Hide me