dviraran / SingleR

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

CreateSinglerObject with custom ref.list #60

Closed GHAStVHenry closed 5 years ago

GHAStVHenry commented 5 years ago

It works with blueprint_encode and hpca as well as a different custom ref.list. The one below which causes the error was made at the same time as the one which works, I also think it has worked in the past on a different dataset.

> singler = CreateSinglerObject(GetAssayData(object = sc10x), annot = NULL, "PdPbPc_deep", min.genes = 0,
+                               technology = "10X", species = "Human", citation = "",
+                               ref.list = list(cibersort), 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)
[1] "Dimensions of counts data: 2000x10365"
[1] "Annotating data with cibersort..."
[1] "Variable genes method: de"
[1] "Number of DE genes:186"
[1] "Number of cells: 10365"
Error in if (xor(((x[n] - mean(x)) < (mean(x) - x[1])), opposite)) { : 
  argument is of length zero
In addition: Warning message:
In cor(sc_data[, 1:step], ref_data, method = "spearman") :
  the standard deviation is zero
dviraran commented 5 years ago

Hi,

I think that this error comes when there aren't enough genes in common between the single-cell data and the reference data. It seems that there are only 186 genes in common.

Can you try running it without fine-tuning?

Best, Dvir

GHAStVHenry commented 5 years ago

Still didn't work, but I figured it out, i didn't specify the RNA assay, the integrated assay was set as default which only contains the 2000 highly variable genes which were used for integration...

dviraran commented 5 years ago

makes sense.

faezehmahdavi commented 5 years ago

Hi, I have a same problem. I used "cell ranger 3 filtered data" and I did downstream analysis with Seurat v3. When I use CreateSinglerObject() function I get this error. For the other raw data, when I use another filtering methods and then apply singleR it works but just from cell ranger 3 filtered data it doesn't work!

[1] "Dimensions of counts data: 18391x1222" [1] "Annotating data with HPCA..." [1] "Variable genes method: de" [1] "Number of DE genes:3366" [1] "Number of cells: 1222" Error in if (xor(((x[n] - mean(x)) < (mean(x) - x[1])), opposite)) { : argument is of length zero In addition: Warning message: In cor(sc_data, ref_data, method = "spearman") : the standard deviation is zero