📍 Simple Spatial Analysis
1 2 3 | |
Running SCIMAP 1.3.14
1 2 | |
Compute the distances among cell types.
1 | |
Processing Image: exemplar-001--unmicst_cell
We'll utilize built-in plotting functions for visualization; however, for those interested in conducting additional analysis or custom plotting of these distances, the results can be found in adata.uns['spatial_distance'].
1 2 3 4 5 6 | |

For datasets containing multiple images, the default behavior averages the distances across all images. To analyze and plot the distances for each image individually, you should set heatmap_summarize to False. Although in this example with only one image the plot will appear similar to the previous one, you'll observe a difference in the y-axis.
1 | |

By default, summarization is performed using the imageid column, but you can also plot based on different conditions (such as control vs. treated) present in the dataset. Since we've included Regions of Interest (ROIs) in this dataset, let's attempt to plot the data based on these ROIs.
1 | |

These heatmaps provide a comprehensive overview of the proximity between cell types and how this proximity varies by ROIs, conditions, or across different images. After gaining an understanding of the broader landscape and possibly formulating some hypotheses, it's time to delve into a more detailed analysis.
Let's say there is an interest in identifying the cells closest to tumor cells; we will do the following analysis to address this interest.
1 2 3 | |

From the above plot, it's clear that NK cells and dendritic cells are distant from the tumor cells, while other cell types are so closely positioned that it's difficult to distinguish them. So, let's log the x-axis to make the pattern more distinct.
1 | |

Excellent, now let's say you're interested in comparing these observations between different conditions in your dataset (such as control vs. treatment). Since our dataset doesn't include multiple images, we'll use the ROIs as a substitute once again, as the underlying concept remains the same.
1 | |

Now, let's say you've narrowed down to a few cell types of interest. We can also subset and display only these selected cells.
1 2 3 4 5 | |

We can also visualize this using distribution plots instead of box plots, which is particularly useful if you want to demonstrate that the distance between two cell types vary across different conditions. However, in this case, the difference might not be apparent since we are working with demo data.
1 | |

Save Results
1 2 | |
1 | |