scvi-tools Deep Learning Skill

SkillMonitoring & ops

Train official scvi-tools models (scVI/scANVI/totalVI/PeakVI/MultiVI/veloVI) on raw counts after the scRNA gold chain. Use for probabilistic batch integration or those named models. Does not run DestVI/Cell2location. Do not log-normalize before setup_anndata.

Instructions available. Your AI can read the instructions. Execution depends on the setup they require.

Add ahel to your AI once: Claude, ChatGPT, Cursor, Claude Code or Codex. Then ask it to use this.

Then ask your AI: use the scvi-tools Deep Learning Skill skill

What this skill tells your AI

The instructions your AI receives, as published by herry423/bionexus in skills/scvi-tools/SKILL.md and read by ahel’s review.

Train official scvi-tools models. Use after the scRNA gold chain (or on raw counts). Do not log-normalize before setup_anndata.

Pins and pitfalls live in bionexus.versions (scvi-tools 1.1+, train on counts only).

When to Use This Skill

  • When scvi-tools, scVI, scANVI, or related deep generative models are mentioned
  • When deep learning-based batch correction or multi-study integration is needed
  • When automated hyperparameter tuning is required for latent dimensions, layer depths, or learning rates
  • When working with multi-modal data (CITE-seq, multiome)
  • When reference mapping or label transfer is required
  • When analyzing ATAC-seq or spatial transcriptomics data

CLI Scripts

ScriptPurposeUsage
prepare_data.pyQC, filter, HVG selectionpython scripts/prepare_data.py raw.h5ad prepared.h5ad --batch-key batch
hyperparam_search.pyAutomated hyperparameter optimizationpython scripts/hyperparam_search.py prepared.h5ad results/ --model scvi --n-trials 20 --batch-key batch
train_model.pyTrain any scvi-tools modelpython scripts/train_model.py prepared.h5ad results/ --model scvi --batch-key batch
cluster_embed.pyNeighbors, UMAP, Leidenpython scripts/cluster_embed.py adata.h5ad results/
differential_expression.pyProbabilistic DE analysispython scripts/differential_expression.py model/ adata.h5ad de.csv --groupby leiden
transfer_labels.pyLabel transfer with scANVIpython scripts/transfer_labels.py ref_model/ query.h5ad results/
integrate_datasets.pyMulti-dataset integrationpython scripts/integrate_datasets.py results/ data1.h5ad data2.h5ad
validate_adata.pyCheck data compatibilitypython scripts/validate_adata.py data.h5ad --batch-key batch
scvi_smoke.py1-epoch scVI on layers['counts']python scripts/scvi_smoke.py prepared.h5ad -o smoke.h5ad

Automated Hyperparameter Search (scripts/hyperparam_search.py)

Tune latent dimensions (n_latent), network depth (n_layers), hidden layer width (n_hidden), gene likelihood (nb vs zinb), and learning rates:

# Bayesian hyperparameter optimization with Optuna
python scripts/hyperparam_search.py prepared.h5ad tuning_results/ \
    --model scvi \
    --batch-key batch \
    --n-trials 20 \
    --epochs-per-trial 35 \
    --retrain-best

Outputs include:

  • hyperparam_tuning_summary.json: Detailed trial records and best hyperparameter configuration
  • optimal_model/: Saved scvi model trained with the best parameter combination
  • adata_optimal.h5ad: AnnData annotated with optimal latent representations

Signals

GitHub stars
31
Forks
4
Last commit
Sep 2026

ahel review

  • K1binfo
    installs-packages (in scripts/cluster_embed.py)
  • K1binfo
    installs-packages (in scripts/hyperparam_search.py)
  • K1binfo
    installs-packages (in scripts/prepare_data.py)
  • K1binfo
    installs-packages (in scripts/train_model.py)
  • K1binfo
    installs-packages (in scripts/validate_adata.py)
  • K1binfo
    installs-packages (in references/environment_setup.md)
  • K1binfo
    installs-packages (in references/scrna_integration.md)
  • K1binfo
    installs-packages (in references/troubleshooting.md)

Automated review, not a security audit. Ruleset v1+k2.

Advanced
Item type
skill
Key
scvi-tools-herry423
Source
github.com/herry423/bionexus