Agent skill

Spatial Statistics

by TianGzlab in TianGzlab/OmicsClaw

Load when running spatial autocorrelation / hotspot / co-occurrence / neighbourhood-enrichment / Ripley K stats on a clustered spatial AnnData via squidpy.

MITAuto-check passedData & Analytics

Install Spatial Statistics

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

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

GitHub CLI
$ gh skill install TianGzlab/OmicsClaw spatial-statistics --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-statistics .claude/skills/spatial-statistics && 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-statistics
GitHub stars
161
Token cost
~2.1k tokens
SKILL.md length
485 words
Files
10 (incl. references)
Skills in repo
95
Repo updated
First seen
Licence
MIT

At a glance

Load when running spatial autocorrelation / hotspot / co-occurrence / neighbourhood-enrichment / Ripley K stats on a clustered spatial AnnData via squidpy.

  • Works in 6 steps: Load AnnData (--input) or chain through… → parser.error validates --analysis-type ∈… → Auto-resolve --cluster-key if unset;… → …
  • Tasks that involve Statistics
  • SKILL.md covers When to use, Inputs & Outputs, Flow and Gotchas, plus 2 more sections
  • Runs Python and R scripts from its folder; calls python

What it does

Spatial Statistics is an agent skill from TianGzlab/OmicsClaw. Load when running spatial autocorrelation / hotspot / co-occurrence / neighbourhood-enrichment / Ripley K stats on a clustered spatial AnnData via squidpy. Skip when ranking spatially variable genes (use spatial-genes); tissue domain detection (use spatial-domains).

Its SKILL.md is about 2.1k tokens, which your agent loads only when the skill is triggered. The skill folder holds 12 other files, including reference files (for example `r_visualization/README.md`, `references/methodology.md` and `references/output_contract.md`).

It sits in Data & Analytics, covering Statistics. 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 MIT.

When your agent uses it

  • Tasks that involve Statistics

Example prompts

  • “/spatial-statistics”

Requirements

  • Python 3

Workflow steps

6 steps, taken from the first numbered list in SKILL.md.

  1. Load AnnData (--input) or chain through spatial-preprocess --demo via subprocess (spatial_statistics.py:1499-1515).
  2. parser.error validates --analysis-type ∈ VALID_ANALYSIS_TYPES; per-analysis numeric ranges (lines :1558-1601).
  3. Auto-resolve --cluster-key if unset; auto-leiden if no cluster column exists (with size guard at :1546).
  4. Dispatch to analysis-type runner; squidpy graph build uses --stats-n-neighs / --stats-n-rings / --stats-n-perms.
  5. Build standardised result tables; collect per-spot metrics.
  6. Save tables, figures, processed.h5ad, report.md, result.json.

What it can do on your machine

Read from SKILL.md and the folder at commit 6fbd79f. 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 Statistics loads about 2.1k tokens when it runs, and up to ~7k if it reads all its reference files. Until then it costs about 71 tokens; SKILL.md has 485 words of instructions outside code blocks.

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

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 6fbd79f, republished under its MIT licence (© TianGzlab). 485 words, ~2,054 tokens.

Download SKILL.mdSave it as .claude/skills/spatial-statistics/SKILL.md (or your agent's skills folder). This skill also uses 9 other files; get the full folder from GitHub.
name
spatial-statistics
description
Load when running spatial autocorrelation / hotspot / co-occurrence / neighbourhood-enrichment / Ripley K stats on a clustered spatial AnnData via squidpy. Skip when ranking spatially variable genes (use spatial-genes); tissue domain detection (use spatial-domains).
version
0.5.0
author
OmicsClaw
license
MIT
emoji
📊
tags
spatial, statistics, moran, geary, ripley, co-occurrence, nhood-enrichment, getis-ord, squidpy
requires
anndata, esda, libpysal, matplotlib, networkx, numpy, pandas, scanpy, scipy, seaborn, squidpy

spatial-statistics

When to use

The user has a clustered spatial AnnData (obs[--cluster-key] for cluster-aware analyses; obsm["spatial"] populated) and wants a specific spatial-statistics analysis. Pick --analysis-type from VALID_ANALYSIS_TYPES:

  • moran / geary — global spatial autocorrelation per gene.
  • local_moran — per-spot LISA + GeoDa quadrants (--local-moran-geoda-quads).
  • getis_ord — per-spot hotspot Z-scores.
  • bivariate_moran — exactly two genes (--genes geneA,geneB).
  • neighborhood_enrichment — squidpy NES between cluster pairs.
  • ripley — Ripley K / L / G / F (--ripley-mode, --ripley-metric).
  • co_occurrence — pairwise label co-occurrence at distance bins (--coocc-interval, --coocc-n-splits).
  • spatial_centrality — graph-centrality per spot.

For per-gene SVG ranking use spatial-genes; for tissue-domain detection use spatial-domains.

Inputs & Outputs

<!-- AUTO-GENERATED from skill.yaml (interface) — do not edit by hand. Regenerate: python scripts/generate_skill_md.py <skill_dir> -->

Inputs

  • File types: .h5ad
  • Requires a preprocessed AnnData (X normalised, PCA/neighbours present)
  • Expects obsm: spatial

Outputs

  • tables/analysis_results.csv
  • tables/analysis_summary.csv
  • tables/bivariate_moran_summary.csv
  • tables/centrality_scores.csv
  • tables/cluster_summary.csv
  • tables/cooccurrence_curves.csv
  • tables/cooccurrence_pairs.csv
  • tables/neighborhood_counts.csv
  • tables/neighborhood_pairs.csv
  • tables/neighborhood_zscore.csv
  • tables/network_per_cluster.csv
  • tables/network_summary.csv
  • tables/pair_summary.csv
  • tables/per_cluster_metrics.csv
  • tables/ripley_cluster_summary.csv
  • tables/ripley_curves.csv
  • tables/spot_statistics.csv
  • tables/top_results.csv
  • figures/bivariate_moran_scatter.png
  • figures/bivariate_moran_spatial.png
  • figures/centrality_scores.png
  • figures/centrality_scores_barplot.png
  • figures/co_occurrence_curves.png
  • figures/co_occurrence_distribution.png
  • figures/co_occurrence_top_pairs.png
  • figures/geary_pvalue_distribution.png
  • figures/geary_ranking.png
  • figures/geary_score_vs_significance.png
  • figures/moran_pvalue_distribution.png
  • figures/moran_ranking.png
  • figures/moran_score_vs_significance.png
  • figures/neighborhood_enrichment_heatmap.png
  • figures/neighborhood_top_pairs.png
  • figures/neighborhood_zscore_distribution.png
  • figures/network_degree_histogram.png
  • figures/network_per_cluster_degree.png
  • figures/ripley_cluster_max_stat.png
  • figures/ripley_curves.png
  • figures/ripley_stat_distribution.png
  • processed.h5ad
  • report.md
  • result.json
  • Processed AnnData (saves_h5ad) — adds obs: local_moran_<gene>, local_moran_pval_<gene>, local_moran_q_<gene>, getis_ord_<gene>, getis_ord_pval_<gene>

Flow

  1. Load AnnData (--input) or chain through spatial-preprocess --demo via subprocess (spatial_statistics.py:1499-1515).
  2. parser.error validates --analysis-type ∈ VALID_ANALYSIS_TYPES; per-analysis numeric ranges (lines :1558-1601).
  3. Auto-resolve --cluster-key if unset; auto-leiden if no cluster column exists (with size guard at :1546).
  4. Dispatch to analysis-type runner; squidpy graph build uses --stats-n-neighs / --stats-n-rings / --stats-n-perms.
  5. Build standardised result tables; collect per-spot metrics.
  6. Save tables, figures, processed.h5ad, report.md, result.json.
Show full SKILL.md (261 more words)Show less

Gotchas

  • All input + parameter validation goes through parser.error (exit code 2). spatial_statistics.py:1530 for missing --input; :1546 for too-small dataset to auto-leiden; :1558 for invalid --analysis-type; :1560-1601 for numeric / multi-value flag validation. Wrappers expecting ValueError need to catch exit-2.
  • bivariate_moran requires exactly TWO genes. spatial_statistics.py:1601 raises parser.error("--analysis-type bivariate_moran requires exactly two genes via --genes geneA,geneB"). Pass them comma-separated, no spaces.
  • Demo chains through spatial-preprocess via subprocess. spatial_statistics.py:1499 raises FileNotFoundError(f"spatial-preprocess not found at {preprocess_script}") if the sibling skill is missing; :1510 raises RuntimeError("spatial-preprocess --demo failed (exit ...)") on chained failure; :1515 raises FileNotFoundError(f"Expected {processed}") when the demo output isn't where expected.
  • --cluster-key auto-leiden has a size guard. spatial_statistics.py:1546 raises parser.error("Dataset is too small to auto-compute leiden clusters.") when the auto-fallback can't run. Pass --cluster-key <existing-column> for small datasets.
  • local_moran writes n_significant_spots; getis_ord writes n_hotspots. spatial_statistics.py:555 documents the value-column divergence. Downstream tools reading "spatially significant cell count" need to branch on --analysis-type.
  • neighborhood_enrichment consumes <cluster_key>_nhood_enrichment from uns. Computed lazily within squidpy; if you re-run with a different --cluster-key, the previous uns key remains and won't be reused for the new cluster column. Clean adata.uns between runs or expect stale keys.
  • spatial_centrality is graph-only. It produces per-spot centrality without any cluster-key dependency — useful when --cluster-key is unavailable.

Key CLI

bash
# Demo (chained from spatial-preprocess --demo)
python omicsclaw.py run spatial-statistics --demo --analysis-type moran --output /tmp/spatial_stats_demo

# Global Moran's I on a clustered AnnData
python omicsclaw.py run spatial-statistics \
  --input clustered.h5ad --output results/ \
  --analysis-type moran --cluster-key spatial_domain --stats-n-perms 100

# Local Moran with GeoDa quadrants
python omicsclaw.py run spatial-statistics \
  --input clustered.h5ad --output results/ \
  --analysis-type local_moran --local-moran-geoda-quads --n-top-genes 20

# Neighbourhood enrichment between clusters
python omicsclaw.py run spatial-statistics \
  --input clustered.h5ad --output results/ \
  --analysis-type neighborhood_enrichment --cluster-key spatial_domain

# Ripley K on a labelled object
python omicsclaw.py run spatial-statistics \
  --input clustered.h5ad --output results/ \
  --analysis-type ripley --ripley-mode K --ripley-n-simulations 100 --ripley-n-steps 50

# Co-occurrence at increasing distance bins
python omicsclaw.py run spatial-statistics \
  --input clustered.h5ad --output results/ \
  --analysis-type co_occurrence --cluster-key cell_type --coocc-interval 30 --coocc-n-splits 5

# Bivariate Moran between two genes
python omicsclaw.py run spatial-statistics \
  --input clustered.h5ad --output results/ \
  --analysis-type bivariate_moran --genes EGFR,BRCA1

See also

  • references/parameters.md — every CLI flag, per-analysis numeric ranges
  • references/methodology.md — when each analysis-type wins; squidpy mapping
  • references/output_contract.md — per-analysis table / obs / uns schema
  • Adjacent skills: spatial-preprocess (upstream — produces obsm["spatial"] + cluster column), spatial-domains / spatial-annotate (upstream — produce obs["spatial_domain"] / cell-type labels for --cluster-key), spatial-genes (parallel — per-gene SVG ranking, NOT statistics on labels), spatial-de (downstream — DE between clusters identified by neighbourhood-enrichment hotspots)

© TianGzlab, MIT. 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 9 other files (references) in skills/spatial/spatial-statistics of TianGzlab/OmicsClaw.

  • SKILL.md
  • r_visualization/README.md
  • r_visualization/stats_publication_template.R
  • references/methodology.md
  • references/output_contract.md
  • references/parameters.md
  • skill.yaml
  • spatial_statistics.py
  • tests/__init__.py
  • tests/test_spatial_statistics.py

Open the folder on GitHubat commit 6fbd79f

Compare with similar skills

Spatial Statistics 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 Statistics compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Spatial Statistics this skillTianGzlab/OmicsClaw161—~2.1kAutomated safety check: PassMIT
PyDESeq2 Differential Expressiondavila7/claude-code-templates32k12 repos~4kAutomated safety check: PassMIT
Multiomics StatisticsVectorSpaceLab/AREX-Skill328—~1kAutomated safety check: PassGPL-3.0
Statistical Analysisspacering-net/codeg3.8k3 repos~5kAutomated safety check: PassMIT
StatsmodelszLanqing/codex-claude-academic-skills4.6k16 repos~4.9kAutomated safety check: PassBSD-3-Clause
AI Daily DigestvigorX777/ai-daily-digest1.6k—~1.3kAutomated safety check: PassNone

Similar skills

  • 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 12 repos~4k tokens
    Research & ScienceAuto-check passed
  • Multiomics Statistics

    VectorSpaceLab/AREX-Skill

    A skill your agent uses for OmicVerse bulk RNA-seq, enrichment/signature scoring, metabolomics, proteomics, microbiome, and statistical table workflows.

    328 GitHub stars~1k tokensUpdated 1 mo ago
    Research & ScienceAuto-check passed
  • Statistical Analysis

    spacering-net/codeg

    Guided statistical analysis for research data - test selection, assumption checking, effect sizes, power analysis, Bayesian alternatives, and APA-formatted reporting.

    3.8k GitHub starsUsed in 3 repos~5k tokens
    Data & AnalyticsAuto-check passed
  • Statsmodels

    zLanqing/codex-claude-academic-skills

    Statistical models library for Python. An agent skill from zLanqing/codex-claude-academic-skills.

    4.6k GitHub starsUsed in 16 repos~4.9k tokens
    Data & AnalyticsAuto-check passed
  • AI Daily Digest

    vigorX777/ai-daily-digest

    Fetches RSS feeds from 90 top Hacker News blogs (curated by Karpathy), uses AI to score and filter articles, and generates a daily digest in Markdown with Chinese-translated titles, category…

    1.6k GitHub stars~1.3k tokensUpdated 7 mo ago
    Data & AnalyticsAuto-check passed
  • Statistical Power

    spacering-net/codeg

    Sample-size and statistical power calculations for planning studies.

    3.8k GitHub starsUsed in 1 repo~3.6k tokens
    Data & AnalyticsAuto-check: notes

More from TianGzlab/OmicsClaw

All 95 skills in this repo
  • Bulkrna Batch Correction

    TianGzlab/OmicsClaw

    Load when removing batch effects from a multi-cohort bulk RNA-seq dataset using ComBat (R or Python implementation).

    161 GitHub stars~1.2k tokensUpdated 2 mo ago
    Auto-check passed
  • Bulkrna Coexpression

    TianGzlab/OmicsClaw

    Load when discovering gene co-expression modules and hub genes in a bulk RNA-seq cohort via WGCNA-style soft-thresholded networks.

    161 GitHub stars~1.2k tokensUpdated 2 mo ago
    Auto-check passed
  • Bulkrna De

    TianGzlab/OmicsClaw

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

    161 GitHub stars~976 tokensUpdated 2 mo ago
    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~984 tokensUpdated 2 mo ago
    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~1.1k tokensUpdated 2 mo ago
    Auto-check passed
  • Bulkrna Geneid Mapping

    TianGzlab/OmicsClaw

    Load when converting gene identifiers between Ensembl, Entrez, and HGNC symbol in a bulk RNA-seq count matrix.

    161 GitHub stars~1k tokensUpdated 2 mo ago
    Auto-check passed

Works with

Questions about Spatial Statistics

What does Spatial Statistics do?

Load when running spatial autocorrelation / hotspot / co-occurrence / neighbourhood-enrichment / Ripley K stats on a clustered spatial AnnData via squidpy. Spatial Statistics is an agent skill from TianGzlab/OmicsClaw. Load when running spatial autocorrelation / hotspot / co-occurrence / neighbourhood-enrichment / Ripley K stats on a clustered spatial AnnData via squidpy.

When should I use Spatial Statistics?

Spatial Statistics fits situations like: tasks that involve Statistics.

How do I install Spatial Statistics in Claude Code?

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

How do I install Spatial Statistics in Codex?

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

Can I use Spatial Statistics 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-statistics -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-statistics, .gemini/skills/spatial-statistics, .github/skills/spatial-statistics and .opencode/skills/spatial-statistics in your project.

What does Spatial Statistics need to run?

Going by SKILL.md and its folder, Spatial Statistics 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 Statistics 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 Statistics 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 Statistics use?

Spatial Statistics is published under the MIT licence (declared in SKILL.md). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does Spatial Statistics use?

About 2.1k tokens (SKILL.md is roughly 8.2k 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 5k tokens, read only when the agent opens those files.

What are the alternatives to Spatial Statistics?

Skills that share tags, products or a category with Spatial Statistics: PyDESeq2 Differential Expression (davila7/claude-code-templates, 32k stars), Multiomics Statistics (VectorSpaceLab/AREX-Skill, 328 stars), Statistical Analysis (spacering-net/codeg, 3.8k stars) and Statsmodels (zLanqing/codex-claude-academic-skills, 4.6k stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Spatial Statistics?

TianGzlab (a GitHub organization) maintains it in TianGzlab/OmicsClaw, which has 161 GitHub stars. The repository holds 95 skills in this directory. The repository was last updated on July 28, 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.