Seurat: Visualizing gene expression in 3D plots

Created on 14 May 2019  路  5Comments  路  Source: satijalab/seurat

Hello Devs!

So I have worked on a small chunk of code for making nice 3D tSNE plots of Seurat v3.0.0/3.0.0.9000/3.0.0.9150 take a look. Now, my question is, if I want to look at gene expression on this 3D plot what should one do?

Any tips would be helpful!!

Thank you for all the wonderful support!!!

All 5 comments

Hi,

I would recommend using plotly for this. Here's a quick example using PCA but you could substitute any other coordinates:

library(plotly)
plotting.data <- FetchData(object = pbmc_small, vars = c("PC_1", "PC_2", "PC_3", "LYZ"))
plot_ly(data = plotting.data, x = ~PC_1, y = ~PC_2, z = ~PC_3, color = ~LYZ,
 type = "scatter3d", mode = "markers")

Cheers mate!

@andrewwbutler I have one question, how can I adjust the scale-key? Say I want the values to range from 0-5, not 0-8, how can I change that in the code you have suggested?

This is what I am doing:
plotting.data <- FetchData(object = yourseuratobject, vars = c("tSNE_1", "tSNE_2", "tSNE_3", "KRT19")) plot_ly(data = plotting.data, x = ~tSNE_1, y = ~tSNE_2, z = ~tSNE_3, size = 1, color = ~KRT19, opacity = 1, colors = c("yellow", "red"), hoverinfo = "KRT19", type = "scatter3d", mode = "markers")

Thanks!!

If you want similar behavior to the min.cutoff or max.cutoff parameters in FeaturePlot, you can use the MinMax function from Seurat to adjust the plotting.data matrix accordingly.

plotting.data <- MinMax(data = plotting.data, min = 0, max = 5)

Added you as a contrib. Here is the code with the solution. Cheers.

Was this page helpful?
0 / 5 - 0 ratings