dviraran / SingleR

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

dimnames error in CreateSinglerSeuratObject #48

Open ysbioinfo opened 5 years ago

ysbioinfo commented 5 years ago

HI, I am using singler but when I run CreateSinglerSeuratObject():

singler <- CreateSinglerSeuratObject(counts = file_count,
                                     annot = NULL,
                                     project.name = 'HCC',
                                     min.genes = 0,
                                     min.cells = 0,
                                     technology = '10X',
                                     species = 'Human',
                                     regress.out = 'nUMI',
                                     variable.genes = 'de',
                                     normalize.gene.length = FALSE)

It successfully create the Seurat object (NormalizeData, Findvariablegenes, ScaleData), but throw an error when doing finetuning:

[1] "HCC"
[1] "Reading single-cell data..."
[1] "Create Seurat object..."

Time Elapsed:  41.8454532623291 secs[1] "Creat SingleR object..."
[1] "Dimensions of counts data: 15924x9927"
[1] "Annotating data with HPCA..."
[1] "Variable genes method: de"
[1] "Number of DE genes:3376"
[1] "Number of cells: 9927"
[1] "Fine-tuning round on top cell types (using 15 CPU cores):"
Error in dimnames(x) <- dn : 
  length of 'dimnames' [1] not equal to array extent
Calls: CreateSinglerSeuratObject ... SingleR.CreateObject -> SingleR -> SingleR.FineTune -> rownames<-

And this error doesn't occur in all samples. Sometimes if I run this command again on a failed sample, it works well and no error occurs. Could you figure out which cause this error? Could it be something related with parallel computing or memory?

Thanks!

dviraran commented 5 years ago

Very weird. You are saying that sometimes you run the same function again it doesn't fail?

I have seen that since an update a few weeks ago, using too many cores makes SingleR fail because of memory issues. I need to find time to fix it, but in the meantime, the best I can suggest is to limit the number of cores.

ysbioinfo commented 5 years ago

Yes it's so weird. I will limit the cores and apply more memory. Thanks for your suggestion!

ysbioinfo commented 5 years ago

There is no error if I set the numCores to 1. Should be some bugs related with parallel computing. Thanks!

fjrossello commented 5 years ago

Hi, Same error using CreateBigSingleRObject function. As @snoopy-448 mentioned there's no error when using numCores = 1.

Cheers

mnovalri commented 5 years ago

I'm jumping on this for a related question regarding the CreateSingleRSeurateObject. I'm new to single-cell RNA seq analysis and this is my first dataset to analyze. I know this is more a Seurat question but I noticed that when I do CreateSingleRSeurateObject, I can pick "uMI "or "^mt-" genes for regress.out . Do you have any advices/preferences on which one to pick? I'm working with a tissue where there is a lot of smooth muscle cells and I'm afraid the mt genes may introduce a bias. thanks,

dviraran commented 5 years ago

Yes, this is more of Seurat question. The wrapper function that creates a Seurat object regresses for nUMIs (in default). It also calculates the mitochondrial genes proportion, but not uses it. It is possible to regress it out as well, but you should probably first observe how it looks.