agentleFS
cafferychen777cafferychen777/ChatSpatial/.agents/skills/spatial-patterns/SKILL.md

spatial-patterns

Skill45 starsChanged 3 months agoMITView on GitHub

Identify genes and features with significant spatial patterns and organization. Use when user wants to find spatially variable genes, spatial autocorrelation, or spatial clustering patterns. Triggers: "spatially variable genes", "spatial pattern", "Moran's I", "spatial autocorrelation", "which genes vary spatially", "SVG", "SpatialDE", "SPARK", "hot spots", "Getis-Ord".

The file

We split this skill into the rules it gives an agent

4 rules. About 0 are common, 2 are distinctive, and 2 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈2

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 2

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    Use find_spatial_genes tool with:

    line 61
  2. Very specific:

    Use visualize_data with plot_type="spatial":

    line 82
  3. Distinctive:

    Use for: Overall pattern assessment

    line 93
  4. Distinctive:

    Use for: Precise hotspot identification

    line 110

≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Spatial Pattern Analysis

Overview

This skill answers: Which genes/features show significant spatial organization in this tissue?

Two complementary analyses:

  1. Spatially Variable Genes (SVG): Find genes with non-random spatial expression
  2. Spatial Statistics: Quantify and test spatial patterns

Decision Tree: Which Analysis?

Q: What do you want to know?
│
├─ Which genes have spatial patterns?
│   └─ SVG Detection
│       ├─ SpatialDE - Gaussian Process, handles noise well
│       ├─ SPARK-X - Fast, scalable to large datasets
│       └─ Moran's I per gene - Classic, interpretable
│
├─ Are spatial patterns statistically significant?
│   └─ Spatial Statistics
│       ├─ Global Moran's I - Overall spatial autocorrelation
│       ├─ Getis-Ord Gi* - Local hot/cold spot detection
│       └─ Ripley's K/L - Point pattern analysis
│
└─ Where are the spatial hotspots?
    └─ Local Spatial Statistics
        ├─ LISA - Local Moran's I
        └─ Getis-Ord Gi* - Hot spot analysis

Spatially Variable Gene Detection

Method Selection

MethodSpeedBest ForOutput
SpatialDEModerateNoise robustnessp-values, effect sizes
SPARK-XFastLarge datasets (>50k spots)p-values, adjusted
Moran's IFastSimple interpretationI statistic, p-value
SepalModerateMulti-scale patternsScale-specific genes

Workflow

Step 1: Run SVG Detection

Use find_spatial_genes tool with:

  • method: "spatialDE", "sparkx", or "moran"
  • n_top_genes: Number of top genes to return (default 100)

Step 2: Interpret Results

Key output columns:

  • pval / padj: Statistical significance
  • moranI / effect_size: Strength of spatial pattern
  • gene: Gene identifier

Filtering criteria:

Recommended thresholds:
- Adjusted p-value < 0.05 (stringent: < 0.01)
- Effect size > 0.1 (moderate spatial pattern)
- Expression level: Filter very low-expressed genes

Step 3: Visualize Top SVGs

Use visualize_data with plot_type="spatial":

  • Show expression of top SVGs spatially
  • Overlay with tissue domains for context

Spatial Statistics Analysis

Global Statistics

Moran's I: Measures overall spatial autocorrelation

  • Range: -1 (dispersed) to +1 (clustered)
  • 0 = random distribution
  • Use for: Overall pattern assessment

Geary's C: Alternative to Moran's I

  • Range: 0 (clustered) to 2 (dispersed)
  • 1 = random
  • More sensitive to local variation

Local Statistics

LISA (Local Moran's I): Identifies local clusters

  • High-High: Hot spots (high values surrounded by high)
  • Low-Low: Cold spots (low values surrounded by low)
  • High-Low / Low-High: Spatial outliers

Getis-Ord Gi*: Hot spot analysis

  • Positive z-score: Hot spot (high value cluster)
  • Negative z-score: Cold spot (low value cluster)
  • Use for: Precise hotspot identification

Workflow

Step 1: Compute Spatial Statistics

Use analyze_spatial_statistics tool with:

  • statistic: "moran", "geary", "getis_ord", or "ripley"
  • feature: Gene or obs column to analyze

Step 2: Interpret Results

StatisticInterpretation
Moran's I > 0.3Strong positive spatial autocorrelation
Moran's I < -0.3Strong negative autocorrelation (checkerboard)
Getis-Ord z > 1.96Significant hot spot (p < 0.05)
Getis-Ord z < -1.96Significant cold spot (p < 0.05)

Common Analysis Scenarios

Scenario 1: Find Tissue Boundary Genes

Goal: Genes marking transitions between regions
Approach:
1. Run SVG detection (SpatialDE recommended)
2. Overlay top SVGs with domain boundaries
3. Look for genes with gradient patterns

Scenario 2: Identify Hot Spots of Activity

Goal: Where is gene X most active?
Approach:
1. Run Getis-Ord Gi* on gene expression
2. Map significant hot spots spatially
3. Cross-reference with cell type composition

Scenario 3: Compare Spatial Organization

Goal: Do two conditions differ in spatial organization?
Approach:
1. Compute Moran's I for each condition separately
2. Compare I statistics
3. Test for significant difference

Biological Interpretation

What SVGs Tell You

  • Boundary markers: Genes defining tissue compartments
  • Gradient genes: Continuous spatial variation
  • Spot-specific: Localized expression patterns
  • Tissue architecture: Structural organization genes

Combining with Other Analyses

Combine WithInsight
Spatial domainsWhich genes drive domain identity
Cell compositionCell type-specific spatial patterns
Cell communicationSpatially organized signaling

Troubleshooting

IssueCauseSolution
No significant SVGsLow spatial variationLower threshold, check data quality
Too many SVGsLoose thresholdUse stricter adjusted p-value
Unexpected patternsBatch effectsCheck for technical artifacts
Slow computationLarge datasetUse SPARK-X, subsample for exploration

Output Summary

Successful spatial pattern analysis provides:

  • SVG list: Ranked spatially variable genes
  • Statistics: Significance and effect sizes
  • Spatial maps: Visualization of top patterns
  • Hotspots: Localized areas of interest

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.