Builds a BAI or CSI binning index while a BAM file is written.
Records must arrive grouped by reference id and, within a reference, sorted
by pos. Mapped records become chunks. A run of records that share a bin
is one chunk, from the virtual offset of the first record to the virtual
offset of the following record. Placed unmapped reads increment the
reference's unmapped count and do not open a chunk. Reads with no reference
increment n_no_coor.
The BAM bin field itself always uses the 14/5 scheme. A CSI builder may
use another min_shift and depth for the index only.
Summary
Functions
Closes the last chunk at final_voff and returns an index with one slot
per reference in the header.
New builder. :format is :bai or :csi. CSI defaults match BAI
(min_shift 14, depth 5) unless overridden.
Accounts for one alignment whose first byte is at voff.
Types
Functions
@spec finish(t(), non_neg_integer(), non_neg_integer()) :: {:ok, BAM.Index.t()}
Closes the last chunk at final_voff and returns an index with one slot
per reference in the header.
New builder. :format is :bai or :csi. CSI defaults match BAI
(min_shift 14, depth 5) unless overridden.
@spec push(t(), BAM.Alignment.t(), non_neg_integer()) :: {:ok, t()} | {:error, BAM.Error.t()}
Accounts for one alignment whose first byte is at voff.