biohazard-1.0.0: bioinformatics support library

Bio.Iteratee.Bgzf

Description

Handling of BGZF files. Right now, we have an Enumeratee each for input and output. The input iteratee can optionally supply virtual file offsets, so that seeking is possible.

Synopsis

# Documentation

data Block Source #

One BGZF block: virtual offset and contents. Could also be a block of an uncompressed file, if we want to support indexing of uncompressed BAM or some silliness like that.

Constructors

 Block Fields

Instances

 Source # Methodsmappend :: Block -> Block -> Block #mconcat :: [Block] -> Block # Source # Methods Source # Methods

Decompress a BGZF stream into a stream of Blocks, np fold parallel.

Decompress a BGZF stream into a stream of Bytess.

Decompresses a plain file. What's actually happening is that the offset in the input stream is tracked and added to the Bytess giving Blocks. This results in the same interface as decompressing actual Bgzf.

Maximum block size for Bgzf: 64k with some room for headers and uncompressible stuff

The EOF marker for BGZF files. This is just an empty string compressed as BGZF. Appended to BAM files to indicate their end.

liftBlock :: Monad m => Iteratee Bytes m a -> Iteratee Block m a Source #

Runs an Iteratee for Bytess when decompressing BGZF. Adds internal bookkeeping.

Get the current virtual offset. The virtual address in a BGZF stream contains the offset of the current block in the upper 48 bits and the current offset into that block in the lower 16 bits. This scheme is compatible with the way BAM files are indexed.

data BgzfChunk Source #

Constructors

 SpecialChunk !Bytes BgzfChunk RecordChunk !Bytes BgzfChunk LeftoverChunk !Bytes BgzfChunk NoChunk

Instances

 Source # Methods Source # Methods

Tests whether a stream is in BGZF format. Does not consume any input.

Tests whether a stream is in GZip format. Also returns True on a Bgzf stream, which is technically a special case of GZip.

parMapChunksIO :: (MonadIO m, Nullable s) => Int -> (s -> IO t) -> Enumeratee s t m a Source #

Parallel map of an IO action over the elements of a stream

This Enumeratee applies an IO action to every chunk of the input stream. These IO actions are run asynchronously in a limited parallel way. Don't forget to evaluate

Like compressBgzf', with sensible defaults.

Compresses a stream of Bytess into a stream of BGZF blocks, in parallel

Constructors

 CompressParams Fields

Instances

 Source # MethodsshowList :: [CompressParams] -> ShowS #