Coverage Normalization¶
Pipeline step: normalize_mosdepth (Step 3a)
Module: grid.utils.normalize_mosdepth
Raw depth values vary between samples due to differences in sequencing depth, library preparation, and batch effects. Normalization removes these technical sources of variation so that differences in the depth matrix reflect true copy number variation rather than measurement artefacts.
Depth Matrix¶
Let \(N\) be the number of samples and \(M\) the number of genomic bins after filtering. Define the raw depth matrix:
Step 1 — Within-Individual Normalization¶
Each sample’s depth values are divided by that sample’s mean depth across all non-missing bins, removing global sequencing depth differences:
Step 2 — Across-Individual Normalization¶
For each bin \(j\), compute the population mean and variance of the within-normalized depths:
The final normalized matrix uses a Poisson-inspired z-score transformation (dividing by \(\sqrt{\mu_j}\) rather than \(\sigma_j\)) to stabilize variance across bins with different mean depths:
Step 3 — Variance Ratio Filtering¶
To focus downstream neighbor search on the most informative regions (those with true copy number variation), bins are ranked by their variance ratio:
Only the top fraction (default: top 10%) of bins by variance ratio are retained for the nearest-neighbor step. This preferentially selects bins in and around the VNTR region where copy number variation is greatest.
Output: A gzip-compressed matrix of shape \(N \times M_{\mathrm{filtered}}\) containing \(D^{\mathrm{norm}}\) values for the retained bins.