scverse / scverse/spatialdata

AttributeError: type object 'MultiscaleSpatialImage' has no attribute 'from_dict'

Open
#380 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
394
Forks
95
Avg merge
4d 3h
Merged PRs (30d)
7

Description

When running the vignette Use landmark annotations to align multiple -omics layers, I run into an attribute error on cell #2

xenium_sdata = sd.read_zarr("xenium.zarr")
xenium_sdata

The error is

---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
Cell In[5], line 1
----> 1 xenium_sdata = sd.read_zarr("xenium.zarr")
      2 xenium_sdata

File ~/miniconda/envs/serial_integration/lib/python3.10/site-packages/spatialdata/_io/io_zarr.py:80, in read_zarr(store, selection)
     78 f_elem = group[subgroup_name]
     79 f_elem_store = os.path.join(f_store_path, f_elem.path)
---> 80 element = _read_multiscale(f_elem_store, raster_type="image")
     81 images[subgroup_name] = element
     82 count += 1

File ~/miniconda/envs/serial_integration/lib/python3.10/site-packages/spatialdata/_io/io_raster.py:86, in _read_multiscale(store, raster_type, fmt)
     79     data = node.load(Multiscales).array(resolution=d, version=fmt.version)
     80     multiscale_image[f"scale{i}"] = DataArray(
     81         data,
     82         name=name,
     83         dims=axes,
     84         coords={"c": channels} if channels is not None else {},
     85     )
---> 86 msi = MultiscaleSpatialImage.from_dict(multiscale_image)
     87 _set_transformations(msi, transformations)
     88 return compute_coordinates(msi)

AttributeError: type object 'MultiscaleSpatialImage' has no attribute 'from_dict'

Any help would be appreciated

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

Reproduce cell #2 of the “Use landmark annotations to align multiple -omics layers” vignette, starting with sd.read_zarr("xenium.zarr"). Inspect spatialdata/_io/io_raster.py around _read_multiscale and the MultiscaleSpatialImage API shown in the traceback. Done means the vignette can read the Zarr store without the reported AttributeError.

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
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.