Skip to content

How to visualize specific gene transcripts and specific cell-type cell_boundaries within napari-spatialdata?Β #369

@Pancreas-Pratik

Description

@Pancreas-Pratik

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.

  1. 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

  2. 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
Image

Image Image

opened processed_sdata.zarr:
Image

after double-clicking global then morphology_focus and cell_boundaries:
Image

after also double-clicking transcripts:
Image

This is from the scverse/spatialdata Xenium tutorial, so something like this would be good:
Image

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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions