$npx -y skills add anthropics/knowledge-work-plugins --skill scvi-toolsDeep learning for single-cell analysis using scvi-tools. This skill should be used when users need (1) data integration and batch correction with scVI/scANVI, (2) ATAC-seq analysis with PeakVI, (3) CITE-seq multi-modal analysis with totalVI, (4) multiome RNA+ATAC analysis with Mu
| 1 | # scvi-tools Deep Learning Skill |
| 2 | |
| 3 | This skill provides guidance for deep learning-based single-cell analysis using scvi-tools, the leading framework for probabilistic models in single-cell genomics. |
| 4 | |
| 5 | ## How to Use This Skill |
| 6 | |
| 7 | 1. Identify the appropriate workflow from the model/workflow tables below |
| 8 | 2. Read the corresponding reference file for detailed steps and code |
| 9 | 3. Use scripts in `scripts/` to avoid rewriting common code |
| 10 | 4. For installation or GPU issues, consult `references/environment_setup.md` |
| 11 | 5. For debugging, consult `references/troubleshooting.md` |
| 12 | |
| 13 | ## When to Use This Skill |
| 14 | |
| 15 | - When scvi-tools, scVI, scANVI, or related models are mentioned |
| 16 | - When deep learning-based batch correction or integration is needed |
| 17 | - When working with multi-modal data (CITE-seq, multiome) |
| 18 | - When reference mapping or label transfer is required |
| 19 | - When analyzing ATAC-seq or spatial transcriptomics data |
| 20 | - When learning latent representations of single-cell data |
| 21 | |
| 22 | ## Model Selection Guide |
| 23 | |
| 24 | | Data Type | Model | Primary Use Case | |
| 25 | |-----------|-------|------------------| |
| 26 | | scRNA-seq | **scVI** | Unsupervised integration, DE, imputation | |
| 27 | | scRNA-seq + labels | **scANVI** | Label transfer, semi-supervised integration | |
| 28 | | CITE-seq (RNA+protein) | **totalVI** | Multi-modal integration, protein denoising | |
| 29 | | scATAC-seq | **PeakVI** | Chromatin accessibility analysis | |
| 30 | | Multiome (RNA+ATAC) | **MultiVI** | Joint modality analysis | |
| 31 | | Spatial + scRNA reference | **DestVI** | Cell type deconvolution | |
| 32 | | RNA velocity | **veloVI** | Transcriptional dynamics | |
| 33 | | Cross-technology | **sysVI** | System-level batch correction | |
| 34 | |
| 35 | ## Workflow Reference Files |
| 36 | |
| 37 | | Workflow | Reference File | Description | |
| 38 | |----------|---------------|-------------| |
| 39 | | Environment Setup | `references/environment_setup.md` | Installation, GPU, version info | |
| 40 | | Data Preparation | `references/data_preparation.md` | Formatting data for any model | |
| 41 | | scRNA Integration | `references/scrna_integration.md` | scVI/scANVI batch correction | |
| 42 | | ATAC-seq Analysis | `references/atac_peakvi.md` | PeakVI for accessibility | |
| 43 | | CITE-seq Analysis | `references/citeseq_totalvi.md` | totalVI for protein+RNA | |
| 44 | | Multiome Analysis | `references/multiome_multivi.md` | MultiVI for RNA+ATAC | |
| 45 | | Spatial Deconvolution | `references/spatial_deconvolution.md` | DestVI spatial analysis | |
| 46 | | Label Transfer | `references/label_transfer.md` | scANVI reference mapping | |
| 47 | | scArches Mapping | `references/scarches_mapping.md` | Query-to-reference mapping | |
| 48 | | Batch Correction | `references/batch_correction_sysvi.md` | Advanced batch methods | |
| 49 | | RNA Velocity | `references/rna_velocity_velovi.md` | veloVI dynamics | |
| 50 | | Troubleshooting | `references/troubleshooting.md` | Common issues and solutions | |
| 51 | |
| 52 | ## CLI Scripts |
| 53 | |
| 54 | Modular scripts for common workflows. Chain together or modify as needed. |
| 55 | |
| 56 | ### Pipeline Scripts |
| 57 | |
| 58 | | Script | Purpose | Usage | |
| 59 | |--------|---------|-------| |
| 60 | | `prepare_data.py` | QC, filter, HVG selection | `python scripts/prepare_data.py raw.h5ad prepared.h5ad --batch-key batch` | |
| 61 | | `train_model.py` | Train any scvi-tools model | `python scripts/train_model.py prepared.h5ad results/ --model scvi` | |
| 62 | | `cluster_embed.py` | Neighbors, UMAP, Leiden | `python scripts/cluster_embed.py adata.h5ad results/` | |
| 63 | | `differential_expression.py` | DE analysis | `python scripts/differential_expression.py model/ adata.h5ad de.csv --groupby leiden` | |
| 64 | | `transfer_labels.py` | Label transfer with scANVI | `python scripts/transfer_labels.py ref_model/ query.h5ad results/` | |
| 65 | | `integrate_datasets.py` | Multi-dataset integration | `python scripts/integrate_datasets.py results/ data1.h5ad data2.h5ad` | |
| 66 | | `validate_adata.py` | Check data compatibility | `python scripts/validate_adata.py data.h5ad --batch-key batch` | |
| 67 | |
| 68 | ### Example Workflow |
| 69 | |
| 70 | ```bash |
| 71 | # 1. Validate input data |
| 72 | python scripts/validate_adata.py raw.h5ad --batch-key batch --suggest |
| 73 | |
| 74 | # 2. Prepare data (QC, HVG selection) |
| 75 | python scripts/prepare_data.py raw.h5ad prepared.h5ad --batch-key batch --n-hvgs 2000 |
| 76 | |
| 77 | # 3. Train model |
| 78 | python scripts/train_model.py prepared.h5ad results/ --model scvi --batch-key batch |
| 79 | |
| 80 | # 4. Cluster and visualize |
| 81 | python scripts/cluster_embed.py results/adata_trained.h5ad results/ --resolution 0.8 |
| 82 | |
| 83 | # 5. |