drieslab / Giotto

Spatial omics analysis toolbox
https://drieslab.github.io/Giotto_website/
Other
258 stars 98 forks source link

Does dimFeatPlot2D() have an option like "order = T" as in FeaturePlot() of Seurat? #477

Open yous0614 opened 1 year ago

yous0614 commented 1 year ago

Hi Giotto-ers,

I am using GiottoSuite and trying to cluster and identify cell types. Does someone know how to sort the expression level fur dimFeatPlot2D() when showing genes?

image

Thanks, ShihFeng

RubD commented 1 year ago

Hi @yous0614

Can you give us a bit more context or background on what you would like to see? How would this sorting work exactly?

Thanks

yous0614 commented 1 year ago

Thanks for speedy reply,

For example, when in Seurat, I run FeaturePlot(object, "MS4A4A")

image

and if I run FeaturePlot(object, "MS4A4A", order = T), it would be like:

image

I guess when showing dot plots, the dots would be pre-arranged by their level, so the low-expression dots won't opaque the high-expression dots. This function is useful and much needed when identify the high expression clusters in graphic presentation. I also hope this function can be also implemented in plotting spatial presentation like spatFeatPlot2D() too.

On the side note, other functions I often used is raster = T, which it can randomize the order, and blend = T, which it can showing two genes on the same graph. The blend function helps identify two genes expression are overlapped or mutually exclusive. For example,

image

Thank you, ShihFeng

RubD commented 1 year ago

Hi @yous0614 These should both be relatively easy to add, but I'd need to find some time to implement and test. I could probably add a testversion in the suite_dev branch that you could try out soon. The blending of two or more colors is something we have thought about, but not sure what the best implementation would be. The one you suggested seems like a good way forward. Thanks

RubD commented 1 year ago

I've added the order parameter to dimFeatPlot2D and spatDimFeatPlot2D. I've set the default to TRUE. The 2-color thing will take a bit longer.

yous0614 commented 1 year ago

That is super helpful! Thanks for all the effort!

RubD commented 1 year ago

I realize now that you also suggested to implement this for the spatial plotting functions. I have not done that yet, but it shouldn't be that hard. Although you could argue that for spatial plotting it makes more sense to change the point size, because overlapping points is probably not a good idea.

yous0614 commented 1 year ago

Hi @RubD,

Thanks for the adding the function, I have a great experience with new dimFeatPlot2D().

Absolutely, you are probably right about this, and it is more accurate to not overlapping cells when showing spatial data. However, when I trying to visualize multiple samples at a time (for example, comparing the gene expression pattern between WT or diseased samples), making the point size smaller is really hard to see. At the same time, I also have to make the plot super big, like save_param = list(base_width = 50, base_height = 50) big. Especially when trying to plot human brain samples (bigger than most tumor or mice brain, and also it's vizgen, it is single cell), when I just trying to roughly show my PI how are the genes expression near or distant relative to tau/Amyloid beta etc.

image

Something like this. This is I plotted with spatFeatPlot2D() which haven't had the order = T function. You can tell that now with point_size = 0.5, the dots are already start to become invisible and blocking each other. I agree with you that spatial data might not be the best idea to set order = T as default, but it will come in handy when showing gigantic data or for diagrammatic purpose, so maybe we can set it as optional in spatFeatPlot2D()?

Bedankt, ShihFeng

RubD commented 1 year ago

Got it! I also added the order param and functionality to the spatFeatPlots. You could also try using the point_shape = no_border param setting. If you plot many cells with a border, then the border is sometimes the only thing you see.

RubD commented 1 year ago

Reopen to remind & keep track of the color blending option.