dviraran / SingleR

SingleR: Single-cell RNA-seq cell types Recognition (legacy version)
GNU General Public License v3.0
271 stars 98 forks source link

dimention reduction using other method such as UMAP #28

Closed danshu closed 5 years ago

danshu commented 5 years ago

Hi,

I prefer using UMAP for dimension reduction. Would you considering updating "SingleR.PlotTsne" to allow specifying other XY labels instead of tSNE_1 and tSNE_2?

Best, Danshu

dviraran commented 5 years ago

Hi,

Look at the documentation of this function.

SingleR.PlotTsne(SingleR, xy, labels = SingleR$labels, score.thres = 0,
  clusters = NULL, do.letters = TRUE, dot.size = 1,
  do.labels = FALSE, do.legend = TRUE, label.size = 3, title = "",
  colors = singler.colors, font.size = NULL, alpha = 0.5)SingleR.PlotTsne(SingleR, xy, labels = SingleR$labels, score.thres = 0,
  clusters = NULL, do.letters = TRUE, dot.size = 1,
  do.labels = FALSE, do.legend = TRUE, label.size = 3, title = "",
  colors = singler.colors, font.size = NULL, alpha = 0.5)

The second field is xy which is a matrix with two columns and rows as the number of cells. You can use whatever xy you wish. If you want to change the x and y axis labels just do something like:

p = SingleR.PlotTsne(...)
p$p + xlab('UMAP1') + ylab('UMAP2')

Also - the browser uses the field singler@xy - so you can put there whatever you want.

danshu commented 5 years ago

Thanks! This is exactly what I need!