SingleR annotation of seurat clusters
0
0
Entering edit mode
3.4 years ago
chi.delta ▴ 40

Hello!

I am running the following code in order to annotate my seurat clusters

SingleR(GetAssayData(seu_fin, assay = "RNA", slot = "data"), clusters = Idents(seu_fin),ref = immgen, labels = immgen$label.fine)

or

SingleR(as.SingleCellExperiment(seu_fin), ref=immgen, labels=immgen$label.main, clusters=Idents(seu_fin))

but I am getting in both cases i get the following error:

Error in `rownames<-`(`*tmp*`, value = tolower(rownames(ref_data))) : 
  attempt to set 'rownames' on an object with no dimensions

Is any way to deal wit this? Thanks :)

seurat singleR 10x • 5.1k views
ADD COMMENT
1
Entering edit mode

We need the full code used (to retrieve the reference data, etc), and your sessionInfo(). This is a crosspost of the github issue (which is fine, Aaron is just more likely to figure it out and respond there before I do here, so a trail is helpful).

ADD REPLY
0
Entering edit mode

Thanks a lot for your prompt response, here is the code to generate my seurat clusters:

my_counts<-Read10X(data.dir = "~/experiment/data")

#Creat seurat RNA object
seu_all = CreateSeuratObject(counts = my_counts$`Gene Expression`,min.cells = 3)

#Creat seurat cite seq assay
surface_assay<-CreateAssayObject(counts = my_counts$`Antibody Capture`)

# Split by hashtag/CITE-seq
cite_assay <- CreateAssayObject(counts=surface_assay[1:35,])
hashtag_assay <- CreateAssayObject(surface_assay[36:39,])


#Import Cite seq assay in RNA object
seu_all[["Protein"]]<-cite_assay
seu_all[["Hashtag"]]<-hashtag_assay

seu_all<-NormalizeData(seu_all,assay = "Protein",normalization.method = "CLR")
seu_all<-NormalizeData(seu_all,assay = "Hashtag",normalization.method = "CLR")

##Here I filtered out dead cells, empty droplets, doublets and outliers##

## Clustering

seu_all<-FindVariableFeatures(seu_all)
seu_all <- ScaleData(seu_all,  features = rownames(seu_all))
seu_all<-RunPCA(seu_all,npcs = 80)

ElbowPlot(seu_all,ndims =80)

seu_all<-FindNeighbors(seu_all,dims = 1:60)
seu_all<-FindClusters(seu_all ,resolution = 0.6)
seu_all<-RunUMAP(seu_all,dims = 1:60)

and my session info:

R version 3.6.0 (2019-04-26)
Platform: x86_64-redhat-linux-gnu (64-bit)
Running under: CentOS Linux 7 (Core)

Matrix products: default
BLAS/LAPACK: /usr/lib64/R/lib/libRblas.so

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

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

other attached packages:
 [1] SingleR_1.0.1               readxl_1.3.1                Matrix_1.3-2               
 [4] forcats_0.5.1               stringr_1.4.0               purrr_0.3.4                
 [7] readr_1.4.0                 tidyr_1.1.3                 tibble_3.1.2               
[10] tidyverse_1.3.0             dplyr_1.0.7                 RColorBrewer_1.1-2         
[13] viridis_0.5.1               viridisLite_0.4.0           scater_1.14.6              
[16] ggplot2_3.3.4               scran_1.14.6                SingleCellExperiment_1.8.0 
[19] SummarizedExperiment_1.16.1 DelayedArray_0.12.3         BiocParallel_1.20.1        
[22] matrixStats_0.58.0          Biobase_2.46.0              GenomicRanges_1.38.0       
[25] GenomeInfoDb_1.22.1         IRanges_2.20.2              S4Vectors_0.24.4           
[28] BiocGenerics_0.32.0         Seurat_3.1.3               

loaded via a namespace (and not attached):
  [1] utf8_1.2.1               reticulate_1.18          tidyselect_1.1.1         RSQLite_2.2.5           
  [5] AnnotationDbi_1.48.0     htmlwidgets_1.5.3        grid_3.6.0               Rtsne_0.15              
  [9] devtools_2.3.2           munsell_0.5.0            codetools_0.2-18         mutoss_0.1-12           
 [13] ica_1.0-2                statmod_1.4.35           future_1.21.0            withr_2.4.2             
 [17] colorspace_2.0-1         rstudioapi_0.13          ROCR_1.0-11              pbmcapply_1.5.0         
 [21] listenv_0.8.0            Rdpack_2.1.1             labeling_0.4.2           GenomeInfoDbData_1.2.2  
 [25] mnormt_2.0.2             bit64_4.0.5              pheatmap_1.0.12          farver_2.1.0            
 [29] rprojroot_2.0.2          parallelly_1.24.0        vctrs_0.3.8              generics_0.1.0          
 [33] TH.data_1.0-10           doParallel_1.0.16        R6_2.5.0                 ggbeeswarm_0.6.0        
 [37] rsvd_1.0.3               locfit_1.5-9.4           bitops_1.0-6             cachem_1.0.4            
 [41] assertthat_0.2.1         promises_1.2.0.1         scales_1.1.1             multcomp_1.4-16         
 [45] beeswarm_0.3.1           gtable_0.3.0             globals_0.14.0           processx_3.5.0          
 [49] sandwich_3.0-0           rlang_0.4.11             splines_3.6.0            lazyeval_0.2.2          
 [53] broom_0.7.5              BiocManager_1.30.12      reshape2_1.4.4           modelr_0.1.8            
 [57] backports_1.2.1          httpuv_1.5.5             tools_3.6.0              usethis_2.0.1           
 [61] ellipsis_0.3.2           sessioninfo_1.1.1        ggridges_0.5.3           TFisher_0.2.0           
 [65] Rcpp_1.0.6               plyr_1.8.6               zlibbioc_1.32.0          RCurl_1.98-1.3          
 [69] ps_1.6.0                 prettyunits_1.1.1        pbapply_1.4-3            cowplot_1.1.1           
 [73] zoo_1.8-9                haven_2.3.1              ggrepel_0.9.1            cluster_2.1.1           
 [77] fs_1.5.0                 magrittr_2.0.1.9000      data.table_1.14.0        lmtest_0.9-38           
 [81] reprex_1.0.0             RANN_2.6.1               tmvnsim_1.0-2            mvtnorm_1.1-1           
 [85] fitdistrplus_1.1-3       pkgload_1.2.0            mime_0.10                GSVA_1.34.0             
 [89] xtable_1.8-4             hms_1.0.0                XML_3.99-0.3             gridExtra_2.3           
 [93] testthat_3.0.2           compiler_3.6.0           KernSmooth_2.23-18       crayon_1.4.1            
 [97] htmltools_0.5.1.1        later_1.1.0.1            geneplotter_1.64.0       lubridate_1.7.10        
[101] DBI_1.1.1                dbplyr_2.1.0             MASS_7.3-53.1            cli_2.5.0               
[105] rbibutils_2.0            metap_1.4                igraph_1.2.6             pkgconfig_2.0.3         
[109] sn_2.0.0                 numDeriv_2016.8-1.1      plotly_4.9.3             foreach_1.5.1           
[113] xml2_1.3.2               annotate_1.64.0          vipor_0.4.5              dqrng_0.2.1             
[117] multtest_2.42.0          XVector_0.26.0           doFuture_0.12.0          rvest_1.0.0             
[121] callr_3.6.0              digest_0.6.27            sctransform_0.3.2        RcppAnnoy_0.0.18        
[125] tsne_0.1-3               graph_1.64.0             cellranger_1.1.0         leiden_0.3.7            
[129] uwot_0.1.10              edgeR_3.28.1             GSEABase_1.48.0          DelayedMatrixStats_1.8.0
[133] curl_4.3                 shiny_1.6.0              outliers_0.14            lifecycle_1.0.0         
[137] nlme_3.1-152             jsonlite_1.7.2           BiocNeighbors_1.4.2      desc_1.3.0              
[141] limma_3.42.2             fansi_0.5.0              pillar_1.6.1             lattice_0.20-41         
[145] fastmap_1.1.0            httr_1.4.2               plotrix_3.8-1            pkgbuild_1.2.0          
[149] survival_3.2-10          glue_1.4.2               remotes_2.3.0            iterators_1.0.13        
[153] shinythemes_1.2.0        png_0.1-7                bit_4.0.4                stringi_1.6.2           
[157] blob_1.2.1               singscore_1.6.0          BiocSingular_1.2.2       memoise_2.0.0           
[161] mathjaxr_1.4-0           irlba_2.3.3              future.apply_1.7.0       ape_5.5    
ADD REPLY
0
Entering edit mode

How are you getting the reference data (immgen)?

ADD REPLY
0
Entering edit mode

Oh yes sorry, I get an error there that I didnt notice..

library(celldex)
immgen<- ImmGenData()

Error: 'R_user_dir' is not an exported object from 'namespace:tools'
ADD REPLY
0
Entering edit mode

This is a problem with your R environment. Does BiocManager::valid() clear okay?

ADD REPLY

Login before adding your answer.

Traffic: 2119 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6