Benchmark (v2.0)

Reproducible single-cell pseudotime deconvolution benchmark

Table of Contents

This tutorial documents the full head-to-head single-cell pseudotime deconvolution benchmark comparing MeDuSA v2.0 (model = "gp_map", default) against MeDuSA v1.0, InstaPrism (fast variational BayesPrism, initial and reference-updated modes), CIBERSORT (ν-SVR), and MuSiC (marker genes and all genes) across 5 evaluation suites (42 multi-sample tasks across real paired bulk, cross-platform transfers, and paired clean/noisy CytoTRACE trajectories, plus 2 strict leave-one-donor-out CV suites; all evaluated at 50 fixed [0, 1] pseudotime bins under a uniform single-core budget ncpu = 1 / n.core = 1).

MeDuSA v2.0 Single-Cell Pseudotime Benchmark

Figure 1. Overall accuracy and single-core fitting runtime across (a) 4 real paired bulk + scRNA-seq datasets, (b) 2 multi-donor real bulk leave-one-donor-out CV datasets (per-fold markers & held-out donor background), (c) 4 cross-platform 10x Chromium ↔ Smart-seq2 transfers, (d) 17 CytoTRACE trajectories (50/50 held-out reference cells; paired clean vs. noisy σ = 0.35), and (e) mean pooled CCC versus total single-core fitting runtime across the same 42 tasks (Suites 1, 3, 4, and 5). Error bars in a–c denote 95% cluster bootstrap CIs (B = 2,000; donor-level for Esophagus, shape-stratified for cross-platform transfers).

Reconstructed 50-Bin Pseudotime Curves

Figure 2. Reconstructed 50-bin cell-state abundance curves (square-root y-axis) versus scRNA-seq ground truth for the median-CCC sample of each of 4 real paired datasets (hPSC, Embryo, Monocytes, Esophagus) and bidirectional cross-platform Intestine transfers (SS2 → 10x and 10x → SS2, LowScore_R1). Per-sample Lin’s CCC for each method is annotated in matching color.


1. Software & Experimental Setup #

All methods receive identical bulk expression matrices (derived from one canonical bulk matrix per dataset), identical 50-bin reference grids (bin1–bin50 on [0, 1]), identical MeDuSA_marker(geneNumber = 200, method = "wilcox") signature genes (for marker-based methods), and identical background cell-type populations when non-focal cell types are present:

Method Software / Mode Key Settings
MeDuSA v2.0 MeDuSA v2.0.0 (model = "gp_map", default) REML-calibrated non-negative GP-LMM, geneWeight = "sqrt", stateCol = "exact_bin", fractional = TRUE, ncpu = 1
MeDuSA v1.0 Original MeDuSA v1.0.0 (NCS 2023) Marginal LMM + post-hoc LOESS (smooth = TRUE, span = 0.35), fractional = TRUE, ncpu = 1; mass-preserving re-gridding onto fixed [0, 1] 50 bins when endpoints are held out
InstaPrism (Ini / Upd) InstaPrism v0.1.6 (fast BayesPrism) refPrepare() on 50 trajectory bins (+ background cell types); InstaPrism(..., n.core = 1) initial (Ini) and InstaPrism_update(..., key = NA, n.core = 1) (Upd)
CIBERSORT (ν-SVR) CBS.R Mean 50-bin signature matrix on marker genes (+ background cell types), QN = FALSE, perm = 0
MuSiC (Marker / All) MuSiC::music_prop() Full expressed gene matrix passed to SingleCellExperiment for library-size & cross-subject variance estimation; markers = restricts regression only (real donor/replicate IDs; unweighted NNLS design fallback on single-cell-line Embryo)
library(MeDuSA)
library(Seurat)
library(Matrix)
library(SingleCellExperiment)
library(MuSiC)
library(InstaPrism)
library(e1071)
library(nnls)

# Source the original CIBERSORT R implementation (CBS.R)
source("CBS.R")

2. Evaluation Metrics & Cluster Bootstrap 95% CIs #

Estimated abundances over the 50 focal trajectory bins (bin1–bin50) are non-negative normalized to sum to 1 per bulk sample. We compute Pooled Lin’s CCC, Mean per-sample CCC, Mean Pearson R, RMSD, 1D Earth Mover’s Distance (EMD), and Valid_N (100% valid coverage across every suite and method):

calc_ccc = function(x, y) {
  ok = is.finite(x) & is.finite(y)
  x = x[ok]; y = y[ok]
  if (length(x) < 2L) return(NA_real_)
  mx = mean(x); my = mean(y)
  vx = var(x);  vy = var(y)
  denom = vx + vy + (mx - my)^2
  if (!is.finite(denom) || denom <= 0) return(NA_real_)
  2 * cov(x, y) / denom
}

calc_emd_1d = function(p, q) {
  mean(abs(cumsum(p) - cumsum(q)))
}

# Paired cluster bootstrap 95% CI (B = 2,000):
# - Esophagus: resamples 5 independent donors (carrying all 3 timepoints per donor)
# - Cross-Platform: stratified resample of 4 replicates within each of 5 trajectory shapes
# - Other datasets: resamples whole bulk columns (preserving within-sample 50-bin correlations)
boot_suite_ci = function(obs, pred, idx_list) {
  bvals = vapply(idx_list, function(ii) {
    calc_ccc(as.numeric(obs[, ii, drop = FALSE]), as.numeric(pred[, ii, drop = FALSE]))
  }, numeric(1))
  quantile(bvals, c(0.025, 0.975), na.rm = TRUE, names = FALSE)
}

3. Standardized Single-Core Method Wrappers #

# 1. MeDuSA v2.0 (default GP-MAP+, exact fixed 50-bin stateCol, explicit adj flag)
run_medusa_v2 = function(bulk_norm, sce, select.ct, markers, fixCov = NULL) {
  t0 = proc.time()
  obj = MeDuSA(
    bulk = bulk_norm, sce = sce, select.ct = select.ct,
    markerGene = markers, stateCol = "exact_bin",
    fixCov = fixCov, adj = !is.null(fixCov),
    resolution = 50, fractional = TRUE, ncpu = 1L, verbose = FALSE
  )
  list(ab = obj@Estimation$cell_state_abundance, Time_s = unname((proc.time() - t0)[3]))
}

# 2. InstaPrism (fast variational BayesPrism, strictly single-core)
run_instaprism = function(bulk_raw, sc_raw, ct_labels, do_update = TRUE) {
  t0 = proc.time()
  cg = intersect(rownames(bulk_raw), rownames(sc_raw))
  sc_use = as.matrix(sc_raw[cg, , drop = FALSE])
  bk_use = as.matrix(bulk_raw[cg, , drop = FALSE])
  keep_g = (Matrix::rowSums(sc_use > 0) >= 3L) & (rowSums(bk_use > 0) >= 1L)
  rf = InstaPrism::refPrepare(sc_Expr = sc_use[keep_g, , drop = FALSE],
                              cell.type.labels = ct_labels, cell.state.labels = ct_labels)
  r1 = InstaPrism::InstaPrism(bulk_Expr = bk_use[keep_g, , drop = FALSE],
                              refPhi_cs = rf, n.core = 1L, verbose = FALSE)
  out_ini = as.matrix(r1@Post.ini.ct@theta); t_ini = unname((proc.time() - t0)[3])

  out_upd = out_ini; t_upd = t_ini
  if (isTRUE(do_update) && ncol(bk_use) >= 2L) {
    r2 = InstaPrism::InstaPrism_update(r1, bulk_Expr = bk_use[keep_g, , drop = FALSE],
                                       key = NA, cell.types.to.update = "all", n.core = 1L)
    out_upd = as.matrix(r2@theta); t_upd = unname((proc.time() - t0)[3])
  }
  list(ini = list(ab = out_ini, Time_s = t_ini), upd = list(ab = out_upd, Time_s = t_upd))
}

# 3. MuSiC (full gene matrix for library-size & cross-subject variance; markers= for regression)
run_music = function(bulk_raw, sc_raw, ct_labels, sample_ids, markers = NULL) {
  t0 = proc.time()
  cg = intersect(rownames(bulk_raw), rownames(sc_raw))
  sc_use = sc_raw[cg, , drop = FALSE]
  bk_use = as.matrix(bulk_raw[cg, , drop = FALSE])
  keep_g = (Matrix::rowSums(sc_use > 0) >= 3L) & (rowSums(bk_use > 0) >= 1L)
  sc_use = sc_use[keep_g, , drop = FALSE]
  bk_use = bk_use[keep_g, , drop = FALSE]
  mk_use = if (!is.null(markers)) intersect(markers, rownames(sc_use)) else NULL

  sce_m = SingleCellExperiment::SingleCellExperiment(
    assays = list(counts = sc_use),
    colData = data.frame(cellType = ct_labels, sampleID = sample_ids, row.names = colnames(sc_use))
  )
  res = MuSiC::music_prop(
    bulk.mtx = bk_use, sc.sce = sce_m, markers = mk_use,
    clusters = "cellType", samples = "sampleID", verbose = FALSE
  )
  list(ab = t(res$Est.prop.weighted), Time_s = unname((proc.time() - t0)[3]))
}

# 4. CIBERSORT (nu-SVR on 50-bin signature profiles; requires source("CBS.R"))
run_cibersort = function(bulk_norm, sc_focal, focal_bins, markers, cov_other = NULL) {
  t0 = proc.time()
  cg = intersect(markers, intersect(rownames(bulk_norm), rownames(sc_focal)))
  if (!is.null(cov_other)) cg = intersect(cg, rownames(cov_other))
  st_u = unique(focal_bins)
  sig_mat = sapply(st_u, function(b) Matrix::rowMeans(sc_focal[cg, focal_bins == b, drop = FALSE]))
  rownames(sig_mat) = cg; colnames(sig_mat) = st_u
  if (!is.null(cov_other)) sig_mat = cbind(sig_mat, as.matrix(cov_other[cg, , drop = FALSE]))
  res = CIBERSORT(sig_matrix = as.data.frame(sig_mat),
                  mixture_file = as.data.frame(bulk_norm[cg, , drop = FALSE]),
                  perm = 0, QN = FALSE, absolute = FALSE)
  list(ab = t(res[, seq_len(ncol(sig_mat)), drop = FALSE]), Time_s = unname((proc.time() - t0)[3]))
}

4. Reproducing the 5 Benchmark Suites #

Suite 1 & 2: Real Paired Bulk + scRNA-seq & Strict Leave-One-Donor-Out CV (Panels a–b) #

Four paired bulk + scRNA-seq datasets (hPSC, Embryo, Monocytes, Esophagus) are evaluated using shared scRNA-seq references (Panel a). For the two multi-donor tissue cohorts (Monocytes: 8 paired donors / 25 reference donors; Esophagus: 5 donors / 15 bulk samples), Panel b performs donor-held-out CV given the pre-computed trajectory: inside every donor fold, all focal and background reference cells of the held-out donor are excluded, marker genes (geneNumber = 200) are re-selected strictly on training donors, and identical training background cell types are shared across all methods:

# Strict per-fold leak-free Leave-One-Donor-Out (LODO) CV loop
run_lodo = function(bulk_norm, sce, donor_bulk, donor_sc, select.ct,
                    other_mat_norm = NULL, other_ct = NULL, other_donor = NULL) {
  donors = unique(donor_bulk)
  est_list = lapply(donors, function(dn) {
    bk_cols = which(donor_bulk == dn)
    sce_tr  = sce[, which(donor_sc != dn)]
    b_sub   = bulk_norm[, bk_cols, drop = FALSE]
    mk_tr   = MeDuSA_marker(sce_tr, b_sub, geneNumber = 200, nbins = 10, method = "wilcox", ncpu = 1L)
    cov_tr  = if (!is.null(other_mat_norm)) {
      keep_o = which(other_donor != dn)
      ct_u = sort(unique(other_ct[keep_o]))
      cm = sapply(ct_u, function(ct) Matrix::rowMeans(other_mat_norm[, keep_o[other_ct[keep_o] == ct], drop = FALSE]))
      sweep(cm, 2, colSums(cm), "/") * 1000
    } else NULL
    obj = MeDuSA(
      bulk = b_sub, sce = sce_tr, select.ct = select.ct,
      markerGene = mk_tr, stateCol = "exact_bin",
      fixCov = cov_tr, adj = !is.null(cov_tr),
      resolution = 50, fractional = TRUE, ncpu = 1L, verbose = FALSE
    )
    obj@Estimation$cell_state_abundance
  })
  do.call(cbind, est_list)[, colnames(bulk_norm), drop = FALSE]
}

Suite 1 Results: 4 Real Paired Datasets (Panel a, Valid_N = 34 / 34) #

Method CCC_pool CCC_mean R_mean RMSD ↓ EMD ↓ Valid_N Fitting Time (s, 1-core)
MeDuSA v2.0 0.7000 0.6843 0.7218 0.0217 0.0662 34 / 34 2.53
MeDuSA v1.0 0.4985 0.4973 0.6183 0.0265 0.1366 34 / 34 160.52
InstaPrism (Upd) 0.3448 0.3372 0.3489 0.0357 0.1196 34 / 34 41.26
InstaPrism (Ini) 0.2555 0.2276 0.2423 0.0444 0.1393 34 / 34 29.62
CIBERSORT (ν-SVR) 0.1859 0.1824 0.1952 0.0417 0.1562 34 / 34 19.71
MuSiC (Marker) 0.1520 0.1614 0.2288 0.0834 0.1206 34 / 34 153.56
MuSiC (All) 0.1347 0.1285 0.1335 0.0718 0.1955 34 / 34 235.35

Shared single-core marker selection across all 4 real datasets (MeDuSA_marker, wilcox, 200 genes) took 56.13s total (shared identically by MeDuSA v2.0, MeDuSA v1.0, CIBERSORT, and MuSiC-Marker).

Suite 2 Results: 2 Multi-Donor Real Bulk LODO CV Datasets (Panel b, Valid_N = 23 / 23) #

Method CCC_pool CCC_mean R_mean RMSD ↓ EMD ↓ Valid_N Fitting Time (s, 1-core sum)
MeDuSA v2.0 0.6427 0.6497 0.6899 0.0172 0.0771 23 / 23 8.93
MeDuSA v1.0 0.5953 0.5967 0.6151 0.0179 0.0686 23 / 23 285.45
CIBERSORT (ν-SVR) 0.0816 0.0759 0.0872 0.0375 0.1010 23 / 23 27.42
MuSiC (Marker) 0.0691 0.0756 0.1287 0.0715 0.1302 23 / 23 725.67
InstaPrism (Ini) 0.0117 0.0035 0.0027 0.0431 0.1877 23 / 23 111.70
MuSiC (All) -0.0322 -0.0367 -0.0593 0.0727 0.2667 23 / 23 820.17

Per-fold single-core marker selection across all 13 donor folds took 213.23s total (shared across all marker-based methods).


Suite 3: Cross-Platform 10x Chromium ↔ Smart-seq2 Transfers (Panel c) #

Pseudo-bulk mixtures (5 score-profile shapes × 4 replicates = 20 samples per transfer, 1,500 cells per sample) are generated from one platform and deconvolved using the other platform as reference:

# Density-balanced trajectory pseudo-bulk generator (returns rownames on obs!)
make_trajectory_bulks = function(mat_raw, pt_norm, bins, n_per_shape = 4L,
                                 n_cells_bulk = 1500L, seed = 42L) {
  set.seed(seed)
  all_bins = paste0("bin", 1:50)
  shapes = list(
    LowScore  = function(t) stats::dnorm(t, 0.22, 0.11),
    HighScore = function(t) stats::dnorm(t, 0.78, 0.11),
    Bimodal   = function(t) 0.55 * stats::dnorm(t, 0.22, 0.09) + 0.45 * stats::dnorm(t, 0.78, 0.09),
    Skewed    = function(t) stats::dbeta(pmin(pmax(t, 1e-4), 1 - 1e-4), 2, 5),
    MidPeak   = function(t) stats::dnorm(t, 0.50, 0.14)
  )
  bin_counts = table(factor(bins, levels = all_bins))
  inv_dens = 1.0 / pmax(as.numeric(bin_counts[bins]), 1.0)

  bulks_raw = list(); obs_list = list()
  for (sn in names(shapes)) {
    p_cell = pmax(shapes[[sn]](pt_norm) * inv_dens, 0.0)
    p_cell = p_cell / sum(p_cell)
    for (r in seq_len(n_per_shape)) {
      sid = sprintf("%s_R%d", sn, r)
      sel = sample.int(ncol(mat_raw), size = n_cells_bulk, replace = TRUE, prob = p_cell)
      bulks_raw[[sid]] = as.numeric(Matrix::rowSums(mat_raw[, sel, drop = FALSE]))
      obs_list[[sid]] = as.numeric(table(factor(bins[sel], levels = all_bins))) / n_cells_bulk
    }
  }
  B_raw = do.call(cbind, bulks_raw); rownames(B_raw) = rownames(mat_raw)
  Obs   = do.call(cbind, obs_list);  rownames(Obs) = all_bins
  list(bulk_raw = B_raw, bulk_norm = sweep(B_raw, 2, colSums(B_raw), "/") * 1000, obs = Obs)
}

Suite 3 Results: 4 Cross-Platform Transfers (Panel c, Valid_N = 80 / 80) #

Method BM 10x→SS2 BM SS2→10x Int 10x→SS2 Int SS2→10x Mean CCC_pool Mean EMD ↓ Valid_N Fitting Time (s, 1-core)
MeDuSA v2.0 0.5273 0.2506 0.6270 0.5881 0.4983 (4/4) 0.1069 80 / 80 2.41
MeDuSA v1.0 0.2310 0.2463 0.5374 0.2769 0.3229 0.1445 80 / 80 56.26
InstaPrism (Upd) 0.2013 0.2015 0.3984 0.1763 0.2444 0.1313 80 / 80 31.65
InstaPrism (Ini) 0.2160 0.1050 0.2014 0.1244 0.1617 0.1393 80 / 80 15.83
CIBERSORT (ν-SVR) 0.3080 0.0392 0.1445 0.1295 0.1553 0.1531 80 / 80 58.78
MuSiC (All) 0.0698 0.1008 0.1058 0.0672 0.0859 0.1396 80 / 80 448.67
MuSiC (Marker) 0.0414 0.0587 0.0555 0.0977 0.0633 0.1267 80 / 80 61.16

Shared single-core marker selection across all 4 transfers took 33.82s total.


Suite 4 & 5: 17 Diverse CytoTRACE Trajectories (Paired Clean & Noisy σ = 0.35, Panel d) #

Each of the 17 CytoTRACE datasets is split 50/50 into disjoint reference vs. target cells. We generate 10 pseudo-bulk samples (5 shapes × 2 replicates, 1,000 cells per sample) per dataset using make_trajectory_bulks(..., n_per_shape = 2L, n_cells_bulk = 1000L) for the Clean regime, and apply multiplicative log-normal noise exp(rnorm(..., 0, 0.35)) directly to a paired copy of the exact same pseudo-bulk samples for the Noisy regime (Valid_N = 170 / 170 per regime):

Method Clean CCC_pool Clean EMD ↓ Paired Noisy (σ = 0.35) CCC_pool Noisy EMD ↓ MeDuSA v2.0 Win Rate (Clean / Noisy) Fitting Time (Clean+Noisy, s, 1-core)
MeDuSA v2.0 0.8447 0.0331 0.8077 0.0472 — 16.39
InstaPrism (Ini) 0.7766 0.0532 0.7583 0.0541 15/17 / 14/17 87.42
InstaPrism (Upd) 0.7781 0.0527 0.7135 0.0470 15/17 / 16/17 187.16
MeDuSA v1.0 0.7614 0.0738 0.6532 0.1007 15/17 / 17/17 262.83
MuSiC (All) 0.7734 0.0221 0.5460 0.0400 14/17 / 17/17 1402.85
MuSiC (Marker) 0.5492 0.0248 0.2304 0.0531 17/17 / 17/17 553.34
CIBERSORT (ν-SVR) 0.2072 0.1409 0.1561 0.1522 17/17 / 17/17 288.50

Shared single-core marker selection across all 17 CytoTRACE datasets took 81.56s total.


5. Benchmark Datasets #

For complete dataset accessions and download links, see the Data page.