Spec BgzfStream
Reading and writing of BGZF data.

Extends Stream
All Extended Stream
All Impl'd StreamConcept
Defined in <seqan/stream.h>
Signature template <> class Stream<Bgzf>;

Interface Function Overview

Interface Functions Inherited From Stream

Interface Functions Inherited From StreamConcept

Interface Metafunction Overview

Interface Metafunctions Inherited From StreamConcept

Detailed Description


Not copy constructable, not assignable.

BGZF is the Block GZip Format which is used as the underlying format for BAM and TABIX. Data is written out compressed with gzip but the uncompressed data is split into blocks with a maximum block size. It is therefore possible to jump to beginnings of blocks in the resulting files, decompress the block and then jump into the block itself.


Stream<Bgzf> stream;
if (!open(stream, "myfile.bam", "r"))
    return 1;  // error
// ... work

Interface Functions Detail

void attachToFile(stream, fileHandle, mode);

Attach to already open input/output POSIX file.


stream Stream to attach to file. Types: BGZF Stream
fileHandle The file handle to attach to. Type: int
mode The mode flag the file was opened with. Type: int


A previously opened file is closed.

bool checkEofIsValid(stream);

Check that the EOF marker is present in BGZF (e.g. BAM) file.


stream The BgzfStream to check.


bool true if the marker is present and false otherwise.

bool open(stream, fileName, mode);

Open a stream.


stream The stream to open.
fileName The path to the file to open. Type: char const *.
mode The mode for opening.


bool true on success, false on failure.


You can append 0-9 or u or w in mode. for setting the compression level to 0-9 or "no compression".