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/subset.py
View on GitHub#!/usr/bin/env python3
"""
Subset an AnnData object by cell metadata or genes.
Filter cells by obs-column values (keep or drop), or restrict to a gene list.
Useful for isolating a cell type / condition for focused re-analysis.
Examples:
python subset.py annotated.h5ad -o tcells.h5ad --obs cell_type --keep "CD4 T cells" "CD8 T cells"
python subset.py annotated.h5ad -o no_doublets.h5ad --obs predicted_doublet --drop True
python subset.py data.h5ad -o panel.h5ad --genes CD3D CD14 MS4A1 NKG7
"""
import argparse
from _common import add_io_args, configure_scanpy, die, info, load_anndata, save_anndata, clear_graph
def main():
p = argparse.ArgumentParser(description=__doc__,
formatter_class=argparse.RawDescriptionHelpFormatter)
add_io_args(p, default_output="subset.h5ad")
p.add_argument("--obs", default=None, help="obs column to filter on")
p.add_argument("--keep", nargs="+", default=None, help="Values of --obs to keep")
p.add_argument("--drop", nargs="+", default=None, help="Values of --obs to drop")
p.add_argument("--genes", nargs="+", default=None, help="Restrict to these genes")
p.add_argument("--recompute-hvg", action="store_true",
help="After subsetting, drop stale embeddings so the next steps recompute cleanly")
args = p.parse_args()
configure_scanpy(figdir=args.figdir)
adata = load_anndata(args.input)
n0 = adata.n_obs
if args.obs:
if args.obs not in adata.obs.columns:
die(f"obs column '{args.obs}' not found: {list(adata.obs.columns)}")
vals = adata.obs[args.obs].astype(str)
if args.keep:
adata = adata[vals.isin([str(v) for v in args.keep]), :].copy()
elif args.drop:
adata = adata[~vals.isin([str(v) for v in args.drop]), :].copy()
else:
die("provide --keep or --drop with --obs")
info(f"Cells {n0} -> {adata.n_obs}")
if args.genes:
present = [g for g in args.genes if g in adata.var_names]
if not present:
die("none of the requested genes are present")
adata = adata[:, present].copy()
info(f"Restricted to {adata.n_vars} genes")
if args.recompute_hvg:
clear_graph(adata, clear_pca=True)
for key in list(adata.var):
if key.startswith("highly_variable"):
del adata.var[key]
info("Cleared standard HVG/embedding/graph results. Recompute HVGs on the existing log-normalized X; do not normalize it again.")
save_anndata(adata, args.output)
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 |