7  Skin: Assisting cell type annotation with enrichR

7.1 Set up Seurat workspace

# Load libraries
library(data.table)
library(devtools)
library(presto) 
library(glmGamPoi) 
library(sctransform) 
library(Seurat) 
library(tidyverse)
library(miQC) 
library(SeuratWrappers)
library(flexmix)
library(SingleCellExperiment)
library(SummarizedExperiment)
library(readxl)
library(fishpond)
library(Matrix)
library(speckle)
library(scater)
library(patchwork)
library(vctrs)
library(alevinQC)
library(harmony)
library(scDblFinder)
library(cellXY)
library(enrichR)

# Set global options for Seurat v5 objects
options(Seurat.object.assay.version = 'v5')

7.2 Load sub-cluster specific marker gene table

markers <- read_tsv("Skin_scRNA_prestoMarkers.tsv")
Rows: 100 Columns: 38
── Column specification ────────────────────────────────────────────────────────
Delimiter: "\t"
chr (37): 0, 1_0, 1_1, 10, 11_0, 11_1, 12, 13_0, 13_1, 14, 15, 16, 17, 18, 1...
dbl  (1): rank

ℹ Use `spec()` to retrieve the full column specification for this data.
ℹ Specify the column types or set `show_col_types = FALSE` to quiet this message.

7.3 Run enrichR to estimate cell type annotation

dbs <- c("Tabula_Sapiens","PanglaoDB_Augmented_2021","Azimuth_Cell_Types_2021","HuBMAP_ASCTplusB_augmented_2022","Azimuth_2023","CellMarker_2024")

predictions <- NULL

for(i in colnames(markers)[-1]) {
    m <- pull(markers[,i])
    res <- enrichr(m, dbs)
    
    pred <- res %>% 
        map_dfr(~ .x %>% as_tibble(), .id = "name") %>%
        group_by(name) %>%
        slice_min(Adjusted.P.value, n=1, with_ties = F) %>%
        dplyr::select(name,Term,Adjusted.P.value) %>%
        mutate(Term = str_replace_all(str_replace_all(Term,"[ -]","_"),"_+","_")) %>%
        add_column(sub.cluster = i, .before = 1)
        
    predictions <- bind_rows(predictions, pred)     
}
Uploading data to Enrichr... Done.
  Querying Tabula_Sapiens... Done.
  Querying PanglaoDB_Augmented_2021... Done.
  Querying Azimuth_Cell_Types_2021... Done.
  Querying HuBMAP_ASCTplusB_augmented_2022... Done.
  Querying Azimuth_2023... Done.
  Querying CellMarker_2024... Done.
Parsing results... Done.
Uploading data to Enrichr... Done.
  Querying Tabula_Sapiens... Done.
  Querying PanglaoDB_Augmented_2021... Done.
  Querying Azimuth_Cell_Types_2021... Done.
  Querying HuBMAP_ASCTplusB_augmented_2022... Done.
  Querying Azimuth_2023... Done.
  Querying CellMarker_2024... Done.
Parsing results... Done.
Uploading data to Enrichr... Done.
  Querying Tabula_Sapiens... Done.
  Querying PanglaoDB_Augmented_2021... Done.
  Querying Azimuth_Cell_Types_2021... Done.
  Querying HuBMAP_ASCTplusB_augmented_2022... Done.
  Querying Azimuth_2023... Done.
  Querying CellMarker_2024... Done.
Parsing results... Done.
Uploading data to Enrichr... Done.
  Querying Tabula_Sapiens... Done.
  Querying PanglaoDB_Augmented_2021... Done.
  Querying Azimuth_Cell_Types_2021... Done.
  Querying HuBMAP_ASCTplusB_augmented_2022... Done.
  Querying Azimuth_2023... Done.
  Querying CellMarker_2024... Done.
Parsing results... Done.
Uploading data to Enrichr... Done.
  Querying Tabula_Sapiens... Done.
  Querying PanglaoDB_Augmented_2021... Done.
  Querying Azimuth_Cell_Types_2021... Done.
  Querying HuBMAP_ASCTplusB_augmented_2022... Done.
  Querying Azimuth_2023... Done.
  Querying CellMarker_2024... Done.
Parsing results... Done.
Uploading data to Enrichr... Done.
  Querying Tabula_Sapiens... Done.
  Querying PanglaoDB_Augmented_2021... Done.
  Querying Azimuth_Cell_Types_2021... Done.
  Querying HuBMAP_ASCTplusB_augmented_2022... Done.
  Querying Azimuth_2023... Done.
  Querying CellMarker_2024... Done.
Parsing results... Done.
Uploading data to Enrichr... Done.
  Querying Tabula_Sapiens... Done.
  Querying PanglaoDB_Augmented_2021... Done.
  Querying Azimuth_Cell_Types_2021... Done.
  Querying HuBMAP_ASCTplusB_augmented_2022... Done.
  Querying Azimuth_2023... Done.
  Querying CellMarker_2024... Done.
Parsing results... Done.
Uploading data to Enrichr... Done.
  Querying Tabula_Sapiens... Done.
  Querying PanglaoDB_Augmented_2021... Done.
  Querying Azimuth_Cell_Types_2021... Done.
  Querying HuBMAP_ASCTplusB_augmented_2022... Done.
  Querying Azimuth_2023... Done.
  Querying CellMarker_2024... Done.
Parsing results... Done.
Uploading data to Enrichr... Done.
  Querying Tabula_Sapiens... Done.
  Querying PanglaoDB_Augmented_2021... Done.
  Querying Azimuth_Cell_Types_2021... Done.
  Querying HuBMAP_ASCTplusB_augmented_2022... Done.
  Querying Azimuth_2023... Done.
  Querying CellMarker_2024... Done.
Parsing results... Done.
Uploading data to Enrichr... Done.
  Querying Tabula_Sapiens... Done.
  Querying PanglaoDB_Augmented_2021... Done.
  Querying Azimuth_Cell_Types_2021... Done.
  Querying HuBMAP_ASCTplusB_augmented_2022... Done.
  Querying Azimuth_2023... Done.
  Querying CellMarker_2024... Done.
Parsing results... Done.
Uploading data to Enrichr... Done.
  Querying Tabula_Sapiens... Done.
  Querying PanglaoDB_Augmented_2021... Done.
  Querying Azimuth_Cell_Types_2021... Done.
  Querying HuBMAP_ASCTplusB_augmented_2022... Done.
  Querying Azimuth_2023... Done.
  Querying CellMarker_2024... Done.
Parsing results... Done.
Uploading data to Enrichr... Done.
  Querying Tabula_Sapiens... Done.
  Querying PanglaoDB_Augmented_2021... Done.
  Querying Azimuth_Cell_Types_2021... Done.
  Querying HuBMAP_ASCTplusB_augmented_2022... Done.
  Querying Azimuth_2023... Done.
  Querying CellMarker_2024... Done.
Parsing results... Done.
Uploading data to Enrichr... Done.
  Querying Tabula_Sapiens... Done.
  Querying PanglaoDB_Augmented_2021... Done.
  Querying Azimuth_Cell_Types_2021... Done.
  Querying HuBMAP_ASCTplusB_augmented_2022... Done.
  Querying Azimuth_2023... Done.
  Querying CellMarker_2024... Done.
Parsing results... Done.
Uploading data to Enrichr... Done.
  Querying Tabula_Sapiens... Done.
  Querying PanglaoDB_Augmented_2021... Done.
  Querying Azimuth_Cell_Types_2021... Done.
  Querying HuBMAP_ASCTplusB_augmented_2022... Done.
  Querying Azimuth_2023... Done.
  Querying CellMarker_2024... Done.
Parsing results... Done.
Uploading data to Enrichr... Done.
  Querying Tabula_Sapiens... Done.
  Querying PanglaoDB_Augmented_2021... Done.
  Querying Azimuth_Cell_Types_2021... Done.
  Querying HuBMAP_ASCTplusB_augmented_2022... Done.
  Querying Azimuth_2023... Done.
  Querying CellMarker_2024... Done.
Parsing results... Done.
Uploading data to Enrichr... Done.
  Querying Tabula_Sapiens... Done.
  Querying PanglaoDB_Augmented_2021... Done.
  Querying Azimuth_Cell_Types_2021... Done.
  Querying HuBMAP_ASCTplusB_augmented_2022... Done.
  Querying Azimuth_2023... Done.
  Querying CellMarker_2024... Done.
Parsing results... Done.
Uploading data to Enrichr... Done.
  Querying Tabula_Sapiens... Done.
  Querying PanglaoDB_Augmented_2021... Done.
  Querying Azimuth_Cell_Types_2021... Done.
  Querying HuBMAP_ASCTplusB_augmented_2022... Done.
  Querying Azimuth_2023... Done.
  Querying CellMarker_2024... Done.
Parsing results... Done.
Uploading data to Enrichr... Done.
  Querying Tabula_Sapiens... Done.
  Querying PanglaoDB_Augmented_2021... Done.
  Querying Azimuth_Cell_Types_2021... Done.
  Querying HuBMAP_ASCTplusB_augmented_2022... Done.
  Querying Azimuth_2023... Done.
  Querying CellMarker_2024... Done.
Parsing results... Done.
Uploading data to Enrichr... Done.
  Querying Tabula_Sapiens... Done.
  Querying PanglaoDB_Augmented_2021... Done.
  Querying Azimuth_Cell_Types_2021... Done.
  Querying HuBMAP_ASCTplusB_augmented_2022... Done.
  Querying Azimuth_2023... Done.
  Querying CellMarker_2024... Done.
Parsing results... Done.
Uploading data to Enrichr... Done.
  Querying Tabula_Sapiens... Done.
  Querying PanglaoDB_Augmented_2021... Done.
  Querying Azimuth_Cell_Types_2021... Done.
  Querying HuBMAP_ASCTplusB_augmented_2022... Done.
  Querying Azimuth_2023... Done.
  Querying CellMarker_2024... Done.
Parsing results... Done.
Uploading data to Enrichr... Done.
  Querying Tabula_Sapiens... Done.
  Querying PanglaoDB_Augmented_2021... Done.
  Querying Azimuth_Cell_Types_2021... Done.
  Querying HuBMAP_ASCTplusB_augmented_2022... Done.
  Querying Azimuth_2023... Done.
  Querying CellMarker_2024... Done.
Parsing results... Done.
Uploading data to Enrichr... Done.
  Querying Tabula_Sapiens... Done.
  Querying PanglaoDB_Augmented_2021... Done.
  Querying Azimuth_Cell_Types_2021... Done.
  Querying HuBMAP_ASCTplusB_augmented_2022... Done.
  Querying Azimuth_2023... Done.
  Querying CellMarker_2024... Done.
Parsing results... Done.
Uploading data to Enrichr... Done.
  Querying Tabula_Sapiens... Done.
  Querying PanglaoDB_Augmented_2021... Done.
  Querying Azimuth_Cell_Types_2021... Done.
  Querying HuBMAP_ASCTplusB_augmented_2022... Done.
  Querying Azimuth_2023... Done.
  Querying CellMarker_2024... Done.
Parsing results... Done.
Uploading data to Enrichr... Done.
  Querying Tabula_Sapiens... Done.
  Querying PanglaoDB_Augmented_2021... Done.
  Querying Azimuth_Cell_Types_2021... Done.
  Querying HuBMAP_ASCTplusB_augmented_2022... Done.
  Querying Azimuth_2023... Done.
  Querying CellMarker_2024... Done.
Parsing results... Done.
Uploading data to Enrichr... Done.
  Querying Tabula_Sapiens... Done.
  Querying PanglaoDB_Augmented_2021... Done.
  Querying Azimuth_Cell_Types_2021... Done.
  Querying HuBMAP_ASCTplusB_augmented_2022... Done.
  Querying Azimuth_2023... Done.
  Querying CellMarker_2024... Done.
Parsing results... Done.
Uploading data to Enrichr... Done.
  Querying Tabula_Sapiens... Done.
  Querying PanglaoDB_Augmented_2021... Done.
  Querying Azimuth_Cell_Types_2021... Done.
  Querying HuBMAP_ASCTplusB_augmented_2022... Done.
  Querying Azimuth_2023... Done.
  Querying CellMarker_2024... Done.
Parsing results... Done.
Uploading data to Enrichr... Done.
  Querying Tabula_Sapiens... Done.
  Querying PanglaoDB_Augmented_2021... Done.
  Querying Azimuth_Cell_Types_2021... Done.
  Querying HuBMAP_ASCTplusB_augmented_2022... Done.
  Querying Azimuth_2023... Done.
  Querying CellMarker_2024... Done.
Parsing results... Done.
Uploading data to Enrichr... Done.
  Querying Tabula_Sapiens... Done.
  Querying PanglaoDB_Augmented_2021... Done.
  Querying Azimuth_Cell_Types_2021... Done.
  Querying HuBMAP_ASCTplusB_augmented_2022... Done.
  Querying Azimuth_2023... Done.
  Querying CellMarker_2024... Done.
Parsing results... Done.
Uploading data to Enrichr... Done.
  Querying Tabula_Sapiens... Done.
  Querying PanglaoDB_Augmented_2021... Done.
  Querying Azimuth_Cell_Types_2021... Done.
  Querying HuBMAP_ASCTplusB_augmented_2022... Done.
  Querying Azimuth_2023... Done.
  Querying CellMarker_2024... Done.
Parsing results... Done.
Uploading data to Enrichr... Done.
  Querying Tabula_Sapiens... Done.
  Querying PanglaoDB_Augmented_2021... Done.
  Querying Azimuth_Cell_Types_2021... Done.
  Querying HuBMAP_ASCTplusB_augmented_2022... Done.
  Querying Azimuth_2023... Done.
  Querying CellMarker_2024... Done.
Parsing results... Done.
Uploading data to Enrichr... Done.
  Querying Tabula_Sapiens... Done.
  Querying PanglaoDB_Augmented_2021... Done.
  Querying Azimuth_Cell_Types_2021... Done.
  Querying HuBMAP_ASCTplusB_augmented_2022... Done.
  Querying Azimuth_2023... Done.
  Querying CellMarker_2024... Done.
Parsing results... Done.
Uploading data to Enrichr... Done.
  Querying Tabula_Sapiens... Done.
  Querying PanglaoDB_Augmented_2021... Done.
  Querying Azimuth_Cell_Types_2021... Done.
  Querying HuBMAP_ASCTplusB_augmented_2022... Done.
  Querying Azimuth_2023... Done.
  Querying CellMarker_2024... Done.
Parsing results... Done.
Uploading data to Enrichr... Done.
  Querying Tabula_Sapiens... Done.
  Querying PanglaoDB_Augmented_2021... Done.
  Querying Azimuth_Cell_Types_2021... Done.
  Querying HuBMAP_ASCTplusB_augmented_2022... Done.
  Querying Azimuth_2023... Done.
  Querying CellMarker_2024... Done.
Parsing results... Done.
Uploading data to Enrichr... Done.
  Querying Tabula_Sapiens... Done.
  Querying PanglaoDB_Augmented_2021... Done.
  Querying Azimuth_Cell_Types_2021... Done.
  Querying HuBMAP_ASCTplusB_augmented_2022... Done.
  Querying Azimuth_2023... Done.
  Querying CellMarker_2024... Done.
Parsing results... Done.
Uploading data to Enrichr... Done.
  Querying Tabula_Sapiens... Done.
  Querying PanglaoDB_Augmented_2021... Done.
  Querying Azimuth_Cell_Types_2021... Done.
  Querying HuBMAP_ASCTplusB_augmented_2022... Done.
  Querying Azimuth_2023... Done.
  Querying CellMarker_2024... Done.
Parsing results... Done.
Uploading data to Enrichr... Done.
  Querying Tabula_Sapiens... Done.
  Querying PanglaoDB_Augmented_2021... Done.
  Querying Azimuth_Cell_Types_2021... Done.
  Querying HuBMAP_ASCTplusB_augmented_2022... Done.
  Querying Azimuth_2023... Done.
  Querying CellMarker_2024... Done.
Parsing results... Done.
Uploading data to Enrichr... Done.
  Querying Tabula_Sapiens... Done.
  Querying PanglaoDB_Augmented_2021... Done.
  Querying Azimuth_Cell_Types_2021... Done.
  Querying HuBMAP_ASCTplusB_augmented_2022... Done.
  Querying Azimuth_2023... Done.
  Querying CellMarker_2024... Done.
Parsing results... Done.
write_tsv(predictions,"Skin_scRNA_CellID_enrichR.tsv")

7.4 Get session info

sessionInfo()
R version 4.3.1 (2023-06-16)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Rocky Linux 8.10 (Green Obsidian)

Matrix products: default
BLAS/LAPACK: /usr/lib64/libopenblasp-r0.3.15.so;  LAPACK version 3.9.0

locale:
 [1] LC_CTYPE=en_US.UTF-8       LC_NUMERIC=C              
 [3] 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   
 [7] LC_PAPER=en_US.UTF-8       LC_NAME=C                 
 [9] LC_ADDRESS=C               LC_TELEPHONE=C            
[11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C       

time zone: America/New_York
tzcode source: system (glibc)

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

other attached packages:
 [1] enrichR_3.2                 cellXY_0.99.0              
 [3] scDblFinder_1.14.0          harmony_1.2.0              
 [5] alevinQC_1.16.1             vctrs_0.6.5                
 [7] patchwork_1.3.0             scater_1.28.0              
 [9] scuttle_1.10.3              speckle_1.0.0              
[11] Matrix_1.6-4                fishpond_2.6.2             
[13] readxl_1.4.3                SingleCellExperiment_1.22.0
[15] SummarizedExperiment_1.30.2 Biobase_2.60.0             
[17] GenomicRanges_1.52.1        GenomeInfoDb_1.36.4        
[19] IRanges_2.34.1              S4Vectors_0.38.2           
[21] BiocGenerics_0.46.0         MatrixGenerics_1.12.3      
[23] matrixStats_1.2.0           flexmix_2.3-19             
[25] lattice_0.22-5              SeuratWrappers_0.3.19      
[27] miQC_1.8.0                  lubridate_1.9.3            
[29] forcats_1.0.0               stringr_1.5.1              
[31] dplyr_1.1.4                 purrr_1.0.2                
[33] readr_2.1.5                 tidyr_1.3.1                
[35] tibble_3.2.1                ggplot2_3.4.4              
[37] tidyverse_2.0.0             Seurat_5.1.0               
[39] SeuratObject_5.0.2          sp_2.1-3                   
[41] sctransform_0.4.1           glmGamPoi_1.12.2           
[43] presto_1.0.0                Rcpp_1.0.12                
[45] devtools_2.4.5              usethis_2.2.2              
[47] data.table_1.15.0          

loaded via a namespace (and not attached):
  [1] fs_1.6.3                  spatstat.sparse_3.0-3    
  [3] bitops_1.0-7              httr_1.4.7               
  [5] RColorBrewer_1.1-3        profvis_0.3.8            
  [7] tools_4.3.1               utf8_1.2.4               
  [9] R6_2.5.1                  DT_0.31                  
 [11] lazyeval_0.2.2            uwot_0.1.16              
 [13] urlchecker_1.0.1          withr_3.0.0              
 [15] GGally_2.2.1              gridExtra_2.3            
 [17] progressr_0.14.0          cli_3.6.2                
 [19] spatstat.explore_3.2-6    fastDummies_1.7.3        
 [21] spatstat.data_3.0-4       ggridges_0.5.6           
 [23] pbapply_1.7-2             Rsamtools_2.16.0         
 [25] R.utils_2.12.3            WriteXLS_6.5.0           
 [27] parallelly_1.37.0         sessioninfo_1.2.2        
 [29] limma_3.56.2              RSQLite_2.3.5            
 [31] BiocIO_1.10.0             generics_0.1.3           
 [33] vroom_1.6.5               gtools_3.9.5             
 [35] ica_1.0-3                 spatstat.random_3.2-2    
 [37] ggbeeswarm_0.7.2          fansi_1.0.6              
 [39] abind_1.4-5               R.methodsS3_1.8.2        
 [41] lifecycle_1.0.4           yaml_2.3.8               
 [43] edgeR_3.42.4              Rtsne_0.17               
 [45] blob_1.2.4                grid_4.3.1               
 [47] dqrng_0.3.2               promises_1.2.1           
 [49] crayon_1.5.2              shinydashboard_0.7.2     
 [51] miniUI_0.1.1.1            beachmat_2.16.0          
 [53] cowplot_1.1.3             KEGGREST_1.40.1          
 [55] metapod_1.8.0             pillar_1.9.0             
 [57] knitr_1.45                rjson_0.2.21             
 [59] xgboost_1.7.7.1           future.apply_1.11.1      
 [61] codetools_0.2-19          leiden_0.4.3.1           
 [63] glue_1.7.0                remotes_2.4.2.1          
 [65] png_0.1-8                 spam_2.10-0              
 [67] org.Mm.eg.db_3.18.0       cellranger_1.1.0         
 [69] gtable_0.3.4              cachem_1.0.8             
 [71] xfun_0.42                 S4Arrays_1.2.0           
 [73] mime_0.12                 survival_3.5-8           
 [75] statmod_1.5.0             bluster_1.10.0           
 [77] ellipsis_0.3.2            fitdistrplus_1.1-11      
 [79] ROCR_1.0-11               nlme_3.1-164             
 [81] bit64_4.0.5               RcppAnnoy_0.0.22         
 [83] irlba_2.3.5.1             vipor_0.4.7              
 [85] KernSmooth_2.23-22        DBI_1.2.2                
 [87] colorspace_2.1-0          nnet_7.3-19              
 [89] tidyselect_1.2.0          curl_5.2.0               
 [91] bit_4.0.5                 compiler_4.3.1           
 [93] BiocNeighbors_1.18.0      DelayedArray_0.26.7      
 [95] plotly_4.10.4             rtracklayer_1.60.1       
 [97] scales_1.3.0              lmtest_0.9-40            
 [99] digest_0.6.34             goftest_1.2-3            
[101] spatstat.utils_3.0-4      rmarkdown_2.25           
[103] XVector_0.40.0            htmltools_0.5.7          
[105] pkgconfig_2.0.3           sparseMatrixStats_1.12.2 
[107] fastmap_1.1.1             rlang_1.1.3              
[109] htmlwidgets_1.6.4         shiny_1.8.0              
[111] DelayedMatrixStats_1.22.6 farver_2.1.1             
[113] zoo_1.8-12                jsonlite_1.8.8           
[115] BiocParallel_1.34.2       R.oo_1.26.0              
[117] BiocSingular_1.16.0       RCurl_1.98-1.14          
[119] magrittr_2.0.3            modeltools_0.2-23        
[121] GenomeInfoDbData_1.2.10   dotCall64_1.1-1          
[123] munsell_0.5.0             viridis_0.6.5            
[125] reticulate_1.35.0         stringi_1.8.3            
[127] zlibbioc_1.46.0           MASS_7.3-60.0.1          
[129] org.Hs.eg.db_3.18.0       plyr_1.8.9               
[131] pkgbuild_1.4.3            ggstats_0.5.1            
[133] parallel_4.3.1            listenv_0.9.1            
[135] ggrepel_0.9.5             deldir_2.0-2             
[137] Biostrings_2.68.1         splines_4.3.1            
[139] tensor_1.5                hms_1.1.3                
[141] locfit_1.5-9.8            igraph_2.0.2             
[143] spatstat.geom_3.2-8       RcppHNSW_0.6.0           
[145] reshape2_1.4.4            ScaledMatrix_1.8.1       
[147] pkgload_1.3.4             XML_3.99-0.16.1          
[149] evaluate_0.23             scran_1.28.2             
[151] BiocManager_1.30.22       tzdb_0.4.0               
[153] httpuv_1.6.14             RANN_2.6.1               
[155] polyclip_1.10-6           future_1.33.1            
[157] scattermore_1.2           rsvd_1.0.5               
[159] xtable_1.8-4              restfulr_0.0.15          
[161] svMisc_1.2.3              RSpectra_0.16-1          
[163] later_1.3.2               viridisLite_0.4.2        
[165] AnnotationDbi_1.64.1      GenomicAlignments_1.36.0 
[167] memoise_2.0.1             beeswarm_0.4.0           
[169] tximport_1.28.0           cluster_2.1.6            
[171] timechange_0.3.0          globals_0.16.2