User#

Import scvi-tools as:

import scvi

Model#

model.AUTOZI

Automatic identification of zero-inflated genes [Clivio et al., 2019].

model.CondSCVI

Conditional version of single-cell Variational Inference.

model.DestVI

Multi-resolution deconvolution of Spatial Transcriptomics data (DestVI) [Lopez et al., 2022].

model.LinearSCVI

Linearly-decoded VAE [Svensson et al., 2020].

model.PEAKVI

Peak Variational Inference for chromatin accessilibity analysis [Ashuach et al., 2022].

model.SCANVI

Single-cell annotation using variational inference [Xu et al., 2021].

model.SCVI

single-cell Variational Inference [Lopez et al., 2018].

model.TOTALVI

total Variational Inference [Gayoso et al., 2021].

model.MULTIVI

Integration of multi-modal and single-modality data [Ashuach et al., 2023].

model.AmortizedLDA

Amortized Latent Dirichlet Allocation [Blei et al., 2003].

model.JaxSCVI

EXPERIMENTAL single-cell Variational Inference [Lopez et al., 2018], but with JAX.

External models#

external.CellAssign

Reimplementation of CellAssign for reference-based annotation [Zhang et al., 2019].

external.GIMVI

Joint VAE for imputing missing genes in spatial data [Lopez et al., 2019].

external.RNAStereoscope

Reimplementation of Stereoscope [Andersson et al., 2020].

external.SpatialStereoscope

Reimplementation of Stereoscope [Andersson et al., 2020].

external.SOLO

Doublet detection in scRNA-seq [Bernstein et al., 2020].

external.SCAR

Ambient RNA removal in scRNA-seq data [Sheng et al., 2022].

external.Tangram

Reimplementation of Tangram [Biancalani et al., 2021].

external.SCBASSET

EXPERIMENTAL Reimplementation of scBasset [Yuan and Kelley, 2022].

external.ContrastiveVI

contrastive variational inference [Weinberger et al., 2023].

external.POISSONVI

Peak Variational Inference using a Poisson distribution [Martens et al., 2023].

external.VELOVI

BETA Velocity Variational Inference [Gayoso et al., 2023].

external.MRVI

Multi-resolution Variational Inference (MrVI) [Boyeau et al., 2024].

Data loading#

scvi-tools relies entirely on the AnnData format. For convenience, we have included data loaders from the AnnData API. Scanpy also has utilities to load data that are outputted by 10x’s Cell Ranger software.

data.read_h5ad

Read .h5ad-formatted hdf5 file.

data.read_csv

Read .csv file.

data.read_loom

Read .loom-formatted hdf5 file.

data.read_text

Read .txt, .tab, .data (text) file.

data.read_10x_atac

Read scATAC-seq data outputted by 10x Genomics software.

data.read_10x_multiome

Read Multiome (scRNA + scATAC) data outputted by 10x Genomics software.

Basic preprocessing#

For general single-cell preprocessing, we defer to our friends at Scanpy, and specifically their preprocessing module (scanpy.pp).

All scvi-tools models require raw UMI count data. The count data can be safely stored in an AnnData layer as one of the first steps of a Scanpy single-cell workflow:

adata.layers["counts"] = adata.X.copy()

Here we maintain a few package specific utilities for feature selection, etc.

data.poisson_gene_selection

Rank and select genes based on the enrichment of zero counts.

data.organize_cite_seq_10x

Organize anndata object loaded from 10x for scvi models.

data.organize_multiome_anndatas

Concatenate multiome and single-modality input anndata objects.

data.add_dna_sequence

Add DNA sequence to AnnData object.

data.reads_to_fragments

Convert scATAC-seq read counts to appoximate fragment counts.

Model hyperparameter tuning#

scvi-tools supports automatic model hyperparameter tuning using Ray Tune.

autotune.run_autotune

BETA Run a hyperparameter sweep.

autotune.AutotuneExperiment

BETA Track hyperparameter tuning experiments.

Model hub#

We have a hub for pre-trained scvi-tools models that is hosted on huggingface. Using the functionality that scvi-tools provides, users can download pre-trained scvi-tools models (and datasets) from this platform, and model generators can upload their own pre-trained scvi-tools models to this platform.

hub.HubMetadata

Encapsulates the required metadata for scvi-tools hub models.

hub.HubModelCardHelper

A helper for creating a ModelCard for scvi-tools hub models.

hub.HubModel

Wrapper for BaseModelClass backed by HuggingFace Hub.

Model criticism#

criticism.PosteriorPredictiveCheck

EXPERIMENTAL Posterior predictive checks for comparing scRNA-seq generative models.

Utilities#

Here we maintain miscellaneous general methods.

model.utils.mde

Util to run pymde.preserve_neighbors() for visualization of scvi-tools embeddings.

model.utils.get_minified_adata_scrna

Returns a minified adata that works for most scrna models (such as SCVI, SCANVI).

Configuration#

An instance of the ScviConfig is available as scvi.settings and allows configuring scvi-tools.

_settings.ScviConfig

Config manager for scvi-tools.