spatial-stats-neighborhood-enrichment

Compute neighborhood enrichment z-scores from spatial neighbor graphs.

3|Updated Apr 3, 2026
One-click install
npx skills add https://github.com/chenyhvvvv/STAT-agent --skill spatial-stats-neighborhood-enrichment
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: spatial-stats-neighborhood-enrichment
Source: https://github.com/chenyhvvvv/STAT-agent/tree/main/stat_agent/skills/spatial-stats-neighborhood-enrichment
Command: npx skills add https://github.com/chenyhvvvv/STAT-agent --skill spatial-stats-neighborhood-enrichment

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Compute neighborhood enrichment z-scores to identify which cell types are spatially co-localized or depleted from each other's neighborhoods using squidpy permutation testing on a spatial neighbor graph. Requires cell type annotations to function correctly.

Core Features & Use Cases

  • Detects spatial interactions between cell types by comparing observed neighborhood co-occurrence to randomized expectations.
  • Outputs a z-score matrix and counts for downstream visualization (e.g., heatmaps) to interpret tissue organization.
  • Applicable to single-slice datasets with x,y coordinates and celltype labels to characterize microenvironment patterns.

Quick Start

Run the neighborhood enrichment workflow on your target slice to obtain the z-score matrix.

Frequently Asked Questions about spatial-stats-neighborhood-enrichment

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I compute neighborhood enrichment for spatial transcriptomics data?

To compute neighborhood enrichment for spatial transcriptomics data, you need an annotated adata object with 'celltype' labels and 'x','y' coordinates. The Skill applies squidpy permutation testing on a spatial neighbor graph to generate z-score and count matrices.

What do neighborhood enrichment z-scores indicate about cell type co-localization?

Neighborhood enrichment z-scores indicate whether cell types are spatially co-localized or depleted. High positive z-scores show significant co-occurrence in tissue neighborhoods, while negative z-scores indicate spatial avoidance, comparing observed interactions to randomized expectations.

Can I use squidpy permutation testing on single-slice spatial datasets?

Yes, you can use squidpy permutation testing on single-slice spatial datasets. The workflow requires single-slice data with x,y coordinates and celltype labels to assess spatial relationships and characterize microenvironment patterns.

What spatial graph data is needed for cell type neighborhood enrichment analysis?

Cell type neighborhood enrichment analysis requires an adata object containing 'celltype' annotations in the obs DataFrame alongside 'x' and 'y' spatial coordinates. This spatial neighbor graph data enables the calculation of observed versus expected cell interactions.

How many permutations should I use for squidpy neighborhood enrichment testing?

You can define a specific number of permutations for squidpy neighborhood enrichment testing. The permutation count determines the statistical robustness of the z-score matrix, which evaluates cell type co-localization significance across the spatial neighbor graph.

What are the limitations of using permutation testing for spatial neighborhood enrichment?

A limitation of permutation testing for spatial neighborhood enrichment is its restriction to single-slice datasets with predefined celltype annotations. It cannot process multiple slices or unannotated spatial data, requiring complete coordinate and label inputs to function correctly.