SeqAn3 3.1.0
The Modern C++ library for sequence analysis.
input_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 <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>
73SEQAN3_CONCEPT structure_file_input_format = requires(detail::structure_file_input_format_exposer<t> & v,
74 std::ifstream & f,
75 structure_file_input_options<rna5, false> & options,
76 rna5_vector & seq,
81 double energy,
82 double react,
83 double react_err,
85 size_t offset)
86{
87 t::file_extensions;
88
89 SEQAN3_RETURN_TYPE_CONSTRAINT(v.read_structure_record(f,
90 options,
91 seq,
92 id,
93 bpp,
94 structure,
95 energy,
96 react,
97 react_err,
98 comment,
99 offset),
100 std::same_as, void);
101 SEQAN3_RETURN_TYPE_CONSTRAINT(v.read_structure_record(f,
102 options,
103 seq,
104 id,
105 bpp,
106 std::ignore,
107 std::ignore,
108 std::ignore,
109 std::ignore,
110 std::ignore,
111 std::ignore),
112 std::same_as, void);
113 SEQAN3_RETURN_TYPE_CONSTRAINT(v.read_structure_record(f,
114 options,
115 structured_seq,
116 id,
117 std::ignore,
118 structured_seq,
119 energy,
120 std::ignore,
121 std::ignore,
122 std::ignore,
123 std::ignore),
124 std::same_as, void);
125 SEQAN3_RETURN_TYPE_CONSTRAINT(v.read_structure_record(f,
126 options,
127 std::ignore,
128 std::ignore,
129 std::ignore,
130 std::ignore,
131 std::ignore,
132 std::ignore,
133 std::ignore,
134 std::ignore,
135 std::ignore),
136 std::same_as, void);
137 // the last is required to be compile time valid, but should always throw at run-time.
138};
140
201
202} // namespace seqan3
203
204namespace seqan3::detail
205{
206
212template <typename t>
213constexpr bool is_type_list_of_structure_file_input_formats_v = false;
214
220template <typename ...ts>
221constexpr bool is_type_list_of_structure_file_input_formats_v<type_list<ts...>>
223
229template <typename t>
230SEQAN3_CONCEPT type_list_of_structure_file_input_formats = is_type_list_of_structure_file_input_formats_v<t>;
231} // namespace seqan3::detail
@ 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 generic concept for structure file in formats.
The main SeqAn3 namespace.
Definition: cigar_operation_table.hpp:2
#define SEQAN3_RETURN_TYPE_CONSTRAINT(expression, concept_name,...)
Same as writing {expression} -> concept_name<type1[, ...]> in a concept definition.
Definition: platform.hpp:57
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.