Coverage analysis measures and interprets how deeply sequencing reads cover a genome or set of target regions. The central idea is that coverage is a distribution over positions, not a single number: the mean is inflated by repeat/rDNA pileups and blind to GC-extreme or poorly-mappable holes, so the decision-grade summary is the median plus a breadth curve (% of target reaching each depth) plus an evenness number (CV, Fano, Picard fold-80, or Gini). This skill covers mosdepth (the modern fast default for breadth curves and callable BEDs), bedtools genomecov and coverage (bedGraph tracks and per-target stats), samtools depth and coverage (per-base depth and per-contig depth+breadth), and the silent confounders -- duplicates, MAPQ filtering, GC bias, mate-overlap double-counting, and capture unevenness -- that bias depth before any plot is drawn.
# CLI tools
conda install -c bioconda bedtools mosdepth samtools
# Python (optional, for pybedtools and parsing dist files)
pip install pybedtools numpy
# pybedtools requires a bedtools binary on PATH
Tell your AI agent what you want to do: - "What is the median depth and breadth at 20x for my BAM?" - "Build a callable-region BED from my alignments" - "Generate a coverage bedGraph track for the genome browser" - "Compute per-target coverage stats across my capture panel" - "Check whether my high-depth amplicon panel has a mate-overlap problem"
"Run mosdepth on sample.bam, give me the median depth and the breadth at 1x, 10x, 20x, and 30x, and tell me whether the library is even or spiky." "My run reports mean 30x WGS -- is that actually enough? Show me the cumulative coverage curve and the fraction of the genome callable at 20x." "Compare per-contig mean depth and breadth across chromosomes and flag any contig with high mean depth but low breadth."
"Create a bedGraph coverage track from alignments.bam that includes zero-coverage regions, then prepare it for conversion to bigWig." "Make a callable-region BED that classifies each base as NO_COVERAGE, LOW, CALLABLE, or HIGH using mosdepth quantize."
"Compute coverage statistics for each exon in targets.bed from my exome BAM and list every target below 20x mean depth." "Run capture-uniformity QC and report the fold-80 base penalty and on-target percentage."
"My cfDNA panel shows inflated variant allele fractions -- check for mate-overlap double-counting and recompute depth correcting for it." "Calculate exon coverage from my RNA-seq BAM, making sure introns are not counted as covered."
--fast-mode/-x silently disables mate-overlap correction; do not use it for VAF-sensitive short-insert data.samtools --version and add -d 0 on old builds.samtools coverage, the coverage column is breadth (% bases >=1x); meandepth is depth -- never report the bare word "coverage" without a qualifier.-a file (A = targets, B = reads) since v2.24.0; older habits get this backwards silently.bedtools genomecov outputs a histogram, not a track; add -bg/-bga. Always add -split for spliced RNA-seq.--reference.