tacco.tools.fill_regions

fill_regions(adata, region_key='region', batch_key=None, position_key=('x', 'y'))[source]

Fills the region annotation of not annotated observation (i.e. na values) with the annotation of the spatially closest annotated observation.

Parameters:
  • adata – An AnnData including region and position annotation.

  • region_key – The .obs key where the region annotation is stored.

  • batch_key – The .obs key with categorical batch information. If not None, the filling is performed per batch.

  • position_key – The .obsm key or array-like of .obs keys with the position space coordinates.

Returns:

The updated input adata containing the filled obs[region_key].