K-Dense-AI/scientific-agent-skills / skills/scanpy
scanpy
VerifiedPerforms Scanpy single-cell RNA-seq QC, normalization, HVG selection, PCA/UMAP/t-SNE, clustering, exploratory marker ranking, pseudobulk preparation, visualization, and Seurat or SingleCellExperiment RDS conversion to h5ad. Applies to established exploratory scRNA-seq workflows with explicit count and expression provenance; complementary skills cover scvi-tools models and AnnData format details.
| File | Kind | Size |
|---|---|---|
| SKILL.md | skill md | 19.8 KB |
| assets/analysis_template.py | script | 10.0 KB |
| assets/celltype_mapping.json | config | 184 B |
| assets/gene_signatures.json | config | 355 B |
| assets/pipeline_config.json | config | 380 B |
| references/analysis_workflow.md | markdown | 7.6 KB |
| references/api_reference.md | markdown | 9.1 KB |
| references/plotting_guide.md | markdown | 10.5 KB |
| references/r_interop.md | markdown | 11.8 KB |
| references/standard_workflow.md | markdown | 7.0 KB |
| references/upstream-review.md | markdown | 8.3 KB |
| scripts/_common.py | script | 10.0 KB |
| scripts/annotate.py | script | 3.7 KB |
| scripts/batch_correct.py | script | 3.1 KB |
| scripts/cluster.py | script | 2.5 KB |
| scripts/convert.py | script | 1.5 KB |
| scripts/find_markers.py | script | 4.3 KB |
| scripts/inspect_data.py | script | 3.1 KB |
| scripts/plot.py | script | 3.6 KB |
| scripts/preprocess.py | script | 3.5 KB |
| scripts/pseudobulk.py | script | 4.6 KB |
| scripts/qc_analysis.pyexecutable | script | 5.1 KB |
| scripts/reduce_dimensions.py | script | 2.8 KB |
| scripts/run_pipeline.py | script | 9.4 KB |
| scripts/score_genes.py | script | 3.9 KB |
| scripts/subset.py | script | 2.6 KB |
scripts/plot.py
View on GitHub#!/usr/bin/env python3
"""
Generate common single-cell plots from a processed AnnData object.
A flexible plotting front-end so the agent doesn't hand-write matplotlib /
scanpy plotting calls. Pick a plot type and the keys/genes to show.
Plot types:
umap / tsne / pca : embedding colored by --color obs columns and/or --genes
violin : --genes (or QC metrics) split by --groupby
dotplot / matrixplot / heatmap / tracksplot / stacked_violin : --genes by --groupby
Examples:
python plot.py annotated.h5ad --kind umap --color leiden cell_type
python plot.py annotated.h5ad --kind umap --genes CD3D MS4A1 NKG7 --use-raw
python plot.py annotated.h5ad --kind dotplot --genes CD3D CD14 MS4A1 --groupby cell_type
python plot.py annotated.h5ad --kind violin --genes CD3D --groupby leiden
"""
import argparse
from _common import configure_scanpy, die, info, load_anndata
def main():
p = argparse.ArgumentParser(description=__doc__,
formatter_class=argparse.RawDescriptionHelpFormatter)
p.add_argument("input", help="Input .h5ad")
p.add_argument("--kind", required=True,
choices=["umap", "tsne", "pca", "violin", "dotplot",
"matrixplot", "heatmap", "tracksplot", "stacked_violin"])
p.add_argument("--color", nargs="+", default=None, help="obs columns to color by")
p.add_argument("--genes", nargs="+", default=None, help="genes to display")
p.add_argument("--groupby", default=None, help="obs column to group by (violin/dotplot/...)")
p.add_argument("--use-raw", action="store_true", help="Use adata.raw (normalized log values)")
p.add_argument("--figdir", default="figures", help="Figure output directory")
p.add_argument("--save", default=None, help="Filename suffix (default derived from --kind)")
args = p.parse_args()
sc = configure_scanpy(figdir=args.figdir)
adata = load_anndata(args.input)
# scanpy prepends the plot-function name, so ".png" yields e.g. "umap.png".
save = args.save or ".png"
if args.use_raw and adata.raw is None:
die("--use-raw requested but .raw is missing")
use_raw = args.use_raw
var_names = adata.raw.var_names if use_raw else adata.var_names
genes = [g for g in (args.genes or []) if g in var_names]
if args.genes and len(genes) < len(args.genes):
missing = set(args.genes) - set(genes)
info(f"Genes not found (skipped): {sorted(missing)}")
if args.kind in ("umap", "tsne", "pca"):
color = (args.color or []) + genes
if not color:
die("provide --color and/or --genes for embedding plots")
fn = {"umap": sc.pl.umap, "tsne": sc.pl.tsne, "pca": sc.pl.pca}[args.kind]
fn(adata, color=color, use_raw=use_raw, show=False, save=save)
elif args.kind == "violin":
keys = genes or [c for c in (args.color or []) if c in adata.obs.columns]
if not keys:
die("provide --genes (or obs keys via --color) for violin")
sc.pl.violin(adata, keys, groupby=args.groupby, use_raw=use_raw,
show=False, save=save)
else:
if not genes or not args.groupby:
die(f"{args.kind} requires --genes and --groupby")
fn = {
"dotplot": sc.pl.dotplot, "matrixplot": sc.pl.matrixplot,
"heatmap": sc.pl.heatmap, "tracksplot": sc.pl.tracksplot,
"stacked_violin": sc.pl.stacked_violin,
}[args.kind]
fn(adata, genes, groupby=args.groupby, use_raw=use_raw, show=False, save=save)
info(f"Saved {args.figdir}/{args.kind}{save}")
if __name__ == "__main__":
main()
Related skills
| Skill | Stars | Updated | Works with | Status | Install |
|---|---|---|---|---|---|
| reverse-engineer-anythingmorluto/reaReverse engineer native, managed, Electron/JavaScript, packaged, firmware, and browser targets with REA, and build agent environments (AgentEnv bundles) of web applications from a live instance or a capture, and of Linux desktop apps with a task from a request. Use shipped-artifact or requested runtime evidence to explain features, compare versions, decompile code, or guide a reconstruction. Skip REA for ordinary source-repository architecture analysis. | Stars: 472k | Updated | Claude CodeCodex | Verified | Install |
| diagnosing-superpowersobra/superpowersUse when a superpowers session went wrong and your human partner wants to know why — repeated work, ignored plans, stumbles, poor results, a skill that didn't fire, "it took too long", "why is it so expensive", "what is it doing" — or wants to build a bug report for the superpowers maintainers, for the current session or a past one identified by id or path, on any harness. | Stars: 322k | Updated | Claude CodeCodex | Verified | Install |
| dispatching-parallel-agentsobra/superpowersUse when facing 2+ independent tasks that can be worked on without shared state or sequential dependencies | Stars: 322k | Updated | Claude CodeCodex | Verified | Install |
| executing-plansobra/superpowersUse when executing an implementation plan in the current session as the implementer yourself — your human partner chose inline execution, or no subagent tool is available | Stars: 322k | Updated | Claude CodeCodex | Verified | Install |