Skip to main content

PRISM

Phenotype-Resolved Inference in Single-cell Mixed models via latent disease states and contextualized differential expression

Not every cell from a disease donor is in a disease state. PRISM is a negative-binomial mixed model for multi-donor single-cell RNA-seq. For each cell of a disease donor it infers the posterior probability q that the cell is in the disease state (cells from control donors are fixed to the healthy state). It then estimates, per gene, a constant disease effect alpha and its modulation by cell-level context z, theta. Parameters are fit by EM.

Install

pip install prism-de

The import name is prism. PRISM needs PyTorch >= 2.2. For a GPU, first install the torch build that matches your CUDA driver (pytorch.org). Fits default to device="cuda", so pass device="cpu" if you have no GPU.

Quick start

from prism import PRISMConfig, PRISMTrainer, generate_prism_data

data, truth = generate_prism_data(n_subjects=50, n_genes=60, n_cells_per_subject=200,
                                  rho=0.6, seed=42, device="cpu")

cfg = PRISMConfig(n_genes=data.n_genes, n_covars=data.n_covars, n_context=data.n_context,
                  ot_project_q=True, auto_q_prior=False,  # PRISM-OT, the configuration used in the paper
                  max_em_iter=30, wandb_enabled=False, device="cpu")
res = PRISMTrainer(cfg).fit(data)

print("general DE (FDR < 0.05):", int((res.q_values_de < 0.05).sum()))
print("context DE (FDR < 0.05):", int((res.q_values_context.min(dim=1).values < 0.05).sum()))

The fit takes about 4 minutes on a 4-core CPU. wandb_enabled=False turns off Weights & Biases logging, which is on by default whenever wandb is installed.

Your data

PrismData.from_anndata reads raw counts from adata.X and per-cell columns from adata.obs. Include an intercept column among the covariates, and standardise continuous covariates and context variables.

from prism import PrismData

adata.obs["intercept"] = 1.0
data = PrismData.from_anndata(adata, covar_cols=["intercept", "age", "sex"], context_cols=["ctx"],
                              condition_col="disease", subject_col="donor", device="cuda")

Then fit it with the configuration above, using device="cuda".

Outputs

field shape meaning
res.q_hat (cells,) posterior probability that each cell is in the disease state (0 for control donors)
res.rho_hat (disease donors,) fraction of each disease donor's cells in the disease state
res.alpha_de_hat (genes,) constant disease effect (natural-log fold change)
res.theta_hat (genes, context dims) context modulation of the disease effect
res.q_values_de (genes,) BH-adjusted p-values for H0: alpha = 0 (general DE)
res.q_values_context (genes, context dims) BH-adjusted p-values for H0: theta = 0 (context DE)

res.de_summary(gene_names=...) returns the per-gene estimates and tests as a pandas DataFrame.

Citation

PRISM: Phenotype-Resolved Inference in Single-Cell Mixed Models via Latent Disease States and Contextualized Differential Expression. NeurIPS 2026. See the documentation for the BibTeX entry.

License

MIT

Release files for prism-de 1.0.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for prism-de 1.0.0
File Size Uploaded
prism_de-1.0.0.tar.gz 123.4 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for prism-de 1.0.0
File Interpreter ABI Platform
prism_de-1.0.0-py3-none-any.whl Python 3 none any Details

Total release size: 247.1 kB

Release files / prism_de-1.0.0.tar.gz

Download URL prism_de-1.0.0.tar.gz
Size 123.4 kB
Tags Source
SHA-256 checksum
How to use checksums
defbd572f5ec95048a1648d0f294b16a1a16af500d255d178de9be6a7697b6d3
BLAKE2b-256 checksum
How to use checksums
a306592490b98512c06e436c8b5cccf1d03e82dd4e0d5cc40ad022c026bcfdcf
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 25, 2026.

Transparency log

Release files / prism_de-1.0.0-py3-none-any.whl

Download URL prism_de-1.0.0-py3-none-any.whl
Size 123.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
2ebc2586fd59e700ca0a1fdb141228798fdb92f247cbaffe6a1a8d9d9e21f34c
BLAKE2b-256 checksum
How to use checksums
3d27023d188b5306e8ff0ff2dcf5b127a1fa7df20a77f141ddecb7c3b8efd14e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 25, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

1.0.0 This release

2 release files

0.2.0

2 release files

0.1.1

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page