20 #ifdef SEQAN3_HAS_BZIP2
21 #include <seqan3/contrib/stream/bz2_ostream.hpp>
23 #ifdef SEQAN3_HAS_ZLIB
24 #include <seqan3/contrib/stream/bgzf_ostream.hpp>
25 #include <seqan3/contrib/stream/gz_ostream.hpp>
38 template <builtin_
character
char_t>
49 if ((extension ==
".gz") || (extension ==
".bgzf") || (extension ==
".bam"))
51 #ifdef SEQAN3_HAS_ZLIB
52 if (extension !=
".bam")
53 filename.replace_extension(
"");
55 return {
new contrib::basic_bgzf_ostream<char_t>{primary_stream},
56 stream_deleter_default};
58 throw file_open_error{
"Trying to write a gzipped file, but no ZLIB available."};
61 else if (extension ==
".bz2")
63 #ifdef SEQAN3_HAS_BZIP2
64 filename.replace_extension(
"");
65 return {
new contrib::basic_bz2_ostream<char_t>{primary_stream}, stream_deleter_default};
67 throw file_open_error{
"Trying to write a bzipped file, but no libbz2 available."};
70 else if (extension ==
".zst")
72 throw file_open_error{
"Trying to write a zst'ed file, but SeqAn does not yet support this."};
75 return {&primary_stream, stream_deleter_noop};
Provides concepts for core language types and relations that don't have concepts in C++20 (yet).
This header includes C++17 filesystem support and imports it into namespace std::filesystem (independ...
The internal SeqAn3 namespace.
Definition: aligned_sequence_concept.hpp:29
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:39
Thrown if there is an unspecified filesystem or stream error while opening, e.g. permission problem.
Definition: exception.hpp:40