dviraran / SingleR

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

Error with SingleR.DrawHeatmap #50

Open mengchengyao opened 5 years ago

mengchengyao commented 5 years ago

Hi, Great tool! I have same problem with SingleR.DrawHeatmap. My code as follows.

First proble, singler = CreateSinglerObject(cell.meta.data, annot = NULL, "test", min.genes = 0,technology = "10X", species = "Mouse",citation = "",normalize.gene.length = F, variable.genes = "de",fine.tune = T, do.signatures = T, clusters = NULL, do.main.types = T,reduce.file.size = T, numCores = SingleR.numCores) immune.combined <- readRDS(rds_file) singler$seurat = immune.combined singler$meta.data$orig.ident = immune.combined@meta.data$orig.ident singler$meta.data$xy = immune.combined@dr$tsne@cell.embeddings singler$meta.data$clusters = immune.combined@ident

single cell type

SingleR.DrawHeatmap(singler$singler[[2]]$SingleR.single,top.n=37,clusters = singler$meta.data$orig.ident,fontsize_row=15) But i get error with Error ' in annotation_colors[[colnames(annotation)[i]]] : subscript out of bounds',

Second problem

cluster cell type

SingleR.DrawHeatmap(singler$singler[[2]]$SingleR.clusters,clusters = c(row.names(singler$singler[[2]]$SingleR.clusters$scores)),order.by.clusters=T,fontsize_row=15,cells_order=c(row.names(singler$singler[[2]]$SingleR.clusters$scores))) my seurat object have 12 clusters,but i get only 10 cluster with use cluster cell type,how could i get right cluster with seurat object。

Best, Dvir

dviraran commented 5 years ago

Thanks.

  1. I am not completely sure. I am having similar issues sometimes. Its because of the 'clusters' field (just to be sure - without it, it works, right?). Try adding names to that vector, something like: names(singler$meta.data$orig.ident) = rownames(singler$meta.data$xy) does this work? It might also need to be a factor, but not sure.

  2. This is because of a different reason. When using 'CreateSinglerObject' you need to input your clusters. The field 'clusters' should be immune.combined@ident in your case.

Best, Dvir

mengchengyao commented 5 years ago

Thanks.

  1. I am not completely sure. I am having similar issues sometimes. Its because of the 'clusters' field (just to be sure - without it, it works, right?). Try adding names to that vector, something like: names(singler$meta.data$orig.ident) = rownames(singler$meta.data$xy) does this work? It might also need to be a factor, but not sure.
  2. This is because of a different reason. When using 'CreateSinglerObject' you need to input your clusters. The field 'clusters' should be immune.combined@ident in your case.

Best, Dvir

Many thanks, The first dose not work,the second dose work,And I am interesting in cluster prediction, I am not focus on single cell prediction。

dviraran commented 5 years ago

Even if you are interested in cluster prediction, I strongly suggest looking at the single-cell level. It allows for much better accuracy in understanding what clusters are made of.

Best, Dvir