Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Drop region (region_key and instance_key are enough) #629

Open
4 tasks
LucaMarconato opened this issue Jul 9, 2024 · 0 comments
Open
4 tasks

Drop region (region_key and instance_key are enough) #629

LucaMarconato opened this issue Jul 9, 2024 · 0 comments

Comments

@LucaMarconato
Copy link
Member

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
Projects
None yet
Development

No branches or pull requests

1 participant