Skip to content

Xenium read error #325

Open
Open

Description

@SirKuikka

Hi,

I am using spatialdata-io v0.3.0 and trying to read the data from the Xenium bundle with this command

xenium_bundle_path = "/path/to/xenium/data"
zarr_path = "/path/to/workdir"
sdata = xenium(xenium_bundle_path)

but I got this error:

ValueError: Expected files in the morphology focus directory to be named as morphology_focus_0000.ome.tif to morphology_focus_0003.ome.tif, found {'ch0000_dapi.ome.tif', 'ch0001_atp1a1_cd45_e-cadherin.ome.tif', 'ch0003_alphasma_vimentin.ome.tif', 'ch0002_18s.ome.tif'}

I think this may have happened because I am using new Xenium version and spatialdata-io doesn't support it yet:

Instrument software version | 4.0.1.4
Analysis version | xenium-4.0.1.0

Activity

  1. SirKuikka commented on Sep 17, 2025

    @SirKuikka
    Author

    Plus there's a warning like this

    miniconda3/envs/squidpy/lib/python3.10/site-packages/spatialdata_io/_utils.py:48: UserWarning: The "cell_id" column in the cells metadata table does not match the "cell_id" column in the annotation table. This could be due to trying to read a new version that is not supported yet. Please report this issue.

  2. philinscience commented on Sep 19, 2025

    @philinscience

    hi, running into the problem. did you find any work around?

  3. SirKuikka commented on Sep 22, 2025

    @SirKuikka
    Author

    @philinscience No, but Seurat doesn't have this issue.

  4. spatts14 commented on Oct 6, 2025

    @spatts14

    I have the same issue - it seems like 10X changed the morphology output names. The work around is manually renaming the morphology_focus files to match the expected output.

  5. whtns commented on Oct 6, 2025

    @whtns

    does #312 resolve the issue?

  6. spatts14 commented on Oct 7, 2025

    @spatts14

    @whtns thanks for flagging.

    All my packages are up to date and I've updated anndata to the most recent version (V0.12.2) and It still isn't working for me. Is there something I've missed?

    # Name                    Version                   Build  Channel
    anndata                   0.12.2                   pypi_0    pypi
    scanpy                    1.11.4             pyhd8ed1ab_0    conda-forge
    spatial-image             1.2.3              pyhd8ed1ab_1    conda-forge
    spatialdata               0.5.0              pyhd8ed1ab_0    conda-forge
    spatialdata-io            0.3.0              pyhd8ed1ab_0    conda-forge
    squidpy                   1.6.5              pyhd8ed1ab_0    conda-forge
    

    This is the error I'm getting

    ---------------------------------------------------------------------------
    ValueError                                Traceback (most recent call last)
    Cell In[4], [line 1](vscode-notebook-cell:?execution_count=4&line=1)
    ----> [1](vscode-notebook-cell:?execution_count=4&line=1) sdata = xenium(xenium_path)
    
    File ~/miniforge3/envs/xenium_5k/lib/python3.12/site-packages/spatialdata_io/_utils.py:48, in deprecation_alias.<locals>.deprecation_decorator.<locals>.wrapper(*args, **kwargs)
         46 class_name = f.__qualname__
         47 rename_kwargs(f.__name__, kwargs, aliases, class_name)
    ---> [48](https://file+.vscode-resource.vscode-cdn.net/Users/sarapatti/PhD_projects/Xenium_5k_analysis_pipeline/~/miniforge3/envs/xenium_5k/lib/python3.12/site-packages/spatialdata_io/_utils.py:48) return f(*args, **kwargs)
    
    File ~/miniforge3/envs/xenium_5k/lib/python3.12/site-packages/spatialdata_io/readers/xenium.py:298, 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)
        293     raise ValueError(
        294         "Expected 1 (no segmentation kit) or 4 (segmentation kit) files in the morphology focus directory, "
        295         f"found {len(files)}: {files}"
        296     )
        297 if files != {XeniumKeys.MORPHOLOGY_FOCUS_CHANNEL_IMAGE.value.format(i) for i in range(len(files))}:
    --> [298](https://file+.vscode-resource.vscode-cdn.net/Users/sarapatti/PhD_projects/Xenium_5k_analysis_pipeline/~/miniforge3/envs/xenium_5k/lib/python3.12/site-packages/spatialdata_io/readers/xenium.py:298)     raise ValueError(
        299         "Expected files in the morphology focus directory to be named as "
        300         f"{XeniumKeys.MORPHOLOGY_FOCUS_CHANNEL_IMAGE.value.format(0)} to "
        301         f"{XeniumKeys.MORPHOLOGY_FOCUS_CHANNEL_IMAGE.value.format(len(files) - 1)}, found {files}"
        302     )
        303 if len(files) == 1:
        304     channel_names = {
        305         0: XeniumKeys.MORPHOLOGY_FOCUS_CHANNEL_0.value,
        306     }
    
    ValueError: Expected files in the morphology focus directory to be named as morphology_focus_0000.ome.tif to morphology_focus_0003.ome.tif, found {'ch0000_dapi.ome.tif', 'ch0001_atp1a1_cd45_e-cadherin.ome.tif', 'ch0002_18s.ome.tif', 'ch0003_alphasma_vimentin.ome.tif'}```
    
  7. LucaMarconato commented on Nov 2, 2025

    @LucaMarconato
    Member

    Hi @spatts14, it should now be addressed in main, but we haven't made a release of the code yet. Please pip install from GitHub and let us know if it addresses your problem.

  8. wlason commented on Feb 5, 2026

    @wlason

    Hi @LucaMarconato, was wondering if the fix for this is part of the most recent release?

  9. LucaMarconato commented on Feb 5, 2026

    @LucaMarconato
    Member

    Yes, it the release includes a PR that should cover this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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