scverse / scverse/spatialdata-io

Unable to read xenium data

Open
#309 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
103
Forks
65
Avg merge
1h 8m
Merged PRs (30d)
3

Description

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.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at the xenium entry point and readers/xenium.py, especially the _get_tables_and_circles call shown in the traceback. Reproduce the failure with the listed new Xenium output bundle and verify that the reader handles its .zarr files without attempting to open the missing cell_feature_matrix.h5 file.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
data
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.