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
. Ifsdata
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. Ifregion
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 inadata.obs[_REGION_KEY]
.overwrite (
bool
(default:False
)) – If True, overwrites the output layer if it already exists insdata
.
- Returns:
: The updated
sdata
object.