scverse / scverse/spatialdata-io

Confusion on constructing SpatialData object from the ground up

Open
#203 3 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, I am putting this in the -io package git page, but let me know if it's better to go in the general package page.

I'm dealing with a set of mIF data that have been previously processed (similar to mcmicro, but not exactly). The data set consists of:

  • Multiple samples
  • Each samples containing multiple ROI in "cyx" format
  • Segmentation and other masks (drawn by human input) for each ROI, in 2d format (binary masks, or labeled with integer for segmentation)
  • A table of meta data and extracted values.

I have previously been able to translate, with a lot of trial & error, this format of data set into Squidpy compatible AnnData, and do analysis and plotting, on individual ROIs, sample, etc.

With the new SpatialData object, it's not clear to me how I should best approach constructing it. Here are my questions:

  1. With squidpy, plotting of individual ROI from an AnnData containing multiple ROI can be controlled supplying the parameter library_id and library_key. Is there an equivalent concept in SpatialData? For example, if I'm rendering an Image (a ROI), a set of cell Shapes, and want to color it with a meta data from the table (AnnData), from a SpatialData object containing multiple ROIs, how would the function determine the correct/corresponding data to pull from each different modules? Is it primarily through unique coordinate systems?
  2. I know there's an "instance_id" parameter (that's inserted when I use the legacy conversion function): but does the instance_id have to be unique across the entire dataset? How about for cell segmentation mask, where the ID is necessarily integer only?
  3. How should we set coordinate system in a dataset like this? Should it be a coordinate for each sample? for each ROI? And is there a faster way to set it up instead of just looping through set_transformation multiple times?
  4. graphing connectivity maps: is there a built in function that would graph connectivity maps? or do we just have to layer it using the sq.pl package?

Hopefully this is clear. I'm looking through the different example datasets, but I haven't found one that seems to emulate this dataset format.

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 reviewing the example datasets, the legacy conversion function, set_transformation, and the referenced sq.pl package. Done would be documentation or an example that explains constructing a multi-sample, multi-ROI SpatialData object, including coordinate systems, instance_id scope, linked metadata, and connectivity plotting.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
documentation
Issue type
Documentation
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.