theislab / destiny

R package for single cell and other data analysis using diffusion maps
https://theislab.github.io/destiny/
GNU General Public License v3.0
77 stars 11 forks source link

Some cluster labels are missing after plotting the diffusion map #37

Closed aditisk closed 4 years ago

aditisk commented 4 years ago

Hi,

I converted my Seurat Object to an SCE object and ran the DiffusionMap() function. When I plot the diffusion map, I'm missing the 1st and last cluster according to the Seurat cluster labels (UMAP and diffusion plots attached here). How can I fix this problem ?

Thank you. diffusion_plot UMAP

flying-sheep commented 4 years ago

There should be warnings in the console about the palette() not being big enough to show everything.

I have code to replace the default palette with a better one, which somehow doesn’t seem to run for you.

https://github.com/theislab/destiny/blob/28307e9d5dd755a79a84c2f9049cdd4a2112eacb/R/aaa.r#L17-L19

What R version do you have? Will it work if you manually do palette(destiny:::gud_default_palette)? Does .onLoad not trigger or is identical(palette(), destiny:::bad_default_palette) somehow FALSE for you?

aditisk commented 4 years ago

Hi @flying-sheep, I didn't get any warnings. I set the palette manually but now I seem to have another problem. I am unable to reproduce the 3D plot any more despite of using plot(dm,1:3). It gives me the same result as using plot(dm,1:2).

I'm using R version 3.6.3

DC1_DC2_plot

flying-sheep commented 4 years ago

Sorry, but that’s impossible, you must be doing something differently. What you see there is a ggplot, and plot.DiffusionMap only creates one if you specified two dimensions (length(dims) == 2L). The code for plot.DiffusionMap never reassigns its dims argument, and if there’s 3 dimensions:

https://github.com/theislab/destiny/blob/28307e9d5dd755a79a84c2f9049cdd4a2112eacb/R/diffusionmap-plotting.r#L165

it uses the scatterplot3d function:

https://github.com/theislab/destiny/blob/28307e9d5dd755a79a84c2f9049cdd4a2112eacb/R/diffusionmap-plotting.r#L191-L194

try using plot.Diffusionmap(dm, 1:3) manually, maybe you somehow managed to override how plot dispatches on DiffusionMaps:

https://github.com/theislab/destiny/blob/28307e9d5dd755a79a84c2f9049cdd4a2112eacb/R/diffusionmap-plotting.r#L263