>>> spatialdata = spatialdata_io.visium(
args.SRCountDir, counts_file="raw_feature_bc_matrix.h5", dataset_id="visium"
)
>>> adata = to_legacy_anndata(sdata, include_images=True, coordinate_system="downscaled_hires")
/opt/conda/lib/python3.10/site-packages/spatialdata/_core/query/relational_query.py:325: FutureWarning: The default of observed=False is deprecated and will be changed to True in a future version of pandas. Pass observed=False to retain current behavior or observed=True to adopt the future default and silence this warning.
groups_df = table.obs.groupby(by=region_column_name)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/opt/conda/lib/python3.10/site-packages/spatialdata_io/converters/legacy_anndata.py", line 176, in to_legacy_anndata
bb = get_extent(sdata_images)
File "/opt/conda/lib/python3.10/functools.py", line 889, in wrapper
return dispatch(args[0].__class__)(*args, **kw)
File "/opt/conda/lib/python3.10/site-packages/spatialdata/_core/data_extent.py", line 239, in _
raise ValueError(
ValueError: The SpatialData object does not contain any element in the coordinate system 'global', please pass a different coordinate system with the argument 'coordinate_system'.
My guess is that the spatialdata_io.visium reader does not include the raw global transform image in the sdata object. So to_legacy_anndata would need to rely on sdata.shapes[dataset_id] instead of global images.
Hi,
I am trying to get an AnnData object out of a SpatialData object created with
spatialdata_io.visium(...)
:But it fails:
My guess is that the
spatialdata_io.visium
reader does not include the rawglobal
transform image in the sdata object. Soto_legacy_anndata
would need to rely onsdata.shapes[dataset_id]
instead of global images.