Skills

Scvi Tools

Probabilistic single-cell RNA-seq with scvi-tools, scVI for a batch-corrected latent...

Install

npx skills add aipoch/open-science --skill scvi-tools -g -a claude-code -y
Repository
aipoch/open-science5.4k
Category
Engineering
Updated
3d ago
License
Apache-2.0
Context cost
Mediumabout 3,000 tokens
Runs scripts
Yes, review before use

What it does

Probabilistic single-cell RNA-seq with scvi-tools, scVI for a batch-corrected latent space, scANVI for semi-supervised label transfer, and Bayesian differential expression. Reach for this skill to integrate scRNA-seq batches, embed cells for clustering, transfer annotations from a reference onto a query, or score differentially expressed genes per cluster. For spatial deconvolution / mapping use the cell2location, DestVI, or Tangram methods instead.

scvi-tools, scVI / scANVI

scvi-tools (Gayoso et al. 2022, github.com/scverse/scvi-tools, BSD-3-Clause) wraps a family of deep generative models for single-cell omics. The scRNA-seq core is scVI (unsupervised batch-corrected latent embedding) and scANVI (scVI + a classifier head for semi-supervised cell-type label transfer). Both expect raw integer UMI counts and emit a low-dimensional X_scVI / X_scANVI that drops into the scanpy neighbors → leiden → umap pipeline.

Setup (any agent, no API key)

This is a pure skill, kernel.py is deterministic Python and you (the base model) do all the reasoning. There is no host runtime and no LLM API. The helpers are prepare_scvi_counts for input validation and h5ad_safe_obs for obs/var frames that anndata.write_h5ad() can serialize. Load them once per session in a Python cell:

exec(open("scvi-tools/kernel.py", encoding="utf-8").read())   # path to this skill's kernel.py

Nothing auto-loads it outside Claude Science. Then call the helpers directly. If a helper raises NameError, you haven't exec'd kernel.py.

Dependencies: pip install scvi-tools scanpy anndata. Training needs a CUDA-capable GPU, see Remote compute to fall out to a rented GPU when you don't have one locally.

How to run

scVI, batch-corrected latent space

prepare_scvi_counts(adata) checks and preserves existing counts. If absent, it checks .X before copying it to counts. Values must be finite, nonnegative, and integer-valued, with at least one positive count. Invalid existing counts raise instead of being replaced by .X; sparse matrices stay sparse.

Read the whole SKILL.md on GitHub

More in Engineering