aertslab / AUCell

AUCell: score single cells with gene regulatory networks
110 stars 26 forks source link

error while selecting cells by manual threshold #46

Open Sara-Tavallaei opened 3 weeks ago

Sara-Tavallaei commented 3 weeks ago

Hi,

I want to select cells from my AUCell analysis output by my own manual threshold. But as I run the following code, I get the error mentioned after the code:

SelectedCells <- names(which(cells_AUC["aging-geneSet",]> 0.10))

Error in h(simpleError(msg, call)) : error in evaluating the argument 'x' in selecting a method for function 'which': no method or default for coercing “numeric” to “aucellResults”

could you please help me fix this code?

In the following, I will attach whole codes of my analysis and the session info.

Thanks

script: library(Seurat) GBM <- readRDS(file = 'end-clustering.rds') counts <- GetAssayData(GBM, slot = "data", assay = "RNA") genes.percent.expression <- rowMeans(counts>0 )*100
genes.filter <- names(genes.percent.expression[genes.percent.expression >= 25])
counts <- counts[genes.filter,] exprMatrix <- as(counts, "dgCMatrix") genes <- read.delim(file = 'aging-genes.csv', header = FALSE) genes <- as.character(genes$V1) geneSets <- GeneSet(genes, setName="aging-geneSet") library(AUCell) cells_AUC <- AUCell_run(exprMatrix, geneSets) set.seed(333) par(mfrow=c(1,1)) cells_assignment <- AUCell_exploreThresholds(cells_AUC, plotHist=TRUE, assign=TRUE) warningMsg <- sapply(cells_assignment, function(x) x$aucThr$comment) warningMsg[which(warningMsg!="")] cells_assignment$aging-geneSet$aucThr$selected # L_k2 0.1535035 geneSetName <- rownames(cells_AUC)[grep("aging-geneSet", rownames(cells_AUC))] AUCell_plotHist(cells_AUC[geneSetName,], aucThr=0.10) abline(v=0.10) SelectedCells <- names(which(cells_AUC["aging-geneSet",]> 0.10))

sessionInfo()

R version 4.3.2 (2023-10-31) Platform: x86_64-pc-linux-gnu (64-bit) Running under: Ubuntu 22.04.4 LTS

Matrix products: default BLAS/LAPACK: /usr/lib/x86_64-linux-gnu/openblas-pthread/libopenblasp-r0.3.20.so; LAPACK version 3.10.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: Asia/Tehran tzcode source: system (glibc)

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

other attached packages: [1] HGNChelper_0.8.1 AUCell_1.26.0 GSEABase_1.62.0
[4] graph_1.78.0 annotate_1.78.0 XML_3.99-0.16.1
[7] AnnotationDbi_1.62.2 IRanges_2.34.1 S4Vectors_0.38.2
[10] Biobase_2.60.0 BiocGenerics_0.46.0 dplyr_1.1.4
[13] ggplot2_3.4.4 SeuratObject_4.1.4 Seurat_4.4.0

loaded via a namespace (and not attached): [1] RcppAnnoy_0.0.22 splines_4.3.2
[3] later_1.3.2 bitops_1.0-7
[5] tibble_3.2.1 R.oo_1.26.0
[7] polyclip_1.10-6 lifecycle_1.0.4
[9] globals_0.16.2 lattice_0.21-9
[11] MASS_7.3-60 magrittr_2.0.3
[13] openxlsx_4.2.5.2 plotly_4.10.4
[15] httpuv_1.6.14 sctransform_0.4.1
[17] zip_2.3.1 spam_2.10-0
[19] sp_2.1-3 spatstat.sparse_3.0-3
[21] reticulate_1.35.0 cowplot_1.1.3
[23] pbapply_1.7-2 DBI_1.2.2
[25] RColorBrewer_1.1-3 abind_1.4-7
[27] zlibbioc_1.46.0 Rtsne_0.17
[29] GenomicRanges_1.52.1 purrr_1.0.2
[31] mixtools_2.0.0 R.utils_2.12.3
[33] RCurl_1.98-1.14 GenomeInfoDbData_1.2.10
[35] ggrepel_0.9.5 irlba_2.3.5.1
[37] listenv_0.9.1 spatstat.utils_3.0-4
[39] goftest_1.2-3 spatstat.random_3.2-2
[41] fitdistrplus_1.1-11 parallelly_1.37.0
[43] DelayedMatrixStats_1.22.6 leiden_0.4.3.1
[45] codetools_0.2-19 DelayedArray_0.26.7
[47] tidyselect_1.2.0 farver_2.1.1
[49] matrixStats_1.2.0 spatstat.explore_3.2-6
[51] jsonlite_1.8.8 ellipsis_0.3.2
[53] progressr_0.14.0 ggridges_0.5.6
[55] survival_3.5-8 segmented_2.1-0
[57] tools_4.3.2 ica_1.0-3
[59] Rcpp_1.0.12 glue_1.7.0
[61] gridExtra_2.3 MatrixGenerics_1.12.3
[63] GenomeInfoDb_1.36.4 withr_3.0.0
[65] BiocManager_1.30.22 fastmap_1.1.1
[67] fansi_1.0.6 digest_0.6.34
[69] R6_2.5.1 mime_0.12
[71] colorspace_2.1-1 scattermore_1.2
[73] tensor_1.5 spatstat.data_3.0-4
[75] RSQLite_2.3.5 R.methodsS3_1.8.2
[77] utf8_1.2.4 tidyr_1.3.1
[79] generics_0.1.3 data.table_1.15.0
[81] httr_1.4.7 htmlwidgets_1.6.4
[83] S4Arrays_1.0.6 uwot_0.1.16
[85] pkgconfig_2.0.3 gtable_0.3.4
[87] blob_1.2.4 lmtest_0.9-40
[89] XVector_0.40.0 htmltools_0.5.7
[91] dotCall64_1.1-1 scales_1.3.0
[93] png_0.1-8 rstudioapi_0.15.0
[95] reshape2_1.4.4 nlme_3.1-164
[97] zoo_1.8-13 cachem_1.0.8
[99] stringr_1.5.1 KernSmooth_2.23-22
[101] parallel_4.3.2 miniUI_0.1.1.1
[103] pillar_1.9.0 grid_4.3.2
[105] vctrs_0.6.5 RANN_2.6.1
[107] promises_1.2.1 xtable_1.8-6
[109] cluster_2.1.4 cli_3.6.2
[111] compiler_4.3.2 rlang_1.1.3
[113] crayon_1.5.2 future.apply_1.11.1
[115] labeling_0.4.3 plyr_1.8.9
[117] stringi_1.8.3 viridisLite_0.4.2
[119] deldir_2.0-2 munsell_0.5.0
[121] Biostrings_2.68.1 lazyeval_0.2.2
[123] spatstat.geom_3.2-8 Matrix_1.6-5
[125] patchwork_1.2.0 sparseMatrixStats_1.12.2
[127] bit64_4.0.5 future_1.33.1
[129] KEGGREST_1.40.1 shiny_1.8.0
[131] SummarizedExperiment_1.30.2 kernlab_0.9-32
[133] ROCR_1.0-11 igraph_2.0.2
[135] memoise_2.0.1 bit_4.0.5