spatial-microenvironment-subset

spatial-microenvironment-subset is a skill for Claude Code, Codex from TianGzlab/OmicsClaw. It costs 66 tokens per session (1,690 once invoked), scanned A, original, Apache-2.0.

A spatial transcriptomics tool that extracts a local microenvironment around selected centre cells or spots. It keeps the centres and every nearby location within a chosen radius.

In plain words
What is it for?
Use it with labelled Visium or Xenium data to select a niche around a cell type or tissue-domain label and save a smaller AnnData dataset.
Why use it?
It lets you study a focused neighbourhood instead of analysing the whole tissue at once.

Skill for Claude CodeCodex

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add skills/tiangzlab/omicsclaw/spatial-microenvironment-subset
Any agent
npx skills add TianGzlab/OmicsClaw --skill spatial-microenvironment-subset
Clone the repo
git clone --depth 1 https://github.com/TianGzlab/OmicsClaw

Made for: Claude Code, Codex.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for spatial-microenvironment-subset

README.md
[![agentmods](https://agentmods.dev/badge/skills/tiangzlab/omicsclaw/spatial-microenvironment-subset.svg)](https://agentmods.dev/skills/tiangzlab/omicsclaw/spatial-microenvironment-subset)
Your own site
<a href="https://agentmods.dev/skills/tiangzlab/omicsclaw/spatial-microenvironment-subset"><img src="https://agentmods.dev/badge/skills/tiangzlab/omicsclaw/spatial-microenvironment-subset.svg" alt="Measured on agentmods" height="20"></a>
Per session 66 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,690 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00066 $0.01690
Opus 5 $0.00033 $0.00845
Sonnet 5 $0.00013 $0.00338
Haiku 4.5 $0.00007 $0.00169

Measured yesterday against content hash a64c7dcff26d, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

spatial-microenvironment-subset scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured yesterday.

The scan reads SKILL.md. This mod also ships 2 executable files (spatial_microenvironment_subset.py, tests/test_spatial_microenvironment_subset.py), listed below but not scanned — reading those needs a real analyzer, not pattern matching.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

skills/spatial/spatial-microenvironment-subset/SKILL.md · 121 lines

How it starts

The opening of the file, as written. The whole thing — 121 lines — stays where its author put it; the contents beside it link to each section on GitHub.

spatial-microenvironment-subset

When to use

The user has a labelled spatial AnnData (cell-type or domain labels in obs[--center-key]) and wants to extract a niche around a chosen cell population — i.e., the center cells PLUS every spot / cell within a spatial radius of any center. Output is a downstream-ready AnnData restricted to that microenvironment.

Single backend (radius-based KD-tree neighbourhood). Two radius modes: --radius-microns (with --microns-per-coordinate-unit if your coords aren't in microns) OR --radius-native (in the AnnData's native coordinate units). Exactly one is required.

For global tissue-domain detection use spatial-domains. For cross-condition niche comparison use spatial-condition.

Inputs & Outputs

Inputs

  • Input kinds: file, directory
  • Modalities: visium, xenium
  • File types: .h5ad, .h5, .hdf5, .zarr
  • Expects obsm: spatial

Outputs

  • tables/center_observations.csv
  • tables/label_composition.csv
  • tables/selected_observations.csv
  • tables/selection_summary.csv
  • figures/microenvironment_selection.png
  • spatial_microenvironment_subset.h5ad
  • report.md
  • result.json
  • Processed AnnData (saves_h5ad) — adds obs: microenv_is_center, microenv_role, microenv_within_radius, microenv_nearest_center, microenv_distance_native, microenv_distance_microns

Flow

  1. Load AnnData (--input) or build a demo.
  2. Validate radius flags (parser.error on ≤ 0); resolve --microns-per-coordinate-unit if needed.
  3. Resolve center mask: rows where obs[--center-key] ∈ --center-values (comma-split).
  4. Build a KD-tree on obsm["spatial"]; query each center for neighbours within radius.
  5. Optionally restrict neighbour pool to obs[--target-key] ∈ --target-values.
  6. Build the subset (centers + qualified neighbours; optionally drop centers via --exclude-centers).
  7. Save subset AnnData with role + distance columns; emit composition / summary tables; render selection figure.

Read the full file on GitHub · 121 lines

Files

What ships with it

6 files beside SKILL.md in the same directory: the scripts, references and assets a skill reads on demand. Not counted in the per-session cost; read them before you install if any of them is executable.

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. yesterday First seen · 121 lines · 66 tokens per session scan A a64c7dcff26d

Subscribe to this mod's changes

spatial-microenvironment-subset is a skill published in the GitHub repository TianGzlab/OmicsClaw (160 stars, last pushed 1mo ago), licensed Apache-2.0. It adds 66 tokens to every session and 1,690 once invoked, about $0.0003 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-09-03.

Related

Other skills, from other repositories

spatial-transcriptomics-spatial-data-io

Load spatial transcriptomics data from Visium, Xenium, MERFISH, Slide-seq, and other platforms using Squidpy and SpatialData. Use this skill when: (1) Loading Visium spatial transcriptomics data from Space Ranger output, (2) Loading Xenium single-cell resolution spatial data, (3) Loading MERFISH, CosMx, or other…

PharMolix/OpenBioMed · 103 tokens

spatial-preprocessing

Load spatial transcriptomics data (Visium, Xenium, MERFISH, Slide-seq, generic h5ad), perform QC filtering, normalization, HVG selection, PCA, UMAP, and Leiden clustering.

ShangBioLab/SpatialClaw · 49 tokens

spatial-domain-identification

Identify tissue regions and spatial niches from preprocessed spatial transcriptomics data using Leiden, Louvain, SpaGCN, STAGATE, GraphST, or BANKSY.

ShangBioLab/SpatialClaw · 40 tokens

spatial-omics-integrate

Integrate two aligned spatial omics modalities on the same cells using SpatialGlue or SpaDDM. Standard input contract: --input --omics2 . Supports demo mode and validated modality pairs such as RNA+Protein and RNA+ATAC.

ShangBioLab/SpatialClaw · 70 tokens

spatial-niches

Python API skill for spatial niche and tissue microenvironment discovery, characterization, and cross-condition comparison.

ShangBioLab/SpatialClaw · 24 tokens

pkpd-modeling

Pharmacokinetic and pharmacodynamic modelling and simulation - non-compartmental analysis, compartmental and population PK, PK/PD and exposure-response, TMDD, PBPK orientation, bioequivalence, allometric scaling and first-in-human dose, drug interaction prediction, and Bayesian therapeutic drug monitoring. Use when…

K-Dense-AI/scientific-agent-skills · 273 tokens