Skip to content

Drop region (region_key and instance_key are enough) #629

Open

Description

@LucaMarconato

Motivation

The region metadata field was introduced at the storage format level to be able to tell which elements a table is annotating, without the need to examine the data in the table.

In memory the region metadata is redundant, as region can be computed on-the-fly looking at

adata = sdata.tables['my_table']
region_key = adata.uns['spatialdata_attrs']['region_key']
region = adata.obs[region_key].cat.categories

(the above assumes that the region_key column is categorical, which is already a requirement for certain plotting functions and operations (such as rasterize_bins())).

Dropping region will simplify the syntax when dealing with tables. For instance now when calling set_table_annotates_spatialelement(), the user needs to adjust the region metadata manually.

Plan

With this issue we propose (@melonora and I) to:

  • drop the region metadata in-memory
  • when writing, compute the metadata as above
  • when reading, ignoring the region metadata
  • provide a property computed as above for convenience (since the above code is verbose).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions