Coverage Estimation

Runs mosdepth across all samples in binned mode, then computes an overlap-weighted mean depth for the KIV-2 region.

grid.utils.mosdepth.compute_mosdepth(config, console=None)
grid.utils.mosdepth.remove_intermediate_files(mosdepth_dir, console=None)

Remove intermediate mosdepth files, keeping only the example bed.

Removes:

  • *.mosdepth.global.dist.txt

  • *.mosdepth.region.dist.txt

  • *.regions.bed.gz

  • *.regions.bed.gz.csi

  • *.per_sample.txt

Parameters:

mosdepth_dir (Path)

Return type:

None

grid.utils.mosdepth.run_mosdepth_single_cram(cram_path, ref_fasta, mosdepth_dir, by=1000, console=None)

Run mosdepth genome-wide on one CRAM, parse the regions.bed.gz output exactly as Mukamel’s shell script does (strip chr, keep autosomes 1-22, scale depth by 100 and round to int), and write one per-sample row file.

Parameters:
  • cram_path (str) – Path to CRAM file

  • ref_fasta (str) – Path to reference FASTA

  • mosdepth_dir (Path) – Directory for mosdepth intermediate output

  • by (int) – Bin size (default 1000 = 1kb)

  • console – Optional rich console for logging

Returns:

True on success, False on failure

Return type:

bool