scverse / scverse/napari-spatialdata
How to visualize specific gene `transcripts` and specific cell-type `cell_boundaries` within `napari-spatialdata`?
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 90
- Forks
- 25
- Avg merge
- 22m
- Merged PRs (30d)
- 1
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
opened 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?
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the reproducible Xenium example in the issue, the napari-spatialdata Nanostring analysis tutorial, and the linked spatialdata Xenium tutorial. Determine how to select specific genes and cell types, assign distinct colors, and display transcripts with cell boundaries in napari-spatialdata. Done means documenting a reproducible workflow for the two requested visualization objectives.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- jupyter-notebook, python
- Domain
- bioinformatics, data-visualization
- Issue type
- Documentation
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100