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".
In this repository8 other files it gives its agents.
- cell-compositionSkill
- cell-dynamicsSkill
- cell-interactionSkill
- differential-analysisSkill
- functional-analysisSkill
- publication-readySkill
- spatial-analysisSkill
- troubleshootSkill
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
- Very specific: line 61
Use find_spatial_genes tool with:
- Very specific: line 82
Use visualize_data with plot_type="spatial":
- Distinctive: line 93
Use for: Overall pattern assessment
- Distinctive: line 110
Use for: Precise hotspot identification
≈ “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.
Files
Spatial Pattern Analysis
Overview
This skill answers: Which genes/features show significant spatial organization in this tissue?
Two complementary analyses:
- Spatially Variable Genes (SVG): Find genes with non-random spatial expression
- 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 analysisSpatially Variable Gene Detection
Method Selection
| Method | Speed | Best For | Output |
| SpatialDE | Moderate | Noise robustness | p-values, effect sizes |
| SPARK-X | Fast | Large datasets (>50k spots) | p-values, adjusted |
| Moran's I | Fast | Simple interpretation | I statistic, p-value |
| Sepal | Moderate | Multi-scale patterns | Scale-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 significancemoranI/effect_size: Strength of spatial patterngene: 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 genesStep 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
| Statistic | Interpretation |
| Moran's I > 0.3 | Strong positive spatial autocorrelation |
| Moran's I < -0.3 | Strong negative autocorrelation (checkerboard) |
| Getis-Ord z > 1.96 | Significant hot spot (p < 0.05) |
| Getis-Ord z < -1.96 | Significant 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 patternsScenario 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 compositionScenario 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 differenceBiological 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 With | Insight |
| Spatial domains | Which genes drive domain identity |
| Cell composition | Cell type-specific spatial patterns |
| Cell communication | Spatially organized signaling |
Troubleshooting
| Issue | Cause | Solution |
| No significant SVGs | Low spatial variation | Lower threshold, check data quality |
| Too many SVGs | Loose threshold | Use stricter adjusted p-value |
| Unexpected patterns | Batch effects | Check for technical artifacts |
| Slow computation | Large dataset | Use 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
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
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.

