Skip to main content

Documentation PyPI License

PerturbVI

Perturbvi is a scalable approach to infer regulatory modules through informative latent component model in the single-cell Perturb-seq data.

Install

uv pip install perturbvi

Quick start

From AnnData (recommended)

Prepare the file with transformed expression in adata.X and the binary perturbation matrix in adata.obsm["G"], then load and fit:

from perturbvi import fit_screen, load_screen, residualize_screen

data = load_screen(
    "screen.h5ad",
    x_key=None,  # None (Default) = adata.X
    g_key="G",  # "G" (Default) = adata.obsm["G"]
    control=None,
)

data = load_screen(
    "screen.h5ad",
    x_key="transformed",  # adata.layers["transformed"]
    g_key="G",  # "G" (Default) = adata.obsm["G"]
    control=None,
)

data = load_screen(
    "screen.h5ad",
    x_key="counts",  # adata.layers["counts"]
    g_key="perturbations",  # adata.obsm["perturbations"]
    control="Nontargeting",  # drop the reference column
)

data = residualize_screen(data)  # optional; only if you loaded covariates

fit = fit_screen(data, z_dim=12, l_dim=400, tau=50)

Same workflow from the CLI:

perturbvi fit screen.h5ad \
  --output results \
  --z-dim 12 --l-dim 400 --tau 50

Omit --control when G is baseline-free; add --control Nontargeting when G keeps its reference column.

perturbvi analyze results

Already have X and G? (arrays or CSV)

PerturbData keeps expression, perturbations, and covariates aligned:

Argument Shape Contents
X cells × genes Normalized, scaled, or transformed expression
G cells × perturbations Binary guide or target assignments
covariates cells × covariates Variables whose effects should be removed from expression
control label Reference column to drop from G (default: none)
from perturbvi import PerturbData, fit_screen, residualize_screen

# control= drops the reference column; omit it when G is baseline-free
data = PerturbData(
    X=expression,
    G=G,
    covariates=covariates,
    control="Nontargeting",
)

data = residualize_screen(data)  # optional

fit = fit_screen(data, z_dim=12, l_dim=400, tau=50)

X and G are both required, and their rows must refer to the same cells in the same order. Read CSV/TSV files with pandas first, then pass the resulting DataFrames so gene and perturbation names stay aligned.

fit_screen() always centers each gene across cells. If your expression is not already scaled, pass standardize=True to also divide each gene by its standard deviation, giving every gene unit variance.

control= names a reference column in G to drop (for example "Nontargeting"). Omit it when G is already baseline-free.

See the Workflow for complete input and analysis guidance and the Input structure page for where each piece of a screen lives in an AnnData file. The Cookbook for real Datlinger, Norman, and Adamson screens.

Documentation

  • Workflow: constructing X and G, names, covariates, fitting, saving, and analysis.
  • Input structure: AnnData layout for X, G, and covariates.
  • Cookbook: real LUHMES, Datlinger, Adamson, Norman, and A375 10x examples.
  • API: Python functions, CLI options, result tables, and saved files.

Support

Please report bugs or feature requests in the issue tracker. For questions or comments, contact Abdullah Al Nahid (alnahid@usc.edu) or Nicholas Mancuso (nmancuso@usc.edu).

Other Software

Other software developed by the Mancuso Lab:

  • SuShiE: a Bayesian fine-mapping framework for molecular QTL data across multiple ancestries.
  • jaxQTL: scalable, count-based large-scale eQTL mapping.
  • MA-FOCUS: a Bayesian fine-mapping framework using TWAS statistics across multiple ancestries to identify causal genes for complex traits.
  • SuSiE-PCA: scalable Bayesian variable selection for sparse principal component analysis.
  • twas_sim: simulation of TWAS statistics.
  • traceax: stochastic trace estimation for linear operators.
  • FactorGo: scalable variational factor analysis for learning pleiotropic factors from GWAS summary statistics.
  • HAMSTA: estimation of heritability explained by local ancestry data from admixture mapping summary statistics.

PerturbVI is distributed under the terms of the MIT license.

Metadata

Release files for perturbvi 0.2.6

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

Source distribution (sdist)

Source distribution for perturbvi 0.2.6
File Size Uploaded
perturbvi-0.2.6.tar.gz 33.2 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for perturbvi 0.2.6
File Interpreter ABI Platform
perturbvi-0.2.6-py3-none-any.whl Python 3 none any Details

Total release size: 72.9 kB

Release files / perturbvi-0.2.6.tar.gz

Download URL perturbvi-0.2.6.tar.gz
Size 33.2 kB
Tags Source
SHA-256 checksum
How to use checksums
c607c5ad947cb1adbdc0335c8a54497fd5ab4467c8bdb94492ba73233f2057b0
BLAKE2b-256 checksum
How to use checksums
5e0516d720fa299ff46a63eac096bee78a831a4381ab4468cd8fad7eb65576aa
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.9.28 {"installer":{"name":"uv","version":"0.9.28","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":null,"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Release files / perturbvi-0.2.6-py3-none-any.whl

Download URL perturbvi-0.2.6-py3-none-any.whl
Size 39.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
b5de287694491ddaad60501c8a00bd956a6daf4ac72cae24996631a96497596b
BLAKE2b-256 checksum
How to use checksums
46924142a382585ee28c918e839561e3d031cf93eed77f6599d87a07265535db
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.9.28 {"installer":{"name":"uv","version":"0.9.28","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":null,"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Release history Release notifications | RSS feed

0.3.2

2 release files

0.3.1

2 release files

0.3.0

2 release files

This release

0.2.6 This release

2 release files

0.2.5

2 release files

0.2.4

2 release files

0.2.3

2 release files

0.2.2

2 release files

0.2.1

2 release files

0.2.0

2 release files

0.1.9

2 release files

0.1.8

2 release files

0.1.7

2 release files

0.1.6

2 release files

0.1.5

2 release files

0.1.4

2 release files

0.1.3

2 release files

0.1.2

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