Skip to content

Spatial stats#9

Open
AnthonyChristidis wants to merge 3 commits into
oylab:masterfrom
ccb-hms:spatial-stats
Open

Spatial stats#9
AnthonyChristidis wants to merge 3 commits into
oylab:masterfrom
ccb-hms:spatial-stats

Conversation

@AnthonyChristidis
Copy link
Copy Markdown

Spatial Statistics Integration (Squidpy / PySAL)

This PR completely integrates spatial statistics into the oyLabImaging pipeline, allowing users to move beyond temporal single-cell tracking to analyze spatiotemporal cell-cell interactions.

Key Features Added to Results.py:

  • Global Spatial Autocorrelation: Added Moran's I and Geary's C to measure global clustering of fluorescent markers across the dish.
  • Local Spatial Hotspots: Added Local Moran's I and Local Bivariate Moran's I. Calculates a per-cell spatial score to identify High-High (Hotspots), Low-Low (Coldspots), and boundary cells. These scores are automatically saved to P.framelabels[t].regionprops.
  • Neighborhood Enrichment: Categorical neighborhood analysis (sq.gr.nhood_enrichment). Users can define a cluster_key to see which discrete cell states (e.g., Infected vs Healthy) physically touch more than random chance.
  • Dynamic Plotting: Added R.plot_spatial_stats() to automatically generate X/Y spatial maps, grouped bar charts (for single timepoints), and continuous line graphs (for timelapse).
  • Interactive Napari Integration: Added R.show_spatial_map_napari() to seamlessly overlay the calculated spatial hotspots directly onto the raw microscopy TIFFs. Includes support for full-movie timelapse sliders and stacked toggleable layers.

Dependencies Added (setup.py & environment.yml):

  • squidpy
  • anndata
  • esda
  • libpysal

Documentation:
Added two fully documented Jupyter Notebooks to the notebooks/ directory demonstrating the complete pipeline on real data:

  1. SpatialStats_SingleTimepoint.ipynb
  2. SpatialStats_Timelapse.ipynb

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant