scverse / scanpy

Single-cell analysis in Python. Scales to >1M cells.
https://scanpy.readthedocs.io
BSD 3-Clause "New" or "Revised" License
1.81k stars 584 forks source link

Spatial embedding of gene expression: Delaunay triangulation #1287

Open AdemS80 opened 4 years ago

AdemS80 commented 4 years ago

I am using Delaunay triangulation to give a continuous and smooth aspect for plotting values at 2D discrete points. I think it would be useful to have it in scanpy/episcanpy for plotting spatial gene expressions, on top of the scatter plot that is currently used.

This can also be used for 3D plotting (3D transcriptomics, such as STARMAP, or even 3D epigenomics in the future). One can have the option of slicing the 3D volume image with a user defined plane position, etc...

I can provide my scripts and would be happy to contribute.

Thank you very much. Adem Saglam (DZNE-Bonn, AG Schultze)

giovp commented 4 years ago

HI @AdemS80 , thanks a lot for the suggestion! Would you mind sharing here an example of the plot you have in mind?

Thank you!

giovp commented 3 years ago

Hi @AdemS80 ,

I would be really curious to hear more about this but would need some examples. Also, if you are interested in contributing and need help with PR can definitely support you with that. I'll close this due to inactivity but feel free to reopen or continue discussion. I will get notification and reply straight away!

flying-sheep commented 3 years ago

Sounds like a good idea. Since we have a hexagonal grid, we can just connect the centers of the hexagons in a regular fashion instead of running delauney triangulation. But it’s fast enough to do that too if we want to have it easy and there’s a delauney implementation in something we already import (e.g. scipy maybe?)

@giovp the result would simply be a smoothly changing shading. Like this, but with a hex grid instead of a square grid:

AdemS80 commented 3 years ago

Hello,

Yes that is exactly what @flying-sheep mentioned. Instead of having a dot plot of gene expression, we would have the option of a surface plot with smoothed gene expression values. I will try to run this on a pubicly available Visium dataset (mentioned in one of the scanpy tutorials) to show the outcome.

On the other hand, it is not necessary to limit this option to regular grids (although in Visium datasets, it is regular). In this way, the function can be used in a more general case.