Loading...
Searching...
No Matches
structure_file/output_format_concept.hpp
Go to the documentation of this file.
// SPDX-FileCopyrightText: 2006-2025 Knut Reinert & Freie Universität Berlin
// SPDX-FileCopyrightText: 2016-2025 Knut Reinert & MPI für molekulare Genetik
// SPDX-License-Identifier: BSD-3-Clause
#pragma once
#include <fstream>
#include <set>
#include <string>
#include <vector>
#include <seqan3/alphabet/nucleotide/rna5.hpp>
#include <seqan3/alphabet/structure/structured_rna.hpp>
#include <seqan3/alphabet/structure/wuss.hpp>
#include <seqan3/io/structure_file/output_options.hpp>
#include <seqan3/utility/type_list/type_list.hpp>
namespace seqan3::detail
{
template <typename format_type>
struct structure_file_output_format_exposer : public format_type
{
public:
// Can't use `using format_type::write_structure_record` as it produces a hard failure in the format concept check
// for types that do not model the format concept, i.e. don't offer the proper write_structure_record interface.
template <typename... ts>
void write_structure_record(ts &&... args)
{
format_type::write_structure_record(std::forward<ts>(args)...);
}
};
} // namespace seqan3::detail
namespace seqan3
{
template <typename t>
concept structure_file_output_format = requires (detail::structure_file_output_format_exposer<t> & v,
std::ofstream & f,
structure_file_output_options & options,
rna5_vector & seq,
std::string & id,
std::vector<std::set<std::pair<double, size_t>>> & bpp,
std::vector<wuss51> & structure,
std::vector<structured_rna<rna5, wuss51>> & structured_seq,
double energy,
double react,
double react_err,
std::string & comment,
size_t offset) {
t::file_extensions;
{
v.write_structure_record(f, options, seq, id, bpp, structure, energy, react, react_err, comment, offset)
} -> std::same_as<void>;
{
v.write_structure_record(f,
options,
seq,
id,
bpp,
std::ignore,
std::ignore,
std::ignore,
std::ignore,
std::ignore,
std::ignore)
} -> std::same_as<void>;
{
v.write_structure_record(f,
options,
structured_seq,
id,
std::ignore,
structured_seq,
energy,
std::ignore,
std::ignore,
std::ignore,
std::ignore)
} -> std::same_as<void>;
{
v.write_structure_record(f,
options,
std::ignore,
std::ignore,
std::ignore,
std::ignore,
std::ignore,
std::ignore,
std::ignore,
std::ignore,
std::ignore)
} -> std::same_as<void>;
// the last is required to be compile time valid, but should always throw at run-time.
};
// Workaround for https://github.com/doxygen/doxygen/issues/9379
#if SEQAN3_DOXYGEN_ONLY(1) 0
template <typename t>
class structure_file_output_format
{};
#endif
} // namespace seqan3
namespace seqan3::detail
{
template <typename t>
constexpr bool is_type_list_of_structure_file_output_formats_v = false;
template <typename... ts>
constexpr bool is_type_list_of_structure_file_output_formats_v<type_list<ts...>> =
(structure_file_output_format<ts> && ...);
template <typename t>
concept type_list_of_structure_file_output_formats = is_type_list_of_structure_file_output_formats_v<t>;
} // namespace seqan3::detail
seqan3::structure_file_output_format
The generic concept for structure file out formats.
Definition structure_file/output_format_concept.hpp:137
std::forward
T forward(T... args)
fstream
seqan3::field::energy
@ energy
Energy of a folded sequence, represented by one float number.
Definition record.hpp:72
seqan3::field::comment
@ comment
Comment field of arbitrary content, usually a string.
Definition record.hpp:75
seqan3::field::structure
@ structure
Fixed interactions, usually a string of structure alphabet characters.
Definition record.hpp:70
seqan3::field::bpp
@ bpp
Base pair probability matrix of interactions, usually a matrix of float numbers.
Definition record.hpp:69
seqan3::field::react
@ react
Reactivity values of the sequence characters given in a vector of float numbers.
Definition record.hpp:73
seqan3::field::react_err
@ react_err
Reactivity error values given in a vector corresponding to seqan3::field::react.
Definition record.hpp:74
seqan3::field::offset
@ offset
Sequence (seqan3::field::seq) relative start position (0-based), unsigned value.
Definition record.hpp:66
seqan3::field::structured_seq
@ structured_seq
Sequence and fixed interactions combined in one range.
Definition record.hpp:71
seqan3::field::id
@ id
The identifier, usually a string.
Definition record.hpp:63
seqan3::field::seq
@ seq
The "sequence", usually a range of nucleotides or amino acids.
Definition record.hpp:62
seqan3
The main SeqAn3 namespace.
Definition aligned_sequence_concept.hpp:26
rna5.hpp
Provides seqan3::rna5, container aliases and string literals.
set
string
seqan3::structure_file_output_options
The options type defines various option members that influence the behaviour of all or some formats.
Definition structure_file/output_options.hpp:23
seqan3::type_list
Type that contains multiple types.
Definition type_list.hpp:26
output_options.hpp
Provides seqan3::structure_file_output_options.
structured_rna.hpp
Provides the composite of nucleotide with structure alphabets.
type_list.hpp
Provides seqan3::type_list.
vector
wuss.hpp
Provides the WUSS format for RNA structure.
Hide me