spatial-statistics

Compute Moran's I, Ripley's K/L, co-occurrence, and centrality for spatial transcriptomics data.

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

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Compute spatial statistics to quantify spatial patterns in gene expression and cell-type distributions in spatial transcriptomics data.

Core Features & Use Cases

  • Moran's I for spatial autocorrelation of genes to identify spatially structured expression.
  • Ripley's K/L for assessing clustering, dispersion, or randomness of cell-type distributions.
  • Co-occurrence analysis to measure distance-dependent proximities between cell types.
  • Centrality scores to rank cell types by their influence within the spatial graph.
  • Output stored in adata.uns and adata.obs for downstream visualization and interpretation.

Quick Start

Load a spatial transcriptomics dataset and run the Spatial Statistics Analysis skill to compute Moran's I, Ripley’s K/L, co-occurrence, and centrality scores for your cells or spots, then review the results stored in adata.uns.

Frequently Asked Questions about spatial-statistics

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

FAQPage Schema
How do I compute Moran's I for spatial autocorrelation in spatial transcriptomics data?

To compute Moran's I for spatial autocorrelation, run spatial statistics on a spatial transcriptomics dataset to identify spatially structured gene expression. The Skill calculates Moran's I across a spatial graph and stores the results in adata.uns for downstream interpretation.

Can I measure cell-type co-occurrence and clustering in tissue data using Ripley's K?

Yes, you can measure cell-type clustering and co-occurrence in tissue data using Ripley's K/L. The spatial statistics analysis assesses distance-dependent proximities and dispersion of cell-type distributions, outputting the results directly into adata.uns.

Does the spatial statistics analysis require a specific input format for cell-type annotations?

Yes, spatial statistics analysis requires an AnnData object with spatial coordinates in adata.obs and a specific cell-type annotation stored in adata.obs['celltype']. You also need squidpy and scanpy installed to execute the computations.

What is the best way to rank cell types by their influence within a spatial graph?

The best way to rank cell types by their influence within a spatial graph is to compute centrality scores. This spatial statistics analysis calculates centrality scores to quantify cell-type influence and stores the results in adata.uns and adata.obs.

Can I visualize spatial patterns and gene expression after computing spatial statistics?

Yes, you can visualize spatial patterns and gene expression after computing spatial statistics. The analysis outputs results into adata.uns and adata.obs, enabling you to generate visualizations to interpret spatial autocorrelation and cell-type distributions.

Does this spatial statistics analysis work with single-slice spatial transcriptomics datasets?

Yes, this spatial statistics analysis works with single-slice spatial transcriptomics datasets. It is applicable to datasets with gene or protein modalities and cell-type annotations, computing spatial statistics to quantify spatial patterns in tissue data.