-
Notifications
You must be signed in to change notification settings - Fork 23
Description
I am trying to accomplish two visualization objectives that have "sub-objectives". I think if I can learn how to do the 1st objective correctly, I think will be able to figure out how to do the 2nd objective using the tutorial from napari-spatialdata - Analyse Nanostring data in Napari-SpatialData.
-
visualize specific gene transcripts with either:
a. all transcripts for 1 gene with 1 color
b. all transcripts for a few genes with a unique color assignment for each gene -
visualize transcripts for two specific genes (1 color assignment for each gene) that are present in 2 cell-types
My current use-case for all of this is to interactively visualize the results from a ligand-receptor analysis (cells sending ligands and receptor cells receiving ligands). The ligand-receptor analysis was performed using liana-py/MISTy - Steady-state Ligand-Receptor inference and liana-py/MISTy - Learning Spatial Relationships with MISTy.
I have been using spatialdata within a jupyter notebook to visualize the results by rendering hi-res .pngs, which, to be frank, is excellent, but a slow process.
I am hoping to now visualize and explore these same results at hi-res using the versatile rendering of napari-spatialdata via a headless HPC setup I just got working.
Reproducible example:
1st (download data):
wget https://s3.embl.de/spatialdata/spatialdata-sandbox/xenium_rep1_io.zip
2nd (python clustering)
from spatialdata_io import xenium
import spatialdata as sd
sdata=sd.SpatialData.read("./data.zarr/")
sdata
import scanpy as sc
sc._settings.ScanpyConfig.n_jobs=-1
sc.pp.filter_cells(sdata.tables["table"], min_counts=10)
sc.pp.filter_genes(sdata.tables["table"], min_cells=5)
sc.pp.normalize_total(sdata.tables["table"], inplace=True)
sc.pp.log1p(sdata.tables["table"])
sc.pp.pca(sdata.tables["table"])
sc.pp.neighbors(sdata.tables["table"])
sc.tl.leiden(sdata.tables["table"], flavor="igraph", n_iterations=2)
sdata.write("./processed_sdata.zarr")
screenshots of napari-spatialdata and issue:
The first 3 images are how I opened the processed_sdata.zarr
after double-clicking global then morphology_focus and cell_boundaries:
after also double-clicking transcripts:
This is from the scverse/spatialdata Xenium tutorial, so something like this would be good:

My current objective is mainly the bullet-point (2.) above, which is to see 2-cell-types of interest, so I guess in the reproducible example this would mean 2 leiden clusters, and 2 genes of interest all in different colors.
I think the solution has to do with table assignment to the correct element, possibly?