dviraran / SingleR

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

Error in FUN(X[[i]], ...) : object 'x' not found #52

Closed NTNguyen13 closed 5 years ago

NTNguyen13 commented 5 years ago

Hi, I have 2 data, I have merged them into 1 seurat object for integrated analysis using this pipeline: https://satijalab.org/seurat/immune_alignment.html

Then I tried to use singleR for analysis:


immune.combined = AlignSubspace(pbmc.combined, reduction.type = "cca", grouping.var = "stim",  dims.align = 1:20)

singler = CreateSinglerObject(immune.combined@raw.data, annot = NULL, project.name = "PBMC", min.genes = 0,
                              technology = "10X", species = "Human", citation = "",
                              ref.list = list(), normalize.gene.length = F, variable.genes = "de",
                              fine.tune = T, do.signatures = T, clusters = NULL, do.main.types = T, 
                              reduce.file.size = T, numCores = 3)

out = SingleR.PlotTsne(singler$singler[[1]]$SingleR.single,
                       singler$meta.data$xy,do.label = F,
                       do.letters = T,labels = singler$meta.data$orig.ident, 
                       dot.size = 1.3,alpha=0.5,label.size = 6)
out$p

But it resulted in this error: Error in FUN(X[[i]], ...) : object 'x' not found I also tried to draw TSNE plot using seurat identity


out = SingleR.PlotTsne(singler$singler[[1]]$SingleR.single,
                       singler$meta.data$xy,do.label = T,
                       do.letters = F,labels=singler$seurat@ident, 
                       dot.size = 1.3,label.size = 5,alpha=0.5)
out$p

but it has error:

Error in SingleR.PlotTsne(singler$singler[[1]]$SingleR.single, singler$meta.data$xy,  : 
  trying to get slot "ident" from an object of a basic class ("NULL") with no slots

Can you please point out what's wrong with my analysis? Thank you very much

dviraran commented 5 years ago

Hi,

Please follow case 2 in this tutorial. You are only running CreateSinglerObject, but not copying the Seurat object and the other elements required.

Best, Dvir

NTNguyen13 commented 5 years ago

Hi, thank you very much, I have fixed this!