ncborcherding / escape

Easy single cell analysis platform for enrichment
https://www.borch.dev/uploads/screpertoire/articles/running_escape
MIT License
146 stars 20 forks source link

Error in using runEscape #93

Closed pushpinder-bu closed 7 months ago

pushpinder-bu commented 7 months ago

Hi,

Thank you for developing this tool. I have been trying to use runEscape on my Seurat object and I keep getting error.

ℹ Did you mean "CLINT1"?

Backtrace: ▆

  1. ├─escape::runEscape(...)
  2. │ └─escape::escape.matrix(...)
  3. │ └─escape:::.cntEval(input.data, assay = "RNA", type = "counts")
  4. │ ├─obj@assays[[assay]][type]
  5. │ └─SeuratObject:::[.Assay(obj@assays[[assay]], type)
  6. │ ├─SeuratObject::LayerData(...)
  7. │ └─SeuratObject:::LayerData.Assay(features = i)
  8. │ └─rlang::arg_match(...)
  9. │ └─rlang:::arg_match_multi(arg, values, error_arg, error_call)
    1. │ └─rlang:::map_chr(arg, ~arg_match0(.x, values, error_arg, error_call = error_call))
    2. │ └─rlang:::.rlang_purrr_map_mold(.x, .f, character(1), ...)
    3. │ └─base::vapply(.x, .f, .mold, ..., USE.NAMES = FALSE)
    4. │ └─rlang (local) FUN(X[[i]], ...)
    5. │ └─rlang::arg_match0(.x, values, error_arg, error_call = error_call)
    6. └─rlang:::stop_arg_match(w, values = x, error_arg = y, error_call = z)
    7. └─rlang::abort(msg, call = error_call, arg = error_arg)

I tried running it using the pbmc_small Seurat object and even then I got an error.

Error in LayerData(): ! features must be one of "MS4A1", "CD79B", "CD79A", "HLA-DRA", "TCL1A", "HLA-DQB1", "HVCN1", "HLA-DMB", "LTB", "LINC00926", "FCER2", "SP100", "NCF1", "PPP3CC", "EAF2", "PPAPDC1B", "CD19", "KIAA0125", "CYB561A3", "CD180", "RP11-693J15.5", "FAM96A", "CXCR4", "STX10", "SNHG7", "NT5C", "BANK1", "IGLL5", "CD200", "FCRLA", "CD3D", "NOSIP", "SAFB2", "CD2", "IL7R", "PIK3IP1", "MPHOSPH6", "KHDRBS1", "MAL", "CCR7", "THYN1", "TAF7", "LDHB", "TMEM123", "CCDC104", "EPC1", "EIF4A2", "CD3E", "TMUB1", "BLOC1S4", "ACSM3", "TMEM204", "SRSF7", "ACAP1", "TNFAIP8", "CD7", "TAGAP", "DNAJB1", "ASNSD1", "S1PR4", "CTSW", "GZMK", "NKG7", "IL32", "DNAJC2", "LYAR", "CST7", "LCK", "CCL5", "HNRNPH1", "SSR2", "DLGAP1-AS1", "GIMAP1", "MMADHC", "ZNF76", "CD8A", "PTPN22", "GYPC", "HNRNPF", "RPL7L1", "KLRG1", "CRBN", "SATB1", "SIT1", "PMPCB", "NRBP1", "TCF7", "HNRNPA3", "S100A8", "S100A9", "LYZ", "CD14", "FCN1", "TYROBP", "ASGR1", "NFKBIA", "TYMP", "CTSS", "TSPO", "RBP7", "CTSB", "LGALS1", "FPR1", "VSTM1", "BLVRA", "MPEG1", "BID", "SMCO4", "CFD", "LINC00936", "LGALS2", "MS4A6A", "FCGRT", "LGALS3", "NUP214", "SCO2", "IL17RA", "IFI6", "HLA-DPA1", "FCER1A", "CLEC10A", "HLA-DMA", "RGS1", "HLA-DPB1", "HLA-DQA1", "RNF130", "HLA-DRB5", "HLA-DRB1", "CST3", "IL1B", "POP7", "HLA-DQA2", "CD1C", "GSTP1", "EIF3G", "VPS28", "LY86", "ZFP36L1", "ZNF330", "ANXA2", "GRN", "CFP", "HSP90AA1", "FUOM", "LST1", "AIF1", "PSAP", "YWHAB", "MYO1G", "SAT1", "RGS2", "SERPINA1", "IFITM3", "FCGR3A", "LILRA3", "S100A11", "FCER1G", "TNFRSF1B", "IFITM2", "WARS", "IFI30", "MS4A7", "C5AR1", "HCK", "COTL1", "LGALS9", "CD68", "RP11-290F20.3", "RHOC", "CARD16", "LRRC25", "COPS6", "ADAR", "PPBP", "GPX1", "TPM4", "PF4", "SDPR", "NRGN", "SPARC", "GNG11", "CLU", "HIST1H2AC", "NCOA4", "GP9", "FERMT3", "ODC1", "CD9", "RUFY1", "TUBB1", "TALDO1", "TREML1", "NGFRAP1", "PGRMC1", "CA2", "ITGA2B", "MYL9", "TMEM40", "PARVB", "PTCRA", "ACRBP", "TSC22D1", "VDAC3", "GZMB", "GZMA", "GNLY", "FGFBP2", "AKR1C3", "CCL4", "PRF1", "GZMH", "XBP1", "GZMM", "PTGDR", "IGFBP7", "TTC38", "KLRD1", "ARHGDIA", "IL2RB", "CLIC3", "PPP1R18", "CD247", "ALOX5AP", "XCL2", "C12orf75", "RARRES3", "PCMT1", "LAMP1", "SPON2", or "S100B", not "counts". Run rlang::last_trace() to see where the error occurred.

Can you suggest what can be going wrong here?

When I use escape.matrix function and specific the RNA count table, then it works. enrichment.scores <- escape.matrix(sc@assays$RNA@counts, gene.sets = GS.hallmark, groups = 5000, min.size = 5)

ncborcherding commented 7 months ago

Hey @pushpinder-bu,

Thanks for reaching out and happy to help - can you give me a little more information?

The error suggests an issue with getting the count assay information from your Seurat object. Which is why escape.matrix() as you are feeding it the counts directly. The pbmc_small object issue is strange because the entire testthat framework is based on it that and is running smoothly.

Thanks, Nick

pushpinder-bu commented 7 months ago

Hi @ncborcherding ,

Yes I thought as well its due to the count assay information, but when I escape.matrix() and specify the count assay (sc@assays$RNA@counts) it works. So the count matrix is fine, its how it is calling it!!

Below is how I am calling the runEscape()

GS.hallmark <- getGeneSets(library = "H")

runEscape

sc <- runEscape(sc, method = "ssGSEA", gene.sets = GS.hallmark, groups = 1000, min.size = 5, new.assay.name = "escape.ssGSEA")

For PBMC example, I used below command. pbmc_small <- SeuratObject::pbmc_small pbmc_small <- runEscape(pbmc_small, gene.sets = GS.hallmark, min.size = NULL)

sessionInfo()

R version 4.2.3 (2023-03-15) Platform: x86_64-pc-linux-gnu (64-bit) Running under: AlmaLinux 8.9 (Midnight Oncilla)

Matrix products: default BLAS: /share/pkg.7/r/4.2.3/install/lib64/R/lib/libRblas.so LAPACK: /share/pkg.7/r/4.2.3/install/lib64/R/lib/libRlapack.so

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

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

other attached packages: [1] scRepertoire_2.0.0 escape_1.99.1 GSVA_1.51.9 ggmin_0.0.0.9000
[5] harmony_1.2.0 Rcpp_1.0.12 patchwork_1.2.0.9000 clustree_0.5.1
[9] ggraph_2.1.0 knitr_1.45 data.table_1.15.4 kableExtra_1.4.0
[13] RColorBrewer_1.1-3 magrittr_2.0.3 matrixStats_1.2.0 Matrix_1.6-5
[17] SeuratObject_5.0.1 Seurat_4.3.0 lubridate_1.9.2 forcats_1.0.0
[21] stringr_1.5.1 dplyr_1.1.4 purrr_1.0.2 readr_2.1.4
[25] tidyr_1.3.1 tibble_3.2.1 ggplot2_3.5.0 tidyverse_2.0.0
[29] future_1.33.2

loaded via a namespace (and not attached): [1] SparseM_1.81 scattermore_0.8 SpatialExperiment_1.8.1
[4] iNEXT_3.0.1 R.methodsS3_1.8.2 evmix_2.12
[7] bit64_4.0.5 irlba_2.3.5.1 DelayedArray_0.24.0
[10] R.utils_2.12.3 KEGGREST_1.38.0 RCurl_1.98-1.14
[13] generics_0.1.3 BiocGenerics_0.44.0 ScaledMatrix_1.6.0
[16] cowplot_1.1.1 RSQLite_2.3.6 VGAM_1.1-8
[19] RANN_2.6.1 ggpointdensity_0.1.0 bit_4.0.5
[22] tzdb_0.3.0 spatstat.data_3.0-1 xml2_1.3.3
[25] httpuv_1.6.15 SummarizedExperiment_1.28.0 viridis_0.6.2
[28] xfun_0.43 hms_1.1.2 ggdist_3.3.2
[31] babelgene_22.9 evaluate_0.23 promises_1.2.1
[34] fansi_1.0.6 readxl_1.4.2 igraph_1.4.1
[37] DBI_1.2.2 htmlwidgets_1.6.4 spatstat.geom_3.1-0
[40] stringdist_0.9.10 stats4_4.2.3 ellipsis_0.3.2
[43] annotate_1.76.0 deldir_1.0-6 sparseMatrixStats_1.10.0
[46] MatrixGenerics_1.10.0 ggalluvial_0.12.5 vctrs_0.6.5
[49] SingleCellExperiment_1.20.1 Biobase_2.58.0 quantreg_5.94
[52] ROCR_1.0-11 abind_1.4-7 cachem_1.0.8
[55] withr_3.0.0 ggforce_0.4.1 progressr_0.14.0
[58] sctransform_0.3.5 goftest_1.2-3 svglite_2.1.1
[61] cluster_2.1.4 gsl_2.1-8 dotCall64_1.1-1
[64] lazyeval_0.2.2 crayon_1.5.2 spatstat.explore_3.1-0
[67] edgeR_3.40.2 pkgconfig_2.0.3 tweenr_2.0.2
[70] GenomeInfoDb_1.34.9 nlme_3.1-162 rlang_1.1.3
[73] globals_0.16.3 lifecycle_1.0.4 miniUI_0.1.1.1
[76] MatrixModels_0.5-2 rsvd_1.0.5 cellranger_1.1.0
[79] distributional_0.4.0 polyclip_1.10-4 lmtest_0.9-40
[82] graph_1.76.0 Rhdf5lib_1.20.0 zoo_1.8-11
[85] ggridges_0.5.6 png_0.1-8 viridisLite_0.4.2
[88] rjson_0.2.21 bitops_1.0-7 R.oo_1.26.0
[91] KernSmooth_2.23-20 spam_2.10-0 rhdf5filters_1.10.1
[94] Biostrings_2.66.0 blob_1.2.4 DelayedMatrixStats_1.20.0
[97] parallelly_1.37.1 spatstat.random_3.1-4 S4Vectors_0.36.2
[100] beachmat_2.14.2 scales_1.3.0 memoise_2.0.1
[103] GSEABase_1.60.0 plyr_1.8.9 ica_1.0-3
[106] zlibbioc_1.44.0 compiler_4.2.3 dqrng_0.3.2
[109] fitdistrplus_1.1-8 cli_3.6.2 XVector_0.38.0
[112] listenv_0.9.1 pbapply_1.7-0 MASS_7.3-58.3
[115] tidyselect_1.2.1 stringi_1.8.3 yaml_2.3.8
[118] BiocSingular_1.14.0 locfit_1.5-9.9 ggrepel_0.9.3
[121] grid_4.2.3 tools_4.2.3 timechange_0.2.0
[124] future.apply_1.11.2 parallel_4.2.3 rstudioapi_0.14
[127] AUCell_1.20.2 cubature_2.0.4.6 gridExtra_2.3
[130] farver_2.1.1 Rtsne_0.16 DropletUtils_1.18.1
[133] digest_0.6.35 shiny_1.8.1.1 GenomicRanges_1.50.2
[136] scuttle_1.8.4 later_1.3.2 RcppAnnoy_0.0.20
[139] ggdendro_0.2.0 httr_1.4.7 AnnotationDbi_1.60.2
[142] colorspace_2.1-1 XML_3.99-0.16.1 tensor_1.5
[145] reticulate_1.28 IRanges_2.32.0 splines_4.2.3
[148] uwot_0.1.14 spatstat.utils_3.0-2 graphlayouts_0.8.4
[151] sp_2.1-3 plotly_4.10.4 systemfonts_1.0.4
[154] xtable_1.8-6 truncdist_1.0-2 jsonlite_1.8.8
[157] tidygraph_1.2.3 R6_2.5.1 pillar_1.9.0
[160] htmltools_0.5.8 mime_0.12 glue_1.7.0
[163] fastmap_1.1.1 BiocParallel_1.32.6 BiocNeighbors_1.16.0
[166] codetools_0.2-19 utf8_1.2.4 lattice_0.20-45
[169] spatstat.sparse_3.0-1 evd_2.3-6.1 leiden_0.4.3
[172] magick_2.8.3 survival_3.5-5 limma_3.54.2
[175] rmarkdown_2.26 munsell_0.5.1 rhdf5_2.42.1
[178] GenomeInfoDbData_1.2.9 UCell_2.6.2 HDF5Array_1.26.0
[181] msigdbr_7.5.1 reshape2_1.4.4 gtable_0.3.4

ncborcherding commented 7 months ago

@pushpinder-bu

Are you running SeuratObject v5 but Seurat v4? I think the mismatch might be the problem! I see if I can replicate the issue from my end - I check with v5 (for both packages) pbmc_small and things are smooth for me:

Screenshot 2024-04-04 at 11 45 13 AM
pushpinder-bu commented 7 months ago

I updated both to v5 and it works now.

ncborcherding commented 7 months ago

Great thanks for the follow up!