18#if defined(SEQAN3_HAS_BZIP2)
19# include <seqan3/contrib/stream/bz2_ostream.hpp>
21#if defined(SEQAN3_HAS_ZLIB)
22# include <seqan3/contrib/stream/bgzf_ostream.hpp>
23# include <seqan3/contrib/stream/gz_ostream.hpp>
39template <builtin_
character
char_t>
53 if (extension ==
".gz")
55#if defined(SEQAN3_HAS_ZLIB)
56 filename.replace_extension(
"");
57 return {
new contrib::basic_gz_ostream<char_t>{primary_stream}, stream_deleter_default};
59 throw file_open_error{
"Trying to write a gzipped file, but no ZLIB available."};
62 else if ((extension ==
".bgzf") || (extension ==
".bam"))
64#if defined(SEQAN3_HAS_ZLIB)
65 if (extension !=
".bam")
66 filename.replace_extension(
"");
68 return {
new contrib::basic_bgzf_ostream<char_t>{primary_stream}, stream_deleter_default};
70 throw file_open_error{
"Trying to write a bgzf'ed file, but no ZLIB available."};
73 else if (extension ==
".bz2")
75#if defined(SEQAN3_HAS_BZIP2)
76 filename.replace_extension(
"");
77 return {
new contrib::basic_bz2_ostream<char_t>{primary_stream}, stream_deleter_default};
79 throw file_open_error{
"Trying to write a bzipped file, but no libbz2 available."};
82 else if (extension ==
".zst")
84 throw file_open_error{
"Trying to write a zst'ed file, but SeqAn does not yet support this."};
87 return {&primary_stream, stream_deleter_noop};
Provides seqan3::contrib::bgzf_thread_count.
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:40
Provides exceptions used in the I/O module.
The internal SeqAn3 namespace.
Definition aligned_sequence_concept.hpp:26
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.