Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Sample-aware QC

Objective: estimate thresholds independently within each sample and compare the resulting sample-specific QC outcomes.

Use a string or categorical observation column for batch_key. With adata from the quick start, fit a separate run:

import verymadpy as vm

vm.pp.flag_mad_outliers(adata, batch_key="sample_id", key_added="sample_qc")
sample_table = vm.pp.summarize_mad(
    adata,
    key_added="sample_qc",
    include_combined=True,
)

For each observed sample, veryMADpy estimates a median, MAD, and metric thresholds from that sample’s valid observations. It applies each threshold only within its sample and preserves observation order. Empty categorical levels are ignored. Missing labels, groups below min_n (five by default), and degenerate distributions can yield undefined classifications; no pooled fallback is applied.

Inspect sample-specific thresholds and flag rates before deciding whether to filter:

fig, axes = vm.pl.qc_summary(adata, key_added="sample_qc", show=False)

Different samples can have different biological and technical distributions. A sample-specific fit does not guarantee equal flag rates, and equal rates are not a QC target. See flag_mad_outliers, summarize_mad, and qc_summary.