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>
52 if (extension ==
".gz")
54#if defined(SEQAN3_HAS_ZLIB)
55 filename.replace_extension(
"");
56 return {
new contrib::basic_gz_ostream<char_t>{primary_stream}, stream_deleter_default};
58 throw file_open_error{
"Trying to write a gzipped file, but no ZLIB available."};
61 else if ((extension ==
".bgzf") || (extension ==
".bam"))
63#if defined(SEQAN3_HAS_ZLIB)
64 if (extension !=
".bam")
65 filename.replace_extension(
"");
67 return {
new contrib::basic_bgzf_ostream<char_t>{primary_stream}, stream_deleter_default};
69 throw file_open_error{
"Trying to write a bgzf'ed file, but no ZLIB available."};
72 else if (extension ==
".bz2")
74#if defined(SEQAN3_HAS_BZIP2)
75 filename.replace_extension(
"");
76 return {
new contrib::basic_bz2_ostream<char_t>{primary_stream}, stream_deleter_default};
78 throw file_open_error{
"Trying to write a bzipped file, but no libbz2 available."};
81 else if (extension ==
".zst")
83 throw file_open_error{
"Trying to write a zst'ed file, but SeqAn does not yet support this."};
86 return {&primary_stream, stream_deleter_noop};
Provides concepts for core language types and relations that don't have concepts in C++20 (yet).
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