scientific-skills/Data Analysis/scvi-tools/SKILL.md
Deep generative models for single-cell omics; use when you need probabilistic batch correction (scVI), transfer learning, uncertainty-aware differential expression, or multimodal integration (totalVI/MultiVI).
npx skillsauth add aipoch/medical-research-skills scvi-toolsInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
4 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Use scvi-tools when you need probabilistic, model-based single-cell analysis beyond standard pipelines (e.g., beyond typical Scanpy workflows), such as:
setup_anndata(...) → Model(adata) → train() → get_*() across model families.setup_anndata.Model catalogs by modality (for reference):
references/models-scrna-seq.md (scVI, scANVI, AUTOZI, VeloVI, contrastiveVI, …)references/models-atac-seq.md (PeakVI, PoissonVI, scBasset, …)references/models-multimodal.md (totalVI, MultiVI, MrVI, …)references/models-spatial.md (DestVI, Stereoscope, Tangram, scVIVA, …)references/models-specialized.md (Solo, CellAssign, MethylVI/MethylANVI, CytoVI, …)scvi-tools (latest compatible with your environment)python>=3.9pytorch>=2.0pytorch-lightning>=2.0 (or lightning depending on scvi-tools version)anndata>=0.8scanpy>=1.9Installation example:
uv pip install scvi-tools
# Optional GPU extras (package extra name may vary by platform/version)
uv pip install "scvi-tools[cuda]"
A complete runnable example using scVI for batch correction + latent embedding, then Scanpy for neighbors/UMAP/clustering:
import scanpy as sc
import scvi
# 1) Load example data (AnnData)
adata = scvi.data.heart_cell_atlas_subsampled()
# 2) Minimal preprocessing (keep raw counts available)
sc.pp.filter_genes(adata, min_counts=3)
sc.pp.highly_variable_genes(adata, n_top_genes=1200)
# 3) Register AnnData for scVI (raw counts + covariates)
scvi.model.SCVI.setup_anndata(
adata,
layer="counts", # raw counts layer (not log-normalized)
batch_key="batch", # batch column in adata.obs
categorical_covariate_keys=["donor"],
continuous_covariate_keys=["percent_mito"],
)
# 4) Train model
model = scvi.model.SCVI(adata)
model.train()
# 5) Extract outputs
adata.obsm["X_scVI"] = model.get_latent_representation()
adata.layers["scvi_normalized"] = model.get_normalized_expression(library_size=1e4)
# 6) Downstream analysis with Scanpy
sc.pp.neighbors(adata, use_rep="X_scVI")
sc.tl.umap(adata)
sc.tl.leiden(adata)
# Optional: uncertainty-aware differential expression
de = model.differential_expression(
groupby="cell_type",
group1="TypeA",
group2="TypeB",
mode="change",
delta=0.25,
)
print(de.head())
Model persistence:
model.save("./scvi_model", overwrite=True)
model2 = scvi.model.SCVI.load("./scvi_model", adata=adata)
layer="counts" or ensure adata.X contains counts.batch_key, donor, QC metrics) are incorporated through setup_anndata, enabling the model to learn representations that reduce unwanted variation.train() performs amortized inference using neural networks shared across cells; GPU acceleration is used automatically when configured.get_latent_representation() returns batch-corrected embeddings suitable for neighbors/UMAP/clustering in Scanpy.differential_expression(...) performs posterior-based comparisons; parameters like:
mode="change": composite hypothesis testing on changesdelta: minimum effect size thresholdreferences/differential-expression.md for interpretation guidance.references/models-*.md files.references/theoretical-foundations.md.tools
Generates complete conventional oncology bulk-transcriptome biomarker and hub-gene research designs from a user-provided cancer type and study direction. Always use this skill whenever a user wants to design, plan, or build a tumor bioinformatics study centered on differential expression, prognostic filtering or risk modeling, PPI-based hub-gene prioritization, diagnostic/prognostic evaluation, clinical association, immune infiltration context, methylation context, and optional tissue or cell validation. Covers five study patterns (signature-first prognostic workflow, hub-gene-first biomarker workflow, hybrid signature-to-hub workflow, immune-context biomarker workflow, translational validation workflow) and always outputs four workload configs (Lite / Standard / Advanced / Publication+) with recommended primary plan, step-by-step workflow, figure plan, validation strategy, minimal executable version, publication upgrade path...
development
Generates complete conventional non-oncology bioinformatics research designs from a user-provided disease context, process-related gene family or biological theme, and validation direction. Use when a study centers on multi-dataset bulk transcriptome integration, DEG analysis, process-gene intersection, enrichment analysis, GSEA, PPI hub-gene prioritization, TF/miRNA regulatory networks, ROC-based biomarker evaluation, and immune infiltration analysis. Covers five study patterns (process-DEG discovery, enrichment/GSEA interpretation, hub-gene prioritization, regulatory-network and immune interpretation, multi-layer public validation) and always outputs Lite / Standard / Advanced / Publication+ with a recommended primary plan, stepwise workflow, figure plan, validation hierarchy, minimal executable version, publication upgrade path, and strictly verified literature retrieval.
tools
Plans confounder control, variable adjustment logic, and bias mitigation strategies at the protocol stage for clinical, epidemiologic, translational, observational, and biomarker studies. Always use this skill when a user needs to identify major confounders, decide which variables should or should not be adjusted for, compare matching/stratification/weighting approaches, anticipate selection or measurement bias, or pressure-test a study design before execution. Focus on bias sensing, causal structure awareness, variable-role classification, and critical design review rather than generic statistical advice.
testing
Generates complete comparative network-toxicology research designs from a user-provided exposure pair, shared toxic phenotype, and validation direction. Use when a study centers on two related exposures under one outcome and needs target collection, shared-vs-specific target decomposition, enrichment, PPI hub prioritization, docking, optional transcriptomic cross-checks, and conservative mechanistic synthesis. Covers five study patterns and always outputs Lite / Standard / Advanced / Publication+ with a recommended primary plan, stepwise workflow, figure plan, validation hierarchy, minimal executable version, publication upgrade path, and strictly verified literature retrieval.