A cell’s local neighborhood consists of the collection of cell types in its immediate vicinity. Our insight reports are built using SpatialMap. A standard neighborhood analysis workflow using SpatialMap is illustrated in this vignette.

Briefly:

To define each cell’s neighborhood, we use a k-nearest-neighbors (knn) approach. First, a KNN graph is calculated on the spatial embedding for each image, using the function spatialNearestNeighbors. The number of nearest neighbors to include in each cell’s neighborhood can be tuned by altering the value passed to k, Then, the cell type composition of each cell’s neighborhood is enumerated using the function cellNeighborhoods.

To identify repeating patterns in the neighborhood composition of cells across an entire dataset (i.e. cellular neighborhoods), we use a k-means clustering approach, implemented by the function neighborhoodClusters. This function returns a silhouette plot from the k-means algorithm, which can be a useful data-driven heuristic to determine the true number of cellular neighborhoods present in a dataset. Ultimately, the final choice of number of neighborhoods is driven by biological interpretation of the data, based on the cell type compositions of each resulting cellular neighborhood.

Once a final set of biologically meaningful cellular neighborhoods has been determined, we will report:

  1. The frequency of each constituent cell type in each cellular neighborhood, as a proportion of all cells in that neighborhood.
  2. The frequency of each cellular neighborhood within each image, as a proportion of all cells in that image.

If a metadata trait specifying cohort definitions is provided, we will also report the result of a statistical comparison between groups of the frequency of each neighborhood in each sample: