# /scanpy: Run a single-cell RNA-seq analysis with tested Scanpy scripts

Source: https://trendhub.net/skills/k-dense-ai-scientific-agent-skills/scanpy
Skill folder: https://github.com/K-Dense-AI/scientific-agent-skills/tree/main/skills/scanpy
Pack: Scientific Agent Skills (https://trendhub.net/skills/k-dense-ai-scientific-agent-skills)
Works with: Claude Code, Codex, Gemini CLI, Antigravity, Cursor (npx), GitHub CLI (gh skill), Cursor (Agent Plugins), Codex (Agent Plugins), OpenClaw, NemoClaw, Pi, Hermes and other hosts

The scanpy skill bundles a chain of command-line scripts that take raw single-cell counts through QC, normalization, variable gene selection, dimensionality reduction, Leiden clustering, marker ranking, annotation and pseudobulk preparation, all reading and writing h5ad files. It targets Scanpy 1.12.4 and spells out where counts, normalized values and the raw slot live so downstream statistics use the right matrix.

## When to use it

- You have 10x output or an h5ad file and need a first clustered, annotated object.
- You want to compare clustering resolutions and inspect marker genes before labelling cell types.
- You need sample-level pseudobulk counts for condition comparisons with pydeseq2.

## How it works

1. **Inspect the input**: The agent summarizes the dataset and confirms it starts from true raw counts, using a counts layer when the main matrix is already normalized.
2. **Prefer the scripts**: It runs the bundled pipeline or step scripts rather than writing Scanpy code from scratch.
3. **QC and preprocess**: It sets QC thresholds from plots, optionally flags doublets, normalizes and keeps counts and a log-normalized raw snapshot.
4. **Cluster and rank markers**: It builds PCA, neighbour graph and UMAP, clusters with Leiden at several resolutions and writes per-cluster marker CSVs.
5. **Annotate and aggregate**: You review markers and supply a cluster-to-cell-type map, then it can aggregate counts by sample and cell type.

## What it steers the agent away from

- Treating cluster marker p-values as rigorous differential expression between conditions
- Running pseudobulk on normalized values instead of counts
- Using the deprecated Louvain clustering by default

## What it can touch

Runs local Python scripts that read and write h5ad files and save figures and CSVs; converting Seurat .rds files requires R. No credentials or network are needed for analysis.

## Pairs well with

- `/exploratory-data-analysis`
- `/matplotlib`

## Questions

### Can it read Seurat objects?

Not directly. The skill has the agent convert .rds files to .h5ad with R tooling first, following a bundled runbook.

### Which Python version is required?

Python 3.12 or newer. The skill targets Scanpy release 1.12.4, and its tests ran on Python 3.13.
