21#if defined(SEQAN3_HAS_BZIP2)
22# include <seqan3/contrib/stream/bz2_ostream.hpp>
24#if defined(SEQAN3_HAS_ZLIB)
25# include <seqan3/contrib/stream/bgzf_ostream.hpp>
26# include <seqan3/contrib/stream/gz_ostream.hpp>
41template <builtin_
character
char_t>
55 if (extension ==
".gz")
57#if defined(SEQAN3_HAS_ZLIB)
58 filename.replace_extension(
"");
59 return {
new contrib::basic_gz_ostream<char_t>{primary_stream}, stream_deleter_default};
61 throw file_open_error{
"Trying to write a gzipped file, but no ZLIB available."};
64 else if ((extension ==
".bgzf") || (extension ==
".bam"))
66#if defined(SEQAN3_HAS_ZLIB)
67 if (extension !=
".bam")
68 filename.replace_extension(
"");
70 return {
new contrib::basic_bgzf_ostream<char_t>{primary_stream}, stream_deleter_default};
72 throw file_open_error{
"Trying to write a bgzf'ed file, but no ZLIB available."};
75 else if (extension ==
".bz2")
77#if defined(SEQAN3_HAS_BZIP2)
78 filename.replace_extension(
"");
79 return {
new contrib::basic_bz2_ostream<char_t>{primary_stream}, stream_deleter_default};
81 throw file_open_error{
"Trying to write a bzipped file, but no libbz2 available."};
84 else if (extension ==
".zst")
86 throw file_open_error{
"Trying to write a zst'ed file, but SeqAn does not yet support this."};
89 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:42
Provides exceptions used in the I/O module.
The internal SeqAn3 namespace.
Definition: aligned_sequence_concept.hpp:29
Thrown if there is an unspecified filesystem or stream error while opening, e.g. permission problem.
Definition: exception.hpp:39
Provides concepts that do not have equivalents in C++20.