neighbourhood enrichment

Plots a matrix plot using an enrichment score on spatial proximity of clusters. If spots belonging to two different clusters are often close to each other, then they will have a high score and can be defined as being enriched. On the other hand, if they are far apart, the score will be low and they can be defined as depleted.

Parameters

cluster_key: str Key by which to compute neighbouhood enrichment scores.


n_perms: int Number of permutations when computing the score.


Web view

neighbourhood_enrichment_screenshot neighbourhood_enrichment_screenshot

Python equivalent

import squidpy as sq

sq.gr.spatial_neighbors(adata)
sq.gr.nhood_enrichment(adata, n_perms=1000, cluster_key="cell_type")
sq.pl.nhood_enrichment(adata, cluster_key="cell_type")