scverse / scverse/spatialdata-io

Add `dataset_id` prefix to tables in Visium HD

Open
#273 0 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

Thanks for the clarification. That makes sense.

One small detail. Should not the elements in Tables be renamed as well? Right now they are not (see above). If I try to concatenate two visium_hd SpatialData objects I get a warning about identical names and they are given unique names which are not ideal because do not follow the original patterns, making it harder to know which ones came from where.

>> sdata1
SpatialData object
├── Images
│     ├── 'HM_hires_image': DataArray[cyx] (3, 5057, 6000)
│     └── 'HM_lowres_image': DataArray[cyx] (3, 506, 600)
├── Shapes
│     ├── 'HM_square_002um': GeoDataFrame shape: (2942291, 1) (2D shapes)
│     ├── 'HM_square_008um': GeoDataFrame shape: (187571, 1) (2D shapes)
│     └── 'HM_square_016um': GeoDataFrame shape: (48206, 1) (2D shapes)
└── Tables
      ├── 'square_002um': AnnData (2942291, 18085)
      ├── 'square_008um': AnnData (187571, 18085)
      └── 'square_016um': AnnData (48206, 18085)
with coordinate systems:
    ▸ 'downscaled_hires', with elements:
        HM_hires_image (Images), HM_square_002um (Shapes), HM_square_008um (Shapes), HM_square_016um (Shapes)
    ▸ 'downscaled_lowres', with elements:
        HM_lowres_image (Images), HM_square_002um (Shapes), HM_square_008um (Shapes), HM_square_016um (Shapes)
    ▸ 'global', with elements:
        HM_hires_image (Images), HM_lowres_image (Images), HM_square_002um (Shapes), HM_square_008um (Shapes), HM_square_016um (Shapes)
>> sdata2
SpatialData object
├── Images
│     ├── 'RS_hires_image': DataArray[cyx] (3, 6000, 5163)
│     └── 'RS_lowres_image': DataArray[cyx] (3, 600, 517)
├── Shapes
│     ├── 'RS_square_002um': GeoDataFrame shape: (2493008, 1) (2D shapes)
│     ├── 'RS_square_008um': GeoDataFrame shape: (160049, 1) (2D shapes)
│     └── 'RS_square_016um': GeoDataFrame shape: (41439, 1) (2D shapes)
└── Tables
      ├── 'square_002um': AnnData (2493008, 18085)
      ├── 'square_008um': AnnData (160049, 18085)
      └── 'square_016um': AnnData (41439, 18085)
with coordinate systems:
    ▸ 'downscaled_hires', with elements:
        RS_hires_image (Images), RS_square_002um (Shapes), RS_square_008um (Shapes), RS_square_016um (Shapes)
    ▸ 'downscaled_lowres', with elements:
        RS_lowres_image (Images), RS_square_002um (Shapes), RS_square_008um (Shapes), RS_square_016um (Shapes)
    ▸ 'global', with elements:
        RS_hires_image (Images), RS_lowres_image (Images), RS_square_002um (Shapes), RS_square_008um (Shapes), RS_square_016um (Shapes)
>> sd.concatenate([sdata1, sdata2])
<stdin>:1: UserWarning: Duplicate table names found. Tables will be added with integer suffix. Set `concatenate_tables` to `True` if concatenation is wished for instead.
SpatialData object
├── Images
│     ├── 'HM_hires_image': DataArray[cyx] (3, 5057, 6000)
│     ├── 'HM_lowres_image': DataArray[cyx] (3, 506, 600)
│     ├── 'RS_hires_image': DataArray[cyx] (3, 6000, 5163)
│     └── 'RS_lowres_image': DataArray[cyx] (3, 600, 517)
├── Shapes
│     ├── 'HM_square_002um': GeoDataFrame shape: (2942291, 1) (2D shapes)
│     ├── 'HM_square_008um': GeoDataFrame shape: (187571, 1) (2D shapes)
│     ├── 'HM_square_016um': GeoDataFrame shape: (48206, 1) (2D shapes)
│     ├── 'RS_square_002um': GeoDataFrame shape: (2493008, 1) (2D shapes)
│     ├── 'RS_square_008um': GeoDataFrame shape: (160049, 1) (2D shapes)
│     └── 'RS_square_016um': GeoDataFrame shape: (41439, 1) (2D shapes)
└── Tables
      ├── 'square_002um_0': AnnData (2942291, 18085)
      ├── 'square_002um_1': AnnData (2493008, 18085)
      ├── 'square_008um_0': AnnData (187571, 18085)
      ├── 'square_008um_1': AnnData (160049, 18085)
      ├── 'square_016um_0': AnnData (48206, 18085)
      └── 'square_016um_1': AnnData (41439, 18085)
with coordinate systems:
    ▸ 'downscaled_hires', with elements:
        HM_hires_image (Images), RS_hires_image (Images), HM_square_002um (Shapes), HM_square_008um (Shapes), HM_square_016um (Shapes), RS_square_002um (Shapes), RS_square_008um (Shapes), RS_square_016um (Shapes)
    ▸ 'downscaled_lowres', with elements:
        HM_lowres_image (Images), RS_lowres_image (Images), HM_square_002um (Shapes), HM_square_008um (Shapes), HM_square_016um (Shapes), RS_square_002um (Shapes), RS_square_008um (Shapes), RS_square_016um (Shapes)
    ▸ 'global', with elements:
        HM_hires_image (Images), HM_lowres_image (Images), RS_hires_image (Images), RS_lowres_image (Images), HM_square_002um (Shapes), HM_square_008um (Shapes), HM_square_016um (Shapes), RS_square_002um (Shapes), RS_square_008um (Shapes), RS_square_016um (Shapes)

Originally posted by @ddiez in #212

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 by locating the Visium HD reader code that creates the Tables entries and compare its naming with the Images and Shapes shown in the issue. Done means Visium HD table names include the dataset_id prefix, matching the other elements and avoiding duplicate table names when SpatialData objects are concatenated.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
data
Issue type
Feature
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.