Skip to content

Unable to read xenium data #309

@RiyaPodder

Description

@RiyaPodder

Hi,
I have installed the latest development version of spatialdata-io using pip install git+https://github.com/scverse/spatialdata-io.git@main.
Then I tried the below code:
from spatialdata_io import xenium
sdata = xenium(path_to_xenium_folder)

I get the FileNotFoundError.
Error log:
INFO reading /Users/riyapodder/Downloads/Sample_13666_Region_1/cell_feature_matrix.h5
/var/folders/rd/07ft8cf97nzgfgsy6gfk0lzc0000gp/T/ipykernel_16029/698948949.py:1: DeprecationWarning: The default value of cells_as_circles will change to False in the next release. Please pass True explicitly to maintain the current behavior.
sdata = xenium("/Users/riyapodder/Downloads/Sample_13666_Region_1")

FileNotFoundError Traceback (most recent call last)
Cell In[19], line 1
----> 1 sdata = xenium("/Users/riyapodder/Downloads/Sample_13666_Region_1")

File /opt/miniconda3/envs/spatial_analysis_2/lib/python3.10/site-packages/spatialdata_io/_utils.py:47, in deprecation_alias..deprecation_decorator..wrapper(*args, **kwargs)
45 class_name = f.qualname
46 rename_kwargs(f.name, kwargs, aliases, class_name)
---> 47 return f(*args, **kwargs)

File /opt/miniconda3/envs/spatial_analysis_2/lib/python3.10/site-packages/spatialdata_io/readers/xenium.py:185, in xenium(path, cells_boundaries, nucleus_boundaries, cells_as_circles, cells_labels, nucleus_labels, transcripts, morphology_mip, morphology_focus, aligned_images, cells_table, n_jobs, imread_kwargs, image_models_kwargs, labels_models_kwargs)
182 cells_table = True
184 if cells_table:
--> 185 return_values = _get_tables_and_circles(path, cells_as_circles, specs)
186 if cells_as_circles:
187 table, circles = return_values

File /opt/miniconda3/envs/spatial_analysis_2/lib/python3.10/site-packages/spatialdata_io/readers/xenium.py:523, in _get_tables_and_circles(path, cells_as_circles, specs)
520 def _get_tables_and_circles(
521 path: Path, cells_as_circles: bool, specs: dict[str, Any]
522 ) -> AnnData | tuple[AnnData, AnnData]:
--> 523 adata = _read_10x_h5(path / XeniumKeys.CELL_FEATURE_MATRIX_FILE)
524 metadata = pd.read_parquet(path / XeniumKeys.CELL_METADATA_FILE)
525 np.testing.assert_array_equal(metadata.cell_id.astype(str), adata.obs_names.values)
...
File h5py/_objects.pyx:57, in h5py._objects.with_phil.wrapper()

File h5py/h5f.pyx:102, in h5py.h5f.open()

FileNotFoundError: [Errno 2] Unable to synchronously open file (unable to open file: name = '/Users/riyapodder/Downloads/Sample_13666_Region_1/cell_feature_matrix.h5', errno = 2, error message = 'No such file or directory', flags = 0, o_flags = 0)

my xenium folder contains these files:
analysis_summary.html cell_feature_matrix.zarr cells.zarr.zip transcripts.zarr
analysis.zarr cell_feature_matrix.zarr.zip experiment.xenium transcripts.zarr.zip
analysis.zarr.zip cells.zarr morphology.ome.tif

I understand that the data that I have is the new xenium output bundle. Is the xenium reader function not updated to handle this data? Or am I missing something? Requesting your kind assistance.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions