Crate noodles_bgzf

Source
Expand description

noodles-bgzf handles the reading and writing of the blocked gzip format (BGZF).

While the gzip format is typically a single stream, a BGZF is the concatenation of many gzip streams. Each stream is called a block, with its uncompressed data size being constrained to less than 64 KiB. This multistream gzip allows random access using virtual positions.

noodles-bgzf abstracts away the concept of blocks, implementing std::io::Read for the reader and std::io::Write for the writer.

§Examples

§Read an entire BGZF file

use noodles_bgzf as bgzf;
let mut reader = File::open("data.gz").map(bgzf::Reader::new)?;
let mut data = Vec::new();
reader.read_to_end(&mut data)?;

§Write a BGZF file

use noodles_bgzf as bgzf;
let mut writer = File::create("data.gz").map(bgzf::Writer::new)?;
writer.write_all(b"noodles-bgzf")?;

Re-exports§

pub use self::indexed_reader::IndexedReader;
pub use self::multithreaded_writer::MultithreadedWriter;
pub use self::reader::Reader;
pub use self::virtual_position::VirtualPosition;
pub use self::writer::Writer;
pub use self::async::Reader as AsyncReader;
pub use self::async::Writer as AsyncWriter;

Modules§

async
Async BGZF I/O.
gzi
gzip index.
indexed_reader
Indexed BGZF reader.
io
BGZF I/O.
multithreaded_writer
Multithreaded BGZF writer.
reader
BGZF reader.
virtual_position
BGZF virtual position.
writer
BGZF writer.

Structs§

MultithreadedReader
A multithreaded BGZF reader.