rsomics-coverage-core 0.1.0

Genome-binned BAM read-coverage primitive (deeptools countReadsPerBin port): per-bin read counts over a BGZF BAM via rsomics-bamio, shared by rsomics-bam-signal (bamCoverage) and rsomics-bam-compare (bamCompare).
Documentation
  • Coverage
  • 78.57%
    11 out of 14 items documented0 out of 5 items with examples
  • Size
  • Source code size: 30.68 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 616.49 kB This is the summed size of all files generated by rustdoc for all configured targets
  • Ø build duration
  • this release: 14s Average build duration of successful builds.
  • all releases: 14s Average build duration of successful builds in releases after 2024-10-23.
  • Links
  • omics-rust/rsomics-world
    0 0 0
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • Bengerthelorf

rsomics-coverage-core

Genome-binned BAM read-coverage primitive. Layer A library shared by rsomics-bam-signal (deeptools bamCoverage) and rsomics-bam-compare (deeptools bamCompare).

Tiles each chromosome into fixed-width bins and counts, per bin, the reads whose reference span (alignment start + reference-consuming CIGAR ops) overlaps it. Returns per-chromosome bin counts plus two read totals (total_binned for bamCoverage CPM/RPKM/RPGC, total_mapped for bamCompare's readCount scale factor).

This crate holds only the binning + counting. Normalisation, the bedGraph run-length emit, and two-BAM combination live in the consuming tool crates.

API

use std::num::NonZero;
use std::path::Path;
use rsomics_coverage_core::{compute_coverage, BinFilter};

let cov = compute_coverage(
    Path::new("in.bam"),
    50,                        // bin size (deeptools default)
    BinFilter::default(),      // accept all mapped reads
    NonZero::new(1).unwrap(),  // BGZF inflate workers
)?;
// cov.chroms: Vec<ChromBins { name, chrom_len, bins: Vec<u32> }>
// cov.total_binned, cov.total_mapped, cov.total_signal()

Origin

This crate is a Rust reimplementation of the per-bin read-counting core of deeptools (countReadsPerBin.py), informed by the deeptools source (MIT license):

  • Ramírez et al., deepTools2: a next generation web server for deep-sequencing data analysis, NAR 2016. DOI: 10.1093/nar/gkw257
  • deeptools source: countReadsPerBin.py, bamCoverage.py, bamCompare.py

deeptools is MIT licensed. Its source was read directly and cited here per the CONVENTIONS clean-room methodology for MIT upstreams.

License: MIT OR Apache-2.0. Upstream credit: deeptools https://github.com/deeptools/deeptools (MIT).