BAM.Index.CSI (BAM v0.1.0)

Copy Markdown View Source

CSI index codec.

CSI generalises the BAI binning scheme. The file may be a raw CSI\1 stream or a BGZF compression of that stream. Each bin carries loffset, the virtual offset of the leftmost record placed in the bin. The metadata pseudo-bin number is bin_limit(min_shift, depth) + 1. This module reads CSI and writes an uncompressed CSI payload. compress/2 BGZF-compresses that payload, which is the form HTSlib writes.

Summary

Functions

Writes a BGZF-compressed CSI binary.

Decodes a CSI binary or a BGZF-compressed CSI file.

Encodes the uncompressed CSI payload.

Functions

compress(index, opts \\ [])

@spec compress(BAM.Index.t(), keyword()) :: {:ok, binary()} | {:error, BAM.Error.t()}

Writes a BGZF-compressed CSI binary.

decode(binary, limits \\ BAM.Limits.default())

@spec decode(binary(), BAM.Limits.t()) ::
  {:ok, BAM.Index.t()} | {:error, BAM.Error.t()}

Decodes a CSI binary or a BGZF-compressed CSI file.

encode(index)

@spec encode(BAM.Index.t()) :: {:ok, binary()} | {:error, BAM.Error.t()}

Encodes the uncompressed CSI payload.