Skip to content

12 Validation and Benchmarks

kroy3 edited this page Nov 20, 2026 · 4 revisions

Chapter 12. Validation and Benchmarks

This chapter summarises how Decant performs and how to reproduce every number. Results are reported whether they favour Decant or not. The full record is in validation/BENCHMARK.md in the repository.

12.1 Falsification gates

Each component of Decant has a gate: an automated test on simulated data with a known answer. A component is enabled by default only if it passes its gate.

library(Decant)
g <- gate_rho(rho_grid = c(0, 0.1, 0.2), seeds = 1)
#>   setting   rho |   true | cluster: mean rmse cor | legacy: mean rmse | ok
#>   easy     0.00 |  0.000 |  0.000  0.000      - |  0.140  0.317 | ok
#>   stress   0.00 |  0.000 |  0.002  0.002      - |  0.579  0.596 | ok
#>   easy     0.10 |  0.098 |  0.103  0.015   0.97 |  0.256  0.310 | ok
#>   stress   0.10 |  0.103 |  0.111  0.019   0.96 |  0.626  0.539 | ok
#>   easy     0.20 |  0.197 |  0.218  0.030   0.96 |  0.362  0.274 | ok
#>   stress   0.20 |  0.203 |  0.223  0.033   0.94 |  0.672  0.483 | ok
#>   => PASS: cluster estimator calibrated and beats legacy
  • gate_rho() simulates experiments at several true contamination levels, in an easy and a harder ("stress") setting, and checks that the estimate is close to the truth.
  • The rows with a true rho of 0 are negative controls: an estimator must not report contamination where there is none.
  • The legacy columns show an older estimator for comparison.
Gate Tests
gate_rho() Contamination estimate
gate_correction() The four correction rules
gate_hier() Per-sample soups with partial pooling
gate_splice() Splice-aware correction
gate_allelic() Genotype-based estimate
gate_ambient_de(), gate_ambient_de_cohort() Contamination-aware differential expression

To run all gates, as the continuous integration does:

# Requires the source repository
# From a terminal, in the repository folder:
#   Rscript scripts/run_falsification_gates.R

12.2 Ground truth: species mixture

A 10x mixture of human and mouse cells (20k HGMM) gives each cell's true contamination directly: in a human cell, mouse reads can only be ambient. Decant, SoupX and DecontX were run on identical inputs and scored with the two metrics of Cargnelli et al. (2026). Both scores range from 0 to 1, and higher is better.

Endogenous retained Ambient removed
Decant (bayes_cell, the default before bayes_absent) 0.989 0.616
SoupX 0.992 0.345
DecontX 0.983 0.722
CellBender (published) 0.996 0.729

Reading the result. With bayes_cell, Decant removes clearly more ambient RNA than SoupX, and about 10 points less than DecontX and CellBender, while keeping slightly more of the cells' own signal than DecontX. Its contamination estimate matches the truth from cross-species reads: median 0.027 against 0.029, rank correlation 0.985.

In version 0.4.0 the estimate was about half the truth here (0.013) and Decant removed only 0.415. The cause, absent genes scattering around rho more than a Poisson test allows, is described in Chapter 7.2. This mixture was used to find that cause, so section 12.3 tests the fix on further mixtures.

12.3 Ground truth: further mixtures

Three more 10x human/mouse mixtures (1k, 5k and 10k cells). Mean contamination estimate against the truth:

Dataset True Decant DecontX SoupX
1k 0.014 0.011 0.011 0.010
5k 0.040 0.030 0.027 0.016
10k 0.062 0.021 0.026 0.010

Decant has the lowest error on 1k and 5k. On 10k it fails: most clusters have too few absent genes, and its per-cell values barely follow the truth (correlation 0.18, DecontX 0.67). All tools underestimate there.

When only one species is kept, each sample is a single cell line, whose soup looks like the cells. Contamination then cannot be estimated from expression; Decant warns (Chapter 11.4) while DecontX returns a number without comment.

12.3b The default rule, bayes_absent, on unused mixtures

bayes_cell removes each gene's expected ambient count, but ambient levels scatter from gene to gene, so a gene a cluster does not express keeps the excess. bayes_absent first decides whether the cluster expresses the gene at all (Chapter 7.3). It was judged on two 10x mixtures (hgmm 1k from Cell Ranger 2 and 3) that were downloaded only after the method was frozen and the pass criteria were committed:

Mean of 2 unused mixtures Endogenous retained Ambient removed
Decant bayes_absent (default) 0.9918 0.891
Decant bayes_cell 0.9945 0.531
DecontX 0.9920 0.655
SoupX 0.9931 0.529

On these mixtures it removes the most of every tool run here. It missed one pre-stated criterion: it keeps 0.02 points less than DecontX. It was made the default by the maintainer's decision anyway, and the record says so. Its costs, in numbers:

  • On the hardest mixture seen (hgmm 10k) it keeps 2.5 points less than bayes_cell (0.961 against 0.986).
  • Its gain is shown only on species mixtures. In real tissue its gene-level call almost never applies, and it then behaves as bayes_cell. On PBMC 4k it never applied and the output matched. In brain (six GSE272082 libraries, pre-registered) it applied in 1 of 42 clusters, and microglia lost the same share of genes foreign to them as with bayes_cell (0.092 against 0.091). Oligodendrocytes and astrocytes lost 2.7 points more foreign signal, from its cap rule, not its gene-level call; part of that is counts too high to be ambient.
  • Tiny clusters: the one brain cluster where it applied had 9 cells, and it called 17,543 genes absent there, which looks like a degenerate fit. Avoid it on clusters of a few cells, or merge them first.

Use correction = "bayes_cell" if keeping every native count matters most.

12.4 Ground truth: negative control

Smart-seq2 data (human islets, E-MTAB-5061) have no ambient RNA, because each cell is sorted into its own well. The ideal correction removes nothing.

Endogenous retained
Decant 0.998
SoupX 0.989
DecontX 0.952
CellBender (published) 0.797

Decant estimates almost no contamination (0.2%) and leaves the data essentially unchanged. A tool that does nothing would score 1.0 here, so this control tests only that a tool does not over-correct. Together with 12.2 it shows that Decant is conservative.

12.5 Real data without ground truth: PBMC

On the 10x PBMC 4k dataset, marker genes found in cell types that do not express them were used as a proxy for contamination.

Decant SoupX DecontX CellBender AmbiDose scAR
Removed: counts ambient RNA can explain 88–95% 76–94% 97–100% 54–98% 67–79% 99–100%
Removed: counts too high to be ambient (lower is better) 14–37% 12–31% 96–100% 4–68% 82–100% 58–82%
Own marker signal lost 1–4% 1–2% 2–6% 0–1% 0–6% 18–26%
Counts added 0 0 0 0 0 727,390
Run time 11 s 12 s 34 s 55 min 73 s 15 min

CellBender was run on CPU with a reduced configuration; it is designed for a GPU.

12.6 Reproducing the benchmarks

All scripts are in the validation/ folder of the repository and are run from the repository root.

Script What it does
benchmark_species_mixture.R Species-mixture scores (12.2)
benchmark_species_mixture_rho.R Each tool's contamination estimate against the truth
benchmark_negative_control.R Smart-seq2 negative control (12.4)
benchmark_pbmc_six_tools.R Six tools on PBMC data (12.5)
benchmark_soupx.R Decant against SoupX on real and simulated data
benchmark_differential_expression.R Correct-then-test against ambient_de()
validate_pbmc_markers.R Contamination on PBMC compared with published estimates
validate_species_mixture.R Contamination against cross-species truth on further mixtures (12.3)
validate_genotype_mixture.R Contamination against genotype truth (kidney mixture)
comparators.R Wrappers that run the official SoupX, DecontX, FastCAR and CellBender
# Requires the source repository
# From a terminal, in the repository folder:
#   Rscript validation/benchmark_species_mixture.R low_complexity
#   Rscript validation/benchmark_negative_control.R
  • Each script downloads its public dataset on first use and writes its results to validation/results/.

Previous: Chapter 11, Diagnostics and Troubleshooting | Next: Chapter 13, Function Reference

Clone this wiki locally