scverse / spatialdata

An open and interoperable data framework for spatial omics data
https://spatialdata.scverse.org/
BSD 3-Clause "New" or "Revised" License
237 stars 45 forks source link

New easier table notebook #749

Open LucaMarconato opened 3 weeks ago

LucaMarconato commented 3 weeks ago

Currently we explain how to work with tables with a notebook that has been reported being too technical.

We are considering moving the notebook to a technical section of the docs and instead make a new notebook showing a biological use case.

Here is a possible story from the notebook.

loading the data

resegmenting

comparing the segmentations by spatial overlap

say that we had 2 segmentation masks, and each masks had a gene expression table

lopollar commented 1 week ago

On my own dataset I would suggest following setup:

Reading in data and annotating shapes

Addition of table to sdata object

Multiple tables

Here I have two relevant options:

  1. I can create a 'bad' segmentation mask, import it, and create a second table based on the shapes layer of this (also then explain how to transfer a labels layer to a shapes layer with rasterize).
    • In this case, you could look at the cells that are similar in the two datasets, or you could (IMO more interesting) look at the cells that are only occurring in one of the two datasets.
    • We could compare the cells using the spatial join functions (based on spatialData I assume).
      1. I can create different expansions of the cells, and then create shapes layers and tables for all expansion ratio's.
        • In this case, the cell labels for all cells will be the same over the different tables, which of course is not standard, but it is an easy example on how you can use the multiple tables to perform comparisons.
        • I can show this on the labels layer and on the shapes layer (where shapes can overlap, and layers cannot).
        • You could also transfer the annotation layer from one table to another if you'd want to.
        • You can look how the gene expression of certain genes per celltype changes over the different tables.