SeqAn3 3.3.0-rc.1
The Modern C++ library for sequence analysis.
structure_file/input_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 <utility>
19#include <vector>
20
26
27namespace seqan3::detail
28{
29
40template <typename format_type>
41struct structure_file_input_format_exposer : public format_type
42{
43public:
44 // Can't use `using format_type::read_structure_record` as it produces a hard failure in the format concept check
45 // for types that do not model the format concept, i.e. don't offer the proper read_structure_record interface.
47 template <typename... ts>
48 void read_structure_record(ts &&... args)
49 {
50 format_type::read_structure_record(std::forward<ts>(args)...);
51 }
52};
53
54} // namespace seqan3::detail
55
56namespace seqan3
57{
58
72template <typename t>
73concept structure_file_input_format =
74 requires (detail::structure_file_input_format_exposer<t> & v,
75 std::ifstream & f,
76 structure_file_input_options<rna5, false> & options,
77 rna5_vector & seq,
78 std::string & id,
80 std::vector<wuss51> & structure,
82 double energy,
83 double react,
84 double react_err,
85 std::string & comment,
86 size_t offset) {
87 t::file_extensions;
88
89 {
90 v.read_structure_record(f, options, seq, id, bpp, structure, energy, react, react_err, comment, offset)
91 } -> std::same_as<void>;
92
93 {
94 v.read_structure_record(f,
95 options,
96 seq,
97 id,
98 bpp,
99 std::ignore,
100 std::ignore,
101 std::ignore,
102 std::ignore,
103 std::ignore,
104 std::ignore)
105 } -> std::same_as<void>;
106
107 {
108 v.read_structure_record(f,
109 options,
110 structured_seq,
111 id,
112 std::ignore,
113 structured_seq,
114 energy,
115 std::ignore,
116 std::ignore,
117 std::ignore,
118 std::ignore)
119 } -> std::same_as<void>;
120
121 {
122 v.read_structure_record(f,
123 options,
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::ignore)
133 } -> std::same_as<void>;
134 // the last is required to be compile time valid, but should always throw at run-time.
135 };
137
138// Workaround for https://github.com/doxygen/doxygen/issues/9379
139#if SEQAN3_DOXYGEN_ONLY(1) 0
140template <typename t>
142{};
143#endif
144
205
206} // namespace seqan3
207
208namespace seqan3::detail
209{
210
216template <typename t>
218
224template <typename... ts>
227
233template <typename t>
234concept type_list_of_structure_file_input_formats = is_type_list_of_structure_file_input_formats_v<t>;
235} // namespace seqan3::detail
The generic concept for structure file in formats.
Definition: structure_file/input_format_concept.hpp:142
Auxiliary concept that checks whether a type is a seqan3::type_list and all types meet seqan3::struct...
Definition: structure_file/input_format_concept.hpp:234
constexpr bool is_type_list_of_structure_file_input_formats_v
Auxiliary value metafuncton that checks whether a type is a seqan3::type_list and all types meet seqa...
Definition: structure_file/input_format_concept.hpp:217
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 read structure records from the file.
Definition: structure_file/input_format_concept.hpp:42
void read_structure_record(ts &&... args)
Forwards to the seqan3::structure_file_input_format::read_structure_record interface.
Definition: structure_file/input_format_concept.hpp:48
Type that contains multiple types.
Definition: type_list.hpp:29
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.