SingleR-inc / SingleR

Clone of the Bioconductor repository for the SingleR package.
https://bioconductor.org/packages/devel/bioc/html/SingleR.html
GNU General Public License v3.0
173 stars 19 forks source link

Error in .identify_genes - number of labels must be equal to number of cells #184

Closed s2hui closed 3 years ago

s2hui commented 3 years ago

Hello,

I am running into the following error when running SingleR and I am not sure what problem is. Thanks for your help! shui

Rough code:

refobj <- readRDS(file = refobj_name)
so <- readRDS(rds_name)

print("Create single cell experiment...")
sce <- as.SingleCellExperiment(so)
print("Compute log norm counts...")
lncounts <- scater::logNormCounts(sce)

print("Running SingleR...")
pred.sce <- SingleR(test = lncounts, ref = refobj, labels = refobj$label.main)

Results in the following error:

Error in .identify_genes(ref, labels, genes = genes, sd.thresh = sd.thresh,  : 
  number of labels must be equal to number of cells
Calls: SingleR -> trainSingleR -> .identify_genes
Execution halted

Session Info:

> sessionInfo()
R version 4.0.0 (2020-04-24)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Ubuntu 20.04 LTS

Matrix products: default
BLAS:   /usr/lib/x86_64-linux-gnu/blas/libblas.so.3.9.0
LAPACK: /usr/lib/x86_64-linux-gnu/lapack/liblapack.so.3.9.0

locale:
 [1] LC_CTYPE=en_CA.UTF-8       LC_NUMERIC=C              
 [3] LC_TIME=en_CA.UTF-8        LC_COLLATE=en_CA.UTF-8    
 [5] LC_MONETARY=en_CA.UTF-8    LC_MESSAGES=en_CA.UTF-8   
 [7] LC_PAPER=en_CA.UTF-8       LC_NAME=C                 
 [9] LC_ADDRESS=C               LC_TELEPHONE=C            
[11] LC_MEASUREMENT=en_CA.UTF-8 LC_IDENTIFICATION=C       

attached base packages:
[1] parallel  stats4    stats     graphics  grDevices utils     datasets 
[8] methods   base     

other attached packages:
 [1] SingleR_1.2.4               SummarizedExperiment_1.20.0
 [3] Biobase_2.50.0              GenomicRanges_1.42.0       
 [5] GenomeInfoDb_1.26.6         IRanges_2.24.1             
 [7] S4Vectors_0.28.1            BiocGenerics_0.36.0        
 [9] MatrixGenerics_1.2.1        matrixStats_0.58.0         

loaded via a namespace (and not attached):
 [1] Rcpp_1.0.6                    rsvd_1.0.5                   
 [3] lattice_0.20-41               assertthat_0.2.1             
 [5] digest_0.6.27                 utf8_1.2.1                   
 [7] mime_0.10                     BiocFileCache_1.12.0         
 [9] R6_2.5.0                      RSQLite_2.2.0                
[11] httr_1.4.2                    pillar_1.6.0                 
[13] zlibbioc_1.36.0               rlang_0.4.10                 
[15] curl_4.3                      irlba_2.3.3                  
[17] blob_1.2.1                    Matrix_1.2-18                
[19] BiocNeighbors_1.6.0           BiocParallel_1.22.0          
[21] AnnotationHub_2.20.0          RCurl_1.98-1.3               
[23] bit_4.0.4                     shiny_1.6.0                  
[25] DelayedArray_0.16.3           compiler_4.0.0               
[27] httpuv_1.6.0                  BiocSingular_1.4.0           
[29] pkgconfig_2.0.3               htmltools_0.5.1.1            
[31] tidyselect_1.1.1              tibble_3.1.1                 
[33] GenomeInfoDbData_1.2.4        interactiveDisplayBase_1.26.3
[35] fansi_0.4.2                   crayon_1.4.1                 
[37] dplyr_1.0.5                   dbplyr_1.4.4                 
[39] later_1.2.0                   bitops_1.0-7                 
[41] rappdirs_0.3.3                grid_4.0.0                   
[43] xtable_1.8-4                  lifecycle_1.0.0              
[45] DBI_1.1.0                     magrittr_2.0.1               
[47] XVector_0.30.0                promises_1.2.0.1             
[49] DelayedMatrixStats_1.10.1     ellipsis_0.3.2               
[51] generics_0.1.0                vctrs_0.3.8                  
[53] tools_4.0.0                   bit64_4.0.5                  
[55] glue_1.4.2                    purrr_0.3.4                  
[57] BiocVersion_3.11.1            fastmap_1.1.0                
[59] yaml_2.2.1                    AnnotationDbi_1.50.1         
[61] BiocManager_1.30.12           ExperimentHub_1.14.0         
[63] memoise_1.1.0          
LTLA commented 3 years ago

What is refobj$label.main?

s2hui commented 3 years ago

Hello, I just double checked and label.main was empty. Thanks I will close the issue now.