Contextualized Differential Expression with Latent Cell-State Inference
Abstract
Standard single-cell differential expression (DE) analysis identifies genes that change across conditions, but it usually overlooks two key sources of heterogeneity that single-cell data are uniquely positioned to reveal: how disease-associated expression varies among cells within a donor, and how expression contrasts depend on cell state or subject-level context. Assigning every cell the diagnosis of its donor can contaminate DE signal when disease penetrance is partial, while modeling each gene with a single disease effect cannot capture heterogeneous responses across cell populations. We present PRISM (Phenotype-Resolved Inference in Single-cell Mixed models), a negative-binomial mixed-effects framework that augments standard DE analysis with three outputs: a context-DE vector (\boldsymbol{\theta}g) that tests whether disease effects vary along a biological axis (\mathbf{z}{ij}) (such as cell state, sex, or age); regularised cell-state responsibilities (q_{ij}) for a putative disease-associated expression component; and a subject-level state summary (\rhoi). Naive likelihood-only inference of (q{ij}) can align with nuisance variation (batch, cell cycle, or dominant subtypes) rather than the intended disease axis. We therefore introduce PRISM-OT, a closed-form one-dimensional Wasserstein-2 projection that regularises the disease-arm posterior toward an affected/unaffected marginal while preserving the likelihood-derived rank ordering of cells. In simulations, PRISM accurately recovers simulated latent-state assignments and detects context-dependent DE at (P_{\mathrm{ctx}}=95.7\%) while controlling (\mathrm{FPR}_{\alpha}=2.0\%). Applied to 73,830 ROSMAP microglia from 420 subjects, PRISM recovers Alzheimer's-consistent microglial biology in a single joint analysis. On a Perturb-seq benchmark with ground-truth cell-level labels, PRISM transfers without tuning and recovers per-construct penetrance estimates consistent with an independent proxy. PRISM is available on PyPI as prism-de.