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

Metadata

Release files for prism-de 1.0.1

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.1
File Size Uploaded Provenance Actions
prism_de-1.0.1.tar.gz 123.5 kB With provenance Details for prism_de-1.0.1.tar.gz

Built distribution (wheel)

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

Total release size: 247.2 kB

Release files / prism_de-1.0.1.tar.gz

Download URL prism_de-1.0.1.tar.gz
Size 123.5 kB
Tags Source
SHA-256 checksum
How to use checksums
6b9b7d88c72da8df84e33b98d0ce5c9855b1171a5e90849b7d4d64388231a567
BLAKE2b-256 checksum
How to use checksums
a30f482cbabf4d5650dbc36992b1b80266efa5fc363f7b4dcbc565f5602bc921
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 26, 2026.

Transparency log

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

Download URL prism_de-1.0.1-py3-none-any.whl
Size 123.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
885ce0a0858f1cedb07a1d72a42eb4856071275c46b9db916327b74615f5e20c
BLAKE2b-256 checksum
How to use checksums
3939d396ad2fde4cf488b95e7852f089312e8efa665ff052c6359af0e6a11681
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 26, 2026.

Transparency log

Security for prism-de 1.0.1

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.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for prism_de-1.0.1.tar.gz

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 26, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

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