Skip to main content

Crate rsomics_bam_cat

Crate rsomics_bam_cat 

Source
Expand description

samtools cat port: concatenate BAMs by copying compressed BGZF blocks verbatim.

cat is IO-bound by design — samtools never inflates the alignment records, it moves the compressed gzip members byte-for-byte (bgzf_raw_read / bgzf_raw_write, bam_cat.c). The only re-framed bytes are the single output header. This port does the same via [bgzf_copy]: each input’s header is inflated and dropped, one merged header is written once, and every alignment frame is copied raw. So the per-record deflate that the rsomics_bamio::raw edit path pays (and that loses to samtools) never happens here.

Header rule (bam_cat.c cat_check_merge_hdr): the first file’s header is the base; @RG lines present in later files but not the base are appended; @SQ and everything else come from the first file unchanged. When no @RG merge is needed — the dominant case of concatenating shards of one alignment — the first header’s raw uncompressed bytes are re-emitted verbatim, so the output header is byte-identical to samtools cat --no-PG.

Structs§

CatOpts
CatStats

Functions§

cat