scvi-tools

Train deep generative models for single-cell integration, annotation, and multi-modal analysis with scvi-tools.

Updated May 28, 2026
One-click install
npx skills add https://github.com/cpanse/skills --skill scvi-tools-cpanse
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: scvi-tools
Source: https://github.com/cpanse/skills/tree/main/single-cell-ml/skills/scvi-tools
Command: npx skills add https://github.com/cpanse/skills --skill scvi-tools-cpanse

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires scvi-tools, scanpy, anndata, torch, numpy, pandas, mudata, matplotlib, scikit-learn, and includes scripts (resource) and references (resource) components.

What problem does it solve? Single-cell datasets suffer from batch effects, modality complexity, and annotation bottlenecks that classical methods handle poorly. This Skill guides deep learning-based analysis with scvi-tools, covering integration, label transfer, and multi-modal modeling in one consistent workflow. ## Core Features & Use Cases - Model Selection Guidance: Decision trees and tables map data types (scRNA-seq, CITE-seq, ATAC-seq, multiome, spatial) to the right model: scVI, scANVI, totalVI, PeakVI, MultiVI, DestVI, veloVI, or sysVI. - Ready-to-Run CLI Scripts: Chainable scripts for data validation, QC and HVG preparation, model training, clustering/UMAP, differential expression, label transfer, and multi-dataset integration. - In-Depth References: Step-by-step workflow documents covering environment setup, data preparation, and per-model analysis with troubleshooting tables. - Use Case: Integrate three scRNA-seq experiments by running validate_adata.py, prepare_data.py, train_model.py with scVI, then cluster_embed.py and differential_expression.py to produce clustered UMAPs and marker gene tables. ## Quick Start Ask the agent to integrate your h5ad single-cell datasets with scVI and produce a clustered UMAP and differential expression results.

Frequently Asked Questions about scvi-tools

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I integrate multiple scRNA-seq datasets with scVI?

Store raw counts in a layer, select 2000 highly variable genes with seurat_v3 flavor and batch_key, then call scvi.model.SCVI.setup_anndata with your batch column and train the model. The integrate_datasets.py script automates this for multiple h5ad files.

Which scvi-tools model should I use for CITE-seq data?

Use totalVI for CITE-seq data combining RNA and surface protein measurements. It requires raw RNA counts plus raw ADT protein counts stored in adata.obsm, and jointly models both modalities for integration and protein denoising.

scVI vs scANVI: when should I use each model?

Use scVI for unsupervised integration when no cell type labels exist. Use scANVI when you have cell type annotations, as it performs semi-supervised integration and enables label transfer to unannotated query datasets.

Does scvi-tools require raw counts or normalized data?

scvi-tools models require raw integer count data, not normalized or log-transformed values. Store counts in adata.layers["counts"] before any normalization and pass layer="counts" to setup_anndata.

Why does scVI training fail with CUDA out of memory?

GPU memory exhaustion happens with large datasets or batch sizes. Reduce batch_size during training, subset to fewer highly variable genes, clear the GPU cache with torch.cuda.empty_cache(), or fall back to CPU training.

How do I transfer cell type labels from a reference atlas to new data?

Train scANVI on the annotated reference, then use prepare_query_anndata and load_query_data to map the query, followed by fine-tuning and model.predict(). The transfer_labels.py script and label_transfer.md reference cover this workflow including confidence scoring.