18#include <seqan3/contrib/stream/bgzf.hpp>
19#include <seqan3/contrib/stream/bgzf_ostream.hpp>
20#include <seqan3/contrib/stream/bz2_ostream.hpp>
21#include <seqan3/contrib/stream/gz_ostream.hpp>
35template <builtin_
character
char_t>
49 if (extension ==
".gz")
52 filename.replace_extension(
"");
53 return {
new contrib::basic_gz_ostream<char_t>{primary_stream}, stream_deleter_default};
55 throw file_open_error{
"Trying to write a gzipped file, but no ZLIB available."};
58 else if ((extension ==
".bgzf") || (extension ==
".bam"))
61 if (extension !=
".bam")
62 filename.replace_extension(
"");
64 return {
new contrib::basic_bgzf_ostream<char_t>{primary_stream}, stream_deleter_default};
66 throw file_open_error{
"Trying to write a bgzf'ed file, but no ZLIB available."};
69 else if (extension ==
".bz2")
72 filename.replace_extension(
"");
73 return {
new contrib::basic_bz2_ostream<char_t>{primary_stream}, stream_deleter_default};
75 throw file_open_error{
"Trying to write a bzipped file, but no libbz2 available."};
78 else if (extension ==
".zst")
80 throw file_open_error{
"Trying to write a zst'ed file, but SeqAn does not yet support this."};
83 return {&primary_stream, stream_deleter_noop};
auto make_secondary_ostream(std::basic_ostream< char_t > &primary_stream, std::filesystem::path &filename) -> std::unique_ptr< std::basic_ostream< char_t >, std::function< void(std::basic_ostream< char_t > *)> >
Depending on the given filename/extension, create a compression stream or just forward the primary st...
Definition misc_output.hpp:36
Provides exceptions used in the I/O module.
The internal SeqAn3 namespace.
Definition aligned_sequence_concept.hpp:26
constexpr auto const & get(configuration< configs_t... > const &config) noexcept
This is an overloaded member function, provided for convenience. It differs from the above function o...
Definition configuration.hpp:412
Thrown if there is an unspecified filesystem or stream error while opening, e.g. permission problem.
Definition io/exception.hpp:36
Provides concepts that do not have equivalents in C++20.