You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
When using TableModel.parse, region_key must be provided. #306
I want to use TableModel.parse to parse the whole anndata, I set region=None, region_key=None, instance_key=None. But there is an error says region_key must be provided. Could I combine the anndata and spatialdata without region and region_key?
Related to this, @giovp, if one plug in an anndata as the table using sd.TableModel.parse if the region_key column is not existing in the .obs the function does not return an error, while if one save the whole SpatialData object and try to reload it, they will receive the following error:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/e915i/.conda/envs/py39/lib/python3.9/site-packages/spatialdata/_io/io_zarr.py", line 85, in read_zarr
sdata = SpatialData(
File "/home/e915i/.conda/envs/py39/lib/python3.9/site-packages/spatialdata/_core/spatialdata.py", line 161, in __init__
Table_s.validate(table)
File "/home/e915i/.conda/envs/py39/lib/python3.9/site-packages/spatialdata/models/models.py", line 644, in validate
raise ValueError(f"`{attr[self.REGION_KEY_KEY]}` not found in `adata.obs`.")
ValueError: `None` not found in `adata.obs`.
I used the defaults (hence region_key=None)
I suggest either assert this in the TableModel.parse or write or drop the assert in read_zarr.
Activity
giovp commentedon Jun 22, 2023
hi @yedeer12 ,
no you can't, spatialdata assumes that when a table it's present, it annotates a region element (shapes, labels).
We are working toward building a converter for anndata to spatialdata for anndata that are already available. pinging @LLehner who is working on it.
EliHei2 commentedon Jun 27, 2023
Related to this, @giovp, if one plug in an anndata as the
tableusingsd.TableModel.parseif theregion_keycolumn is not existing in the.obsthe function does not return an error, while if one save the whole SpatialData object and try to reload it, they will receive the following error:I used the defaults (hence
region_key=None)I suggest either assert this in the
TableModel.parseorwriteor drop the assert inread_zarr.LucaMarconato commentedon Jun 28, 2023
Thanks @EliHei2, I think we should assert it in
TableModel.parse().LucaMarconato commentedon Feb 22, 2024
Now with #455, we support multiple tables and also tables that are not associated with any set of geometries (i.e. region_key not provided).