plger / scDblFinder

Methods for detecting doublets in single-cell sequencing data
https://plger.github.io/scDblFinder/
GNU General Public License v3.0
162 stars 17 forks source link

non-interpretable error message when providing non-integer as nfeatures argument #88

Closed Fiona713 closed 1 year ago

Fiona713 commented 1 year ago

I noticed that I get an error if I want to run scDblFinder() without using cluster information, but a non-integer value for the nfeatures argument.It seems that the error occurs in the selFeatures function because ng == nfeatures will be false and cluster information is trying to be accessed. It would be great if there was a test whether nfeatures is an integer, so that a more informative error message is returned. Thanks!

mocksce <- mockDoubletSCE(ngenes = 234)
mocksce <- scDblFinder(mocksce, nfeatures = 0.1*nrow(mocksce), BPPARAM = BiocParallel::MulticoreParam(3))
16: stop("length of 'groups' does not equal 'ncol(x)'")
15: .setup_groups(groups, x, restrict = restrict, exclude = exclude)
14: .local(x, ...)
13: FUN(x, groups, ..., log.p = TRUE, BPPARAM = BPPARAM)
12: FUN(x, groups, ..., log.p = TRUE, BPPARAM = BPPARAM)
11: .findMarkers(assay(x, i = assay.type), ...)
10: .local(x, ...)
9: .nextMethod(x = x, groups = groups, ...)
8: eval(call, callEnv)
7: eval(call, callEnv)
6: callNextMethod(x = x, groups = groups, ...)
5: .local(x, ...)
4: scran::findMarkers(sce, groups = clusters, test.type = "binom", 
       assay.type = "counts")
3: scran::findMarkers(sce, groups = clusters, test.type = "binom", 
       assay.type = "counts")
2: selFeatures(sce[sel_features, ], cl, nfeatures = nfeatures, propMarkers = propMarkers)
1: scDblFinder(mocksce, nfeatures = 0.1 * nrow(mocksce), BPPARAM = BiocParallel::MulticoreParam(3))
Session info ``` R version 4.3.1 (2023-06-16) Platform: x86_64-pc-linux-gnu (64-bit) Running under: CentOS Linux 7 (Core) Matrix products: default BLAS/LAPACK: FlexiBLAS OPENBLAS; LAPACK version 3.10.1 locale: [1] LC_CTYPE=en_US.UTF-8 LC_NUMERIC=C LC_TIME=en_US.UTF-8 LC_COLLATE=en_US.UTF-8 LC_MONETARY=en_US.UTF-8 LC_MESSAGES=en_US.UTF-8 LC_PAPER=en_US.UTF-8 [8] LC_NAME=C LC_ADDRESS=C LC_TELEPHONE=C LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C time zone: Europe/Zurich tzcode source: system (glibc) attached base packages: [1] stats4 stats graphics grDevices utils datasets methods base other attached packages: [1] scDblFinder_1.14.0 SingleCellExperiment_1.22.0 SummarizedExperiment_1.30.2 Biobase_2.60.0 GenomicRanges_1.52.1 GenomeInfoDb_1.36.4 IRanges_2.34.1 [8] S4Vectors_0.38.2 BiocGenerics_0.46.0 MatrixGenerics_1.12.3 matrixStats_1.0.0 loaded via a namespace (and not attached): [1] bitops_1.0-7 gridExtra_2.3 rlang_1.1.1 magrittr_2.0.3 scater_1.28.0 compiler_4.3.1 DelayedMatrixStats_1.22.6 [8] vctrs_0.6.3 pkgconfig_2.0.3 crayon_1.5.2 fastmap_1.1.1 XVector_0.40.0 ellipsis_0.3.2 scuttle_1.10.3 [15] utf8_1.2.3 Rsamtools_2.16.0 promises_1.2.1 rmarkdown_2.25 ggbeeswarm_0.7.2 xfun_0.40 bluster_1.10.0 [22] zlibbioc_1.46.0 beachmat_2.16.0 jsonlite_1.8.7 later_1.3.1 DelayedArray_0.26.7 BiocParallel_1.34.2 irlba_2.3.5.1 [29] parallel_4.3.1 cluster_2.1.4 R6_2.5.1 limma_3.56.2 rtracklayer_1.60.1 xgboost_1.7.5.1 Rcpp_1.0.11 [36] knitr_1.44 httpuv_1.6.11 Matrix_1.6-1.1 igraph_1.5.1 tidyselect_1.2.0 rstudioapi_0.15.0 abind_1.4-5 [43] yaml_2.3.7 viridis_0.6.4 codetools_0.2-19 lattice_0.21-8 tibble_3.2.1 shiny_1.7.5 evaluate_0.22 [50] Biostrings_2.68.1 pillar_1.9.0 generics_0.1.3 RCurl_1.98-1.12 ggplot2_3.4.3 sparseMatrixStats_1.12.2 munsell_0.5.0 [57] scales_1.2.1 xtable_1.8-4 glue_1.6.2 metapod_1.8.0 tools_4.3.1 BiocIO_1.10.0 data.table_1.14.8 [64] BiocNeighbors_1.18.0 ScaledMatrix_1.8.1 GenomicAlignments_1.36.0 locfit_1.5-9.8 scran_1.28.2 XML_3.99-0.14 grid_4.3.1 [71] edgeR_3.42.4 colorspace_2.1-0 GenomeInfoDbData_1.2.10 beeswarm_0.4.0 BiocSingular_1.16.0 restfulr_0.0.15 vipor_0.4.5 [78] cli_3.6.1 rsvd_1.0.5 fansi_1.0.5 S4Arrays_1.0.6 viridisLite_0.4.2 dplyr_1.1.3 gtable_0.3.4 [85] digest_0.6.33 ggrepel_0.9.3 dqrng_0.3.1 rjson_0.2.21 htmltools_0.5.6.1 lifecycle_1.0.3 statmod_1.5.0 [92] mime_0.12 MASS_7.3-60 ```
plger commented 1 year ago

integer check added