Loading...
Searching...
No Matches
sequence_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 <string>
#include <vector>
#include <seqan3/alphabet/nucleotide/dna5.hpp>
#include <seqan3/alphabet/quality/aliases.hpp>
#include <seqan3/alphabet/quality/phred42.hpp>
#include <seqan3/io/sequence_file/output_options.hpp>
#include <seqan3/utility/type_list/type_list.hpp>
namespace seqan3::detail
{
template <typename format_type>
struct sequence_file_output_format_exposer : public format_type
{
public:
// Can't use `using format_type::write_sequence_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_sequence_record interface.
template <typename... ts>
void write_sequence_record(ts &&... args)
{
format_type::write_sequence_record(std::forward<ts>(args)...);
}
};
} // namespace seqan3::detail
namespace seqan3
{
template <typename t>
concept sequence_file_output_format = requires (detail::sequence_file_output_format_exposer<t> & v,
std::ofstream & f,
sequence_file_output_options & options,
dna5_vector & seq,
std::string & id,
std::vector<phred42> & qual,
std::vector<dna5q> & seq_qual) {
t::file_extensions;
{ v.write_sequence_record(f, options, seq, id, qual) } -> std::same_as<void>;
{ v.write_sequence_record(f, options, std::ignore, id, std::ignore) } -> std::same_as<void>;
// This one is required to be a valid call, but should always throw at run-time.
{ v.write_sequence_record(f, options, std::ignore, std::ignore, std::ignore) } -> std::same_as<void>;
};
// Workaround for https://github.com/doxygen/doxygen/issues/9379
#if SEQAN3_DOXYGEN_ONLY(1) 0
template <typename t>
class sequence_file_output_format
{};
#endif
} // namespace seqan3
namespace seqan3::detail
{
template <typename t>
constexpr bool is_type_list_of_sequence_file_output_formats_v = false;
template <typename... ts>
constexpr bool is_type_list_of_sequence_file_output_formats_v<type_list<ts...>> =
(sequence_file_output_format<ts> && ...);
template <typename t>
concept type_list_of_sequence_file_output_formats = is_type_list_of_sequence_file_output_formats_v<t>;
} // namespace seqan3::detail
aliases.hpp
Provides aliases for qualified.
seqan3::sequence_file_output_format
The generic concept for sequence file out formats.
Definition sequence_file/output_format_concept.hpp:88
dna5.hpp
Provides seqan3::dna5, container aliases and string literals.
std::forward
T forward(T... args)
fstream
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::field::qual
@ qual
The qualities, usually in Phred score notation.
Definition record.hpp:64
seqan3
The main SeqAn3 namespace.
Definition aligned_sequence_concept.hpp:26
phred42.hpp
Provides seqan3::phred42 quality scores.
output_options.hpp
Provides seqan3::sequence_file_output_options.
string
seqan3::sequence_file_output_options
The options type defines various option members that influence the behaviour of all or some formats.
Definition sequence_file/output_options.hpp:23
seqan3::type_list
Type that contains multiple types.
Definition type_list.hpp:26
type_list.hpp
Provides seqan3::type_list.
vector
Hide me