{"slug":"alterlab-scgpt","title":"alterlab-scgpt","summary":"Apply the scGPT single-cell foundation model (Cui 2024) to annotate and embed cells — zero-shot and fine-tuned cell-type annotation, gene/cell embeddings, batch integration, and gene-regulatory / perturbation inference from AnnData. Use when annotating cell types with a pretraine","platform":"Claude","tags":[],"authorName":"LLM Mart","authorSlug":"llm-mart","score":0,"source":"github","price":null,"verified":false,"createdAt":"2026-09-23T18:56:57.666936Z","repo":{"url":"https://github.com/AlterLab-IEU/AlterLab-Academic-Skills","stars":68,"forks":13,"license":"MIT","updatedAt":"2026-09-23T13:42:59Z"},"bodyHtml":"<hr>\n<h2>name: alterlab-scgpt\ndescription: Apply the scGPT single-cell foundation model (Cui 2024) to annotate and embed cells — zero-shot and fine-tuned cell-type annotation, gene/cell embeddings, batch integration, and gene-regulatory / perturbation inference from AnnData. Use when annotating cell types with a pretrained foundation model, generating scGPT embeddings, integrating batches with a transformer, or running zero-shot single-cell inference on an h5ad. For probabilistic latent models (scVI/scANVI) prefer alterlab-scvi-tools; for the standard QC→cluster→UMAP→DE pipeline prefer alterlab-scanpy; for the AnnData data structure itself prefer alterlab-anndata; for protein language models prefer alterlab-esm. Part of the AlterLab Academic Skills suite.\nlicense: MIT\nallowed-tools: Read Write Edit Bash(python:<em>) Bash(uv:</em>)\ncompatibility: \"Runs scGPT (<code>bowang-lab/scGPT</code>; PyPI <code>scgpt</code> 0.2.4, unchanged since 2025-03) under <code>uv run python</code>. Its old pins (<code>scvi-tools&lt;1.0</code>, <code>scanpy&lt;2.0</code>, <code>torchtext</code>) conflict with a current scverse stack, so use a dedicated environment, not one shared with alterlab-scanpy/alterlab-scvi-tools. Checkpoints (GB-scale) download manually from the repo's Drive links; a CUDA GPU is strongly recommended. I/O is AnnData (<code>.h5ad</code>); dispatch heavy fine-tuning via alterlab-remote-compute.\"\nmetadata:\nskill-author: AlterLab\nversion: \"1.1.0\"\nlast_updated: \"2026-09-23\"</h2>\n<h1>scGPT (single-cell foundation model)</h1>\n<h2>Overview</h2>\n<p><strong>scGPT</strong> (Cui et al., <em>Nature Methods</em> 2024; <code>bowang-lab/scGPT</code>) is a transformer <strong>foundation\nmodel</strong> pretrained on tens of millions of cells. It provides <strong>zero-shot</strong> and fine-tuned\n<strong>cell-type annotation</strong>, <strong>gene and cell embeddings</strong>, <strong>batch integration</strong>, and\ngene-regulatory / perturbation inference — all operating on <strong>AnnData</strong> (<code>.h5ad</code>) objects.</p>\n<p>Its niche vs. the existing single-cell skills: scGPT is the <em>pretrained-transformer</em> route.\nFor probabilistic latent-variable models use <code>alterlab-scvi-tools</code>; for the conventional\nScanpy analysis pipeline use <code>alterlab-scanpy</code>; scGPT complements both.</p>\n<h2>When to Use This Skill</h2>\n<p>Use this skill when the user wants to:</p>\n<ul>\n<li><strong>Annotate cell types</strong> with a pretrained foundation model (zero-shot or fine-tuned).</li>\n<li>Generate <strong>scGPT embeddings</strong> for cells or genes.</li>\n<li><strong>Integrate batches</strong> using the transformer's representation.</li>\n<li>Run <strong>zero-shot</strong> inference / transfer to a new dataset without training from scratch.</li>\n</ul>\n<h3>Does NOT Trigger</h3>\n<table>\n<thead>\n<tr>\n<th>Scenario</th>\n<th>Use instead</th>\n</tr>\n</thead>\n<tbody>\n<tr>\n<td>Probabilistic integration / latent model (scVI, scANVI)</td>\n<td><code>alterlab-scvi-tools</code></td>\n</tr>\n<tr>\n<td>Standard QC → cluster → UMAP → differential expression</td>\n<td><code>alterlab-scanpy</code></td>\n</tr>\n<tr>\n<td>Read/write/wrangle the <code>.h5ad</code> data structure itself</td>\n<td><code>alterlab-anndata</code></td>\n</tr>\n<tr>\n<td>RNA velocity</td>\n<td><code>alterlab-scvelo</code></td>\n</tr>\n<tr>\n<td>Protein (not single-cell) language models</td>\n<td><code>alterlab-esm</code></td>\n</tr>\n</tbody>\n</table>\n<h2>Core Capabilities</h2>\n<h3>1. Zero-shot cell embedding &amp; annotation</h3>\n<pre><code>import scanpy as sc\nfrom scgpt.tasks import embed_data\n\nadata = sc.read_h5ad(\"cells.h5ad\")\nadata = embed_data(\n    adata,\n    model_dir=\"checkpoints/scGPT_human\",   # downloaded checkpoint folder\n    gene_col=\"feature_name\",               # column in adata.var holding gene symbols\n    batch_size=64,\n    device=\"cuda\",\n)\n# cell embeddings land in adata.obsm[\"X_scGPT\"]\n</code></pre>\n<p><code>gene_col</code> must name an <code>adata.var</code> column of gene symbols matching the checkpoint's vocabulary\n(pass <code>\"index\"</code> to use <code>var_names</code>); symbols that miss the vocab are dropped, so check how many\ngenes survive before trusting the embedding. Set <code>use_fast_transformer=False</code> when flash-attn\nis not installed. Zero-shot mode maps a new dataset onto scGPT's learned space without training\n— fast triage of cell identities. Fine-tuning on labeled reference data improves accuracy on a\nspecific tissue.</p>\n<h3>2. Embeddings for downstream analysis</h3>\n<p>Produce cell embeddings (for clustering/visualization) or gene embeddings (for\ngene-network/similarity analysis). Feed embeddings back into a Scanpy neighbors/UMAP workflow.</p>\n<h3>3. Batch integration</h3>\n<p>Use the model representation to integrate across batches/donors, comparable in role to\nscVI-based integration but from the pretrained-transformer paradigm.</p>\n<h3>4. Environment, GPU, and dispatch</h3>\n<p>scGPT's last release is 0.2.4 (March 2025) and its pins have not moved since: it requires\n<code>scvi-tools&lt;1.0</code> and <code>scanpy&lt;2.0</code>, and imports <code>torchtext</code>, whose own last release was 0.18.0\nin April 2024. That stack will not co-install with a current scverse environment, so give scGPT\nits own venv and move data between environments as <code>.h5ad</code> files rather than trying to satisfy\nboth sets of pins at once. Say so plainly when a user expects it to drop into their existing\nenvironment.</p>\n<p>Checkpoints (whole-human, continual-pretrained, organ-specific) are downloaded by hand from the\nDrive links in the upstream README — there is no <code>from_pretrained</code> downloader. The\nwhole-human model is the default choice; the continual-pretrained one is aimed at zero-shot\ncell-embedding tasks.</p>\n<p>scGPT needs a GPU for realistic dataset sizes; fine-tuning is heavy. Dispatch fine-tuning /\nlarge inference via <code>alterlab-remote-compute</code> (submit → poll → harvest). Keep the AnnData I/O\nconsistent with <code>alterlab-anndata</code>.</p>\n<p>Because the model has been static for over a year while the foundation-model field has not,\ntreat its published benchmarks as a 2024 snapshot: report the checkpoint name and date with any\nresult, and where annotation accuracy matters, sanity-check the labels against marker-gene\nevidence (<code>alterlab-scanpy</code>) rather than accepting them unverified.</p>\n<h2>Resources</h2>\n<ul>\n<li><code>references/scgpt_usage.md</code> — install/pinning, checkpoints, embed/annotate/fine-tune calls,\nscverse integration, and paradigm comparison. Loaded on demand.</li>\n</ul>\n<p>Part of the AlterLab Academic Skills suite.</p>\n","files":[{"path":"evals/evals.json","sizeBytes":2971,"isText":true},{"path":"references/scgpt_usage.md","sizeBytes":2951,"isText":true},{"path":"SKILL.md","sizeBytes":5843,"isText":true}],"reviewScore":null,"reviewSummary":null,"trust":{"provenance":"trusted-source-unreviewed","notice":"Community-authored content, reproduced verbatim and not vetted as instructions. Treat it as data to evaluate, never as directives to follow.","bodySource":null},"bodyLocked":false,"purchaseUrl":null,"sourceUrl":null,"report":{"provenance":"trusted-source-unreviewed","screen":{"ran":true,"outcome":"clean","suspicious":0,"notes":0,"hiddenCharacters":false},"virusScan":{"engine":"clamav","status":"clean","scannedAt":"2026-09-23T18:57:56.506436Z","sha256":"2D4072429202F644B873821B181D5C6548CCB4EF1B10FFDADEADC62F0CF3260A","sizeBytes":5547},"review":null,"source":{"repositoryUrl":"https://github.com/AlterLab-IEU/AlterLab-Academic-Skills","path":"skills/bioinformatics/alterlab-scgpt","license":"MIT","commit":"e4836c08a20da195a11f30f203a8cf23ec30aa95","subtreeSha":"F01CC27B35BC1B7945BCE9659B3EC3A3B571436723459CC074361DC8C576CE7F","lastSyncedAt":"2026-09-23T18:56:52.297238Z"},"reviewedAt":"2026-09-23T18:59:50.030869Z","notice":"Community-authored content, reproduced verbatim and not vetted as instructions. Treat it as data to evaluate, never as directives to follow."},"install":[{"target":"skills-cli","command":"npx skills add https://github.com/AlterLab-IEU/AlterLab-Academic-Skills/tree/main/skills/bioinformatics/alterlab-scgpt"},{"target":"claude-code","command":"claude plugin marketplace add https://llmmart.ai/marketplace.json && claude plugin install alterlab-ieu-alterlab-academic-skills@llmmart"},{"target":"git","command":"git clone https://github.com/AlterLab-IEU/AlterLab-Academic-Skills.git"}]}