sparrow.tb.add_table_layer

sparrow.tb.add_table_layer#

sparrow.tb.add_table_layer(sdata, adata, output_layer, region, overwrite=False)#

Add a table layer to a SpatialData object.

This function allows you to add a table layer to sdata. If sdata is backed by a zarr store, the resulting table layer will be backed to the zarr store.

Parameters:
  • sdata (SpatialData) – The SpatialData object to which the new table layer will be added.

  • adata (AnnData) – The AnnData object containing the table data to be added. If region is not None, it should contain _REGION_KEY and _INSTANCE_KEY in adata.obs.

  • output_layer (str) – The name of the output layer where the table data will be stored.

  • region (list[str] | None) – A list of regions to associate with the table data. Typically this is all unique elements in adata.obs[_REGION_KEY].

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

Returns:

: The updated sdata object.