Agent skill

Spatial Enrichment

by TianGzlab in TianGzlab/OmicsClaw

Load when running pathway or gene-set enrichment per cluster on spatial AnnData with over-representation, preranked GSEA, or ssGSEA group-mean scores.

Apache-2.0Auto-check passedResearch & Science

Install Spatial Enrichment

skills CLI
$ npx skills add TianGzlab/OmicsClaw --skill spatial-enrichment -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install TianGzlab/OmicsClaw spatial-enrichment --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Manual copy
$ git clone --depth 1 https://github.com/TianGzlab/OmicsClaw.git skills-src && mkdir -p .claude/skills && cp -r skills-src/skills/spatial/spatial-enrichment .claude/skills/spatial-enrichment && rm -rf skills-src

Use ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.

Claude Code skills documentation · loads skills from .claude/skills/

Facts

Skill name
spatial-enrichment
GitHub stars
161
Token cost
~1.8k tokens
SKILL.md length
735 words
Files
12 (incl. references)
Skills in repo
88
Repo updated
First seen
Licence
Apache-2.0

At a glance

Load when running pathway or gene-set enrichment per cluster on spatial AnnData with over-representation, preranked GSEA, or ssGSEA group-mean scores.

  • Research & Science work in your project
  • SKILL.md covers When to use, Use from a step, API and Methods and parameters, plus 5 more sections
  • Runs Python and R scripts from its folder; calls python

What it does

Spatial Enrichment is an agent skill from TianGzlab/OmicsClaw. Load when running pathway or gene-set enrichment per cluster on spatial AnnData with over-representation, preranked GSEA, or ssGSEA group-mean scores. Skip when ranking spatially variable genes (use spatial-genes) or comparing conditions (use spatial-condition).

Its SKILL.md is about 1.8k tokens, which your agent loads only when the skill is triggered. The skill folder holds 15 other files, including reference files (for example `_api.py`, `examples/example_step.py` and `r_visualization/README.md`).

It sits in Research & Science. It works with AnnData. The repository describes itself as: Conversational & memory-enabled AI research partner for multi-omics analysis. CLI + Desktop App (installers in Releases). From biological idea to full research paper. The licence is Apache-2.0.

When your agent uses it

  • Research & Science work in your project

Example prompts

  • “/spatial-enrichment”

Requirements

  • Python 3

What it can do on your machine

Read from SKILL.md and the folder at commit 90a3bec. It shows what the files ask for, not the result of running them.

  • Tool permissions

    Pre-approves nothing: there is no allowed-tools line, so your agent's usual permission prompts apply.

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    Ships script files (Python and R), which the agent can run.

    Shell commands in SKILL.md call:

    • python

    From the folder's file list and the shell code blocks in SKILL.md.

  • Network

    No URLs in SKILL.md.

    From URLs in SKILL.md, links to its own repository left out.

  • Credentials

    Names no API keys, tokens, secrets or passwords.

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

Context cost

Spatial Enrichment loads about 1.8k tokens when it runs, and up to ~5.4k if it reads all its reference files. Until then it costs about 70 tokens; SKILL.md has 735 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~70
When it runs · the whole SKILL.md, loaded when a task matches
~1.8k
With references · SKILL.md plus every file in references/, read only if the agent opens them
~5.4k

Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.

Safety

Auto-check passed

The automated check found no risky patterns in SKILL.md.

Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); files beside SKILL.md are not scanned.

SKILL.md

The full file from TianGzlab/OmicsClaw at commit 90a3bec, republished under its Apache-2.0 licence (© TianGzlab). 735 words, ~1,775 tokens.

Download SKILL.mdSave it as .claude/skills/spatial-enrichment/SKILL.md (or your agent's skills folder). This skill also uses 11 other files; get the full folder from GitHub.
name
spatial-enrichment
description
Load when running pathway or gene-set enrichment per cluster on spatial AnnData with over-representation, preranked GSEA, or ssGSEA group-mean scores. Skip when ranking spatially variable genes (use spatial-genes) or comparing conditions (use spatial-condition).
trigger
pathway enrichment, gene set enrichment, enrichr, GSEA, ssGSEA, GO, Reactome, MSigDB
tags
spatial, enrichment, pathway, gsea, ssgsea, enrichr, gene-set

spatial-enrichment

When to use

Interpret group markers with gene sets, or score group-mean expression. The default is a small local OmicsClaw signature library. Hosted libraries require network access; explicit gene-set mappings and local GMT/JSON files work offline. Synthetic demo signatures are not curated biological pathways.

Use from a step

python
from skills._sdk.notebook import load_skill, read_input, write_output
library = load_skill("spatial-enrichment")
adata = read_input("processed.h5ad")
library.enrich(adata, groupby="leiden", source="omicsclaw_core")
write_output(library.results(adata), "tables/enrichment_results.csv")

The executable example uses explicit synthetic marker sets and checks their known group enrichment.

For local libraries use sets = read_input("data/sets.gmt", reader=library.read_gene_sets), then library.enrich(adata, gene_sets=sets). read_input records the file hash. library.fetch_gene_sets("KEGG_2021_Human") explicitly accesses the network. Cache that mapping as JSON before a repeatable analysis, then load the cached file with read_input and this reader. Computation accepts built-in sources or mappings.

API

<!-- api:begin generated from _api.py; regenerate with run.py api <skill dir> --write -->
read_gene_sets(path)

Read a local GMT or JSON gene-set library without writing files.

In a step call read_input(path, reader=library.read_gene_sets) to record the input file hash and resolve the path relative to the project root.

:param path: Local GMT or JSON path supplied by read_input or the CLI. :returns: Term-to-gene mapping retaining its local source metadata. :raises FileNotFoundError: The local file is absent. :raises ValueError: The format or JSON structure is invalid.

fetch_gene_sets(source, *, species='human')

Fetch a remote Enrichr library; this call requires network access.

Cache the mapping as JSON, then use read_input(path, reader=library.read_gene_sets) for repeatable analysis steps. Fetching alone does not record a file hash.

:param source: Enrichr library name or an alias in references/parameters.md. :param species: Default human; mouse is also supported. :returns: Term-to-gene mapping retaining requested and resolved library names. :raises ValueError: Species or remote source is invalid or unavailable. :raises ImportError: gseapy is unavailable; use install_skill_deps.

enrich(adata, *, method='enrichr', groupby='leiden', source='omicsclaw_core', species='human', gene_sets=None, gene_set=None, fdr_threshold=0.05, n_top_terms=20, random_state=123, **parameters)

Enrich group markers or score group means and return the same AnnData.

Marker ranking reads raw when present, otherwise X; ssGSEA reads X and scores group means, then copies each group's score to its observations.

:param adata: Log-normalized expression and group labels; modified in place. :param method: CLI default enrichr; gsea or ssgsea also supported. :param groupby: CLI default leiden; obs column defining groups. :param source: CLI default omicsclaw_core; only built-in libraries are resolved here. :param species: CLI default human; mouse changes the built-in symbols. :param gene_sets: Already-read term-to-gene mapping; None selects the built-in source. :param gene_set: Optional built-in library alias overriding source. :param fdr_threshold: CLI default 0.05 adjusted significance cutoff. :param n_top_terms: CLI default 20 reported terms or attached score columns. :param random_state: CLI default 123 for GSEA and ssGSEA backend randomness. :param parameters: Method-specific CLI options in references/parameters.md. :returns: The same AnnData, with canonical enrichment_results in uns. :raises ValueError: Groups, gene sets or numeric thresholds are invalid. :raises TypeError: A file path is passed; use read_gene_sets first.

Show full SKILL.md (300 more words)Show less
results(adata, *, significant_only=False)

Return enrichment results, retaining missing p values for score-only methods.

:param adata: AnnData returned by enrich. :param significant_only: Default False; True selects adjusted p values below FDR. :returns: A new DataFrame; ssGSEA scores do not imply significance. :raises ValueError: No enrichment run is recorded.

run_info(adata, *, keep=True)

Read enrichment diagnostics, including any executed fallback method.

:param adata: AnnData returned by enrich. :param keep: Default True; False removes transient diagnostics for CLI output. :returns: Diagnostic dictionary, including enrich_df and marker_df. :raises ValueError: No enrichment run is recorded.

terms_figure(adata, *, n_top=20)

Plot available term scores without treating scores as calibrated p values.

:param adata: AnnData returned by enrich. :param n_top: Default 20 rows, matching the CLI report size. :returns: A matplotlib Figure; an empty result is labelled explicitly. :raises ValueError: No run is recorded or n_top is not positive.

<!-- api:end -->

Methods and parameters

Enrichr performs local over-representation on positive markers; GSEA uses per-group rankings. ssGSEA scores group means and copies each score to its spots. These are not independent per-spot estimates. Defaults include 100 GSEA permutations and seed 123. See parameters for keyword arguments and methodology for scoring details.

Gotchas

  • run_info() records warnings and the executed method if GSEApy falls back to hypergeometric, mean-rank permutation or descriptive mean scoring.
  • fetch_gene_sets raises when a requested remote library cannot be resolved.
  • uns['enrichment_score_columns'] lists attached ssGSEA columns.
  • results(significant_only=True) excludes rows without p values.
  • enrich requires group labels; automatic Leiden clustering belongs to the CLI.

Inputs and outputs

The library reads log-normalized expression; Scanpy marker ranking prefers raw if present. Functions modify AnnData and return tables/Figures. The CLI writes processed.h5ad, tables/enrichment_results.csv, diagnostics, report and result JSON. See output contract for conditional outputs.

CLI

bash
python skills/spatial/spatial-enrichment/spatial_enrichment.py --input processed.h5ad --output results/enrichment
python skills/spatial/spatial-enrichment/spatial_enrichment.py --demo --output /tmp/enrichment_demo

See also

Use spatial-de for markers, spatial-genes for autocorrelation, or sc-enrichment for non-spatial data.

Dependencies

anndata, gseapy, matplotlib, numpy, pandas, scanpy, scipy, seaborn

© TianGzlab, Apache-2.0. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file

Files

SKILL.md and 11 other files (references) in skills/spatial/spatial-enrichment of TianGzlab/OmicsClaw.

  • SKILL.md
  • _api.py
  • examples/example_step.py
  • r_visualization/README.md
  • r_visualization/enrichment_publication_template.R
  • references/methodology.md
  • references/output_contract.md
  • references/parameters.md
  • spatial_enrichment.py
  • tests/test_api.py
  • tests/test_reader_step.py
  • tests/test_spatial_enrichment.py

Open the folder on GitHubat commit 90a3bec

Compare with similar skills

Spatial Enrichment next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.

Spatial Enrichment compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Spatial Enrichment this skillTianGzlab/OmicsClaw161—~1.8kAutomated safety check: PassApache-2.0
Scanpy Single-Cell Analysisdavila7/claude-code-templates32k15 repos~2.8kAutomated safety check: PassMIT
ScgptJimLiu/science-skills2274 repos~1.3kAutomated safety check: PassApache-2.0
PyDESeq2 Differential Expressiondavila7/claude-code-templates32k11 repos~4kAutomated safety check: PassMIT
Anndatadavila7/claude-code-templates32k11 repos~2.5kAutomated safety check: PassMIT
Single-Cell Initial AnalysisLigphiDonk/Oh-my--paper7381 repos~1.4kAutomated safety check: PassMIT

Similar skills

  • Scanpy Single-Cell Analysis

    davila7/claude-code-templates

    Walks through single-cell RNA-seq analysis with Scanpy: loading .h5ad and 10X data, QC, normalization, PCA and UMAP, Leiden clustering, marker genes and cell type annotation.

    32k GitHub starsUsed in 15 repos~2.8k tokens
    Research & ScienceAuto-check passed
  • Scgpt

    JimLiu/science-skills

    Embed and annotate single-cell expression data with scGPT, a foundation model for single-cell biology.

    227 GitHub starsUsed in 4 repos~1.3k tokens
    Research & ScienceAuto-check passed
  • PyDESeq2 Differential Expression

    davila7/claude-code-templates

    Runs differential gene expression analysis on bulk RNA-seq counts with PyDESeq2: design formulas, Wald tests, FDR correction and volcano or MA plots.

    32k GitHub starsUsed in 11 repos~4k tokens
    Research & ScienceAuto-check passed
  • Anndata

    davila7/claude-code-templates

    This skill should be used when working with annotated data matrices in Python, particularly for single-cell genomics analysis, managing experimental measurements with metadata, or handling…

    32k GitHub starsUsed in 11 repos~2.5k tokens
    Research & ScienceAuto-check passed
  • Single-Cell Initial Analysis

    LigphiDonk/Oh-my--paper

    Runs a seven-step quality-control and exploration pipeline on scRNA-seq, CyTOF or flow cytometry data and writes a plain-language report of what it found.

    738 GitHub starsUsed in 1 repo~1.4k tokens
    Research & ScienceAuto-check passed
  • Single Cell Data Prep Qc

    harrisongzhang/TheVirtualBiotech

    Single-cell RNA-seq data preparation and quality control pipeline.

    121 GitHub stars~2.9k tokensUpdated 22 days ago
    Research & ScienceAuto-check passed

More from TianGzlab/OmicsClaw

All 88 skills in this repo
  • Bulkrna Cosinor Rhythm

    TianGzlab/OmicsClaw

    Load when the user needs Deterministic fixed-period 24-hour single-component cosinor OLS rhythm analysis for a bulk RNA time-course CSV.

    161 GitHub stars~840 tokensUpdated yesterday
    Auto-check passed
  • Bulkrna Batch Correction

    TianGzlab/OmicsClaw

    Load when correcting batch effects in bulk expression using R sva ComBat or the legacy Python parametric approximation.

    161 GitHub stars~1.2k tokensUpdated yesterday
    Auto-check passed
  • Bulkrna Coexpression

    TianGzlab/OmicsClaw

    Load when discovering bulk gene co-expression modules and hub genes with R WGCNA.

    161 GitHub stars~1.3k tokensUpdated yesterday
    Auto-check passed
  • Bulkrna De

    TianGzlab/OmicsClaw

    Load when comparing gene expression between two conditions in bulk RNA-seq count data.

    161 GitHub stars~867 tokensUpdated yesterday
    Auto-check passed
  • Bulkrna Deconvolution

    TianGzlab/OmicsClaw

    Load when estimating cell-type proportions in bulk RNA-seq samples from a single-cell or signature-matrix reference.

    161 GitHub stars~757 tokensUpdated yesterday
    Auto-check passed
  • Bulkrna Enrichment

    TianGzlab/OmicsClaw

    Load when running pathway / GO term enrichment on a bulk RNA-seq DE result list.

    161 GitHub stars~860 tokensUpdated yesterday
    Auto-check passed

Works with

Questions about Spatial Enrichment

What does Spatial Enrichment do?

Load when running pathway or gene-set enrichment per cluster on spatial AnnData with over-representation, preranked GSEA, or ssGSEA group-mean scores. Spatial Enrichment is an agent skill from TianGzlab/OmicsClaw. Load when running pathway or gene-set enrichment per cluster on spatial AnnData with over-representation, preranked GSEA, or ssGSEA group-mean scores.

When should I use Spatial Enrichment?

Spatial Enrichment fits situations like: research & Science work in your project.

How do I install Spatial Enrichment in Claude Code?

Run `npx skills add TianGzlab/OmicsClaw --skill spatial-enrichment -a claude-code`. Or copy the skill folder (skills/spatial/spatial-enrichment in TianGzlab/OmicsClaw) into .claude/skills/spatial-enrichment in your project. Claude Code loads it when a task matches its description.

How do I install Spatial Enrichment in Codex?

Run `npx skills add TianGzlab/OmicsClaw --skill spatial-enrichment -a codex`. Or copy the skill folder (skills/spatial/spatial-enrichment in TianGzlab/OmicsClaw) into .agents/skills/spatial-enrichment in your project. Codex loads it when a task matches its description.

Can I use Spatial Enrichment in Cursor, Gemini CLI or GitHub Copilot?

Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add TianGzlab/OmicsClaw --skill spatial-enrichment -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/spatial-enrichment, .gemini/skills/spatial-enrichment, .github/skills/spatial-enrichment and .opencode/skills/spatial-enrichment in your project.

What does Spatial Enrichment need to run?

Going by SKILL.md and its folder, Spatial Enrichment needs Python and R for the scripts in its folder and the command-line tools its instructions call (python). Our summary lists: Python 3.

Does Spatial Enrichment access the network?

SKILL.md contains no URLs. Any network use would come from the scripts or tools the agent runs. This is read from the text; nothing was executed.

Is Spatial Enrichment safe to install?

Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. Review the folder before installing.

What licence does Spatial Enrichment use?

Spatial Enrichment is published under the Apache-2.0 licence (the repository's licence). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does Spatial Enrichment use?

About 1.8k tokens (SKILL.md is roughly 7.1k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full. Its references folder adds about 3.6k tokens, read only when the agent opens those files.

What are the alternatives to Spatial Enrichment?

Skills that share tags, products or a category with Spatial Enrichment: Scanpy Single-Cell Analysis (davila7/claude-code-templates, 32k stars), Scgpt (JimLiu/science-skills, 227 stars), PyDESeq2 Differential Expression (davila7/claude-code-templates, 32k stars) and Anndata (davila7/claude-code-templates, 32k stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Spatial Enrichment?

TianGzlab (a GitHub organization) maintains it in TianGzlab/OmicsClaw, which has 161 GitHub stars. The repository holds 88 skills in this directory. The repository was last updated on October 7, 2026.

Source: TianGzlab/OmicsClaw on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.