sparrow.tb.nhood_enrichment#
- sparrow.tb.nhood_enrichment(sdata, labels_layer, table_layer, output_layer, celltype_column='annotation', seed=0, overwrite=False)#
Calculate the nhood enrichment using squidpy via
sq.gr.spatial_neighborsandsq.gr.nhood_enrichment.- Parameters:
sdata (
SpatialData) – Input SpatialData object containing spatial data.labels_layer (
list[str]) – The labels layer(s) ofsdataused to select the cells via the _REGION_KEY insdata.tables[table_layer].obs. Note that ifoutput_layeris equal totable_layerand overwrite is True, cells insdata.tables[table_layer]linked to otherlabels_layer(via the _REGION_KEY), will be removed fromsdata.tables[table_layer](also from the backing zarr store if it is backed).table_layer (
str) – The table layer insdata.output_layer (
str) – The output table layer insdata.celltype_column (
str(default:'annotation')) – This will be passed tocluster_keyofsquidpy.gr.nhood_enrichment.seed (
int(default:0)) – seedoverwrite (
bool(default:False)) – If True, overwrites theoutput_layerif it already exists insdata.
- Return type:
SpatialData- Returns:
: The updated SpatialData object.