harpy.tb.nhood_enrichment

harpy.tb.nhood_enrichment#

harpy.tb.nhood_enrichment(sdata, labels_name, table_name, output_table_name, celltype_column='annotation', seed=0, overwrite=False)#

Calculate the nhood enrichment using squidpy via squidpy.gr.spatial_neighbors() and squidpy.gr.nhood_enrichment().

Parameters:
  • sdata (SpatialData) – Input spatialdata.SpatialData object containing spatial data.

  • labels_name (list[str]) – The labels element(s) of sdata used to select the cells via the region key in sdata.tables[table_name].obs. Note that if output_table_name is equal to table_name and overwrite is True, cells in sdata.tables[table_name] linked to other labels_name (via the region key), will be removed from sdata.tables[table_name] (also from the backing zarr store if it is backed).

  • table_name (str) – The table element in sdata.

  • output_table_name (str) – The output table element in sdata.

  • celltype_column (str (default: 'annotation')) – This will be passed to cluster_key of squidpy.gr.nhood_enrichment().

  • seed (int (default: 0)) – seed

  • overwrite (bool (default: False)) – If True, overwrites the output_table_name if it already exists in sdata.

Return type:

SpatialData

Returns:

: The updated spatialdata.SpatialData object.