Skip to content

Cannot read Visium HD data using spatialdata-io (Recurrent error). Data is non-zarr format. #252

@ankshe91

Description

@ankshe91

Please make sure these conditions are met

  • I have checked that this issue has not already been reported.
  • I have confirmed this bug exists on the latest version of scanpy.
  • (optional) I have confirmed this bug exists on the main branch of scanpy.

What happened?

I have non zarr format Visium HD data.
I tried reading it with sdata = visium_hd(path_read)

it keeps asking me for a dataset_id which is not there in the feature_slice file name or my folder.
Nonetheless, I kept setting it to None or "" or other possible dataset id values.

I cannot find any tech support on the error either.

(I also tried specifying the file path to the different binned folders)

Minimal code sample

path_read = '/Users/DarthRNA/Downloads/1299_1_XS_VHD_v2_outs'
sdata = visium_hd(path_read)

Error output

---------------------------------------------------------------------------
ValueError                                Traceback (most recent call last)
Cell In[54], line 1
----> 1 sdata = visium_hd(path_read)

File /Volumes/Ankitha/Conda/miniconda3/envs/myenv/lib/python3.12/site-packages/spatialdata_io/readers/visium_hd.py:95, in visium_hd(path, dataset_id, filtered_counts_file, bin_size, bins_as_squares, fullres_image_file, load_all_images, imread_kwargs, image_models_kwargs, anndata_kwargs)
     92 images: dict[str, Any] = {}
     94 if dataset_id is None:
---> 95     dataset_id = _infer_dataset_id(path)
     96 filename_prefix = f"{dataset_id}_"
     98 def load_image(path: Path, suffix: str, scale_factors: list[int] | None = None) -> None:

File /Volumes/Ankitha/Conda/miniconda3/envs/myenv/lib/python3.12/site-packages/spatialdata_io/readers/visium_hd.py:361, in _infer_dataset_id(path)
    359 files = [f for f in os.listdir(path) if os.path.isfile(os.path.join(path, f)) and f.endswith(suffix)]
    360 if len(files) == 0 or len(files) > 1:
--> 361     raise ValueError(
    362         f"Cannot infer `dataset_id` from the feature slice file in {path}, please pass `dataset_id` as an argument."
    363     )
    364 return files[0].replace(suffix, "")

ValueError: Cannot infer `dataset_id` from the feature slice file in /Users/DarthRNA/Downloads/1299_1_XS_VHD_v2_outs, please pass `dataset_id` as an argument.

Versions

Details

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions