scverse / scverse/spatialdata-io

Load Visium HD generated without microscopy image

Open
#270 8 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,

SpaceRanger can be run on Visium HD data without a full resolution microscopy image, and only the CytAssist image.
This will create a metadata_json with "microscope_colrow_to_spot_colrow": null, which will then fail when reading with spatialdata_io.visium_hd:

https://github.com/scverse/spatialdata-io/blob/625c77c4ff371e3d23e44aac0706abbaa2cf705a/src/spatialdata_io/readers/visium_hd.py#L459

Traceback (most recent call last):
  File "read_data.py", line 57, in <module>
    spatialdata = spatialdata_io.visium_hd(
  File "spatialdata_io/readers/visium_hd.py", line 110, in visium_hd
    transform_matrices = _get_transform_matrices(metadata, hd_layout)
  File "spatialdata_io/readers/visium_hd.py", line 426, in _get_transform_matrices
    transform_matrices[key.value] = _get_affine(data)
  File "spatialdata_io/readers/visium_hd.py", line 398, in _get_affine
    matrix = np.array(coefficients).reshape(3, 3)
ValueError: cannot reshape array of size 1 into shape (3,3)

I am trying to build a subsample test dataset and would like to run without the microscopy image to win some space. Do you think it is possible to read without it?

Thanks!

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 in src/spatialdata_io/readers/visium_hd.py at _get_transform_matrices and _get_affine, using the reported metadata_json case where microscope_colrow_to_spot_colrow is null. Reproduce the reshape failure with a Visium HD dataset containing only the CytAssist image; done means spatialdata_io.visium_hd can read that dataset without a full-resolution microscopy image.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.