It looks like the results aren't being correctly combined when parallelisation is used with scoreMarkers().
findMarkers() doesn't seem to have the same issue.
suppressPackageStartupMessages(library(scran))
suppressPackageStartupMessages(library(scuttle))
sce <- mockSCE()
sce <- logNormCounts(sce)
# k=4 clusters
kout <- kmeans(t(logcounts(sce)), centers=4)
# scoreMarkers() without/with parallelisation
out <- scoreMarkers(sce, groups=kout$cluster)
out2 <- scoreMarkers(sce, groups=kout$cluster, BPPARAM=BiocParallel::MulticoreParam(2))
# findMarkers() without/with parallelisation
m <- findMarkers(sce, groups = kout$cluster)
m2 <- findMarkers(sce, groups = kout$cluster, BPPARAM=BiocParallel::MulticoreParam(2))
# At most k-1=3 genes can have a rank of 1, but not true when paralellisation
# is used with scoreMarkers
sum(out[[1]]$rank.AUC == 1)
#> [1] 3
sum(out2[[1]]$rank.AUC == 1)
#> [1] 6
sum(m[[1]]$Top == 1)
#> [1] 3
sum(m2[[1]]$Top == 1)
#> [1] 3
It looks like the results aren't being correctly combined when parallelisation is used with
scoreMarkers()
.findMarkers()
doesn't seem to have the same issue.Created on 2023-07-17 with reprex v2.0.2
Session info
``` r sessioninfo::session_info() #> ─ Session info ─────────────────────────────────────────────────────────────── #> setting value #> version R version 4.3.1 (2023-06-16) #> os Ubuntu 22.04.2 LTS #> system x86_64, linux-gnu #> ui X11 #> language en_AU:en #> collate en_AU.UTF-8 #> ctype en_AU.UTF-8 #> tz Australia/Melbourne #> date 2023-07-17 #> pandoc 3.1.1 @ /usr/lib/rstudio/resources/app/bin/quarto/bin/tools/ (via rmarkdown) #> #> ─ Packages ─────────────────────────────────────────────────────────────────── #> package * version date (UTC) lib source #> beachmat 2.16.0 2023-04-25 [3] Bioconductor #> Biobase * 2.60.0 2023-04-25 [3] Bioconductor #> BiocGenerics * 0.46.0 2023-04-25 [3] Bioconductor #> BiocNeighbors 1.18.0 2023-04-25 [3] Bioconductor #> BiocParallel 1.34.2 2023-05-22 [1] Bioconductor #> BiocSingular 1.16.0 2023-04-25 [3] Bioconductor #> bitops 1.0-7 2021-04-24 [3] RSPM (R 4.2.0) #> bluster 1.10.0 2023-04-25 [3] Bioconductor #> cli 3.6.1 2023-03-23 [3] RSPM (R 4.2.0) #> cluster 2.1.4 2022-08-22 [3] RSPM (R 4.2.0) #> codetools 0.2-19 2023-02-01 [3] RSPM (R 4.2.0) #> crayon 1.5.2 2022-09-29 [3] RSPM (R 4.2.0) #> DelayedArray 0.26.3 2023-05-22 [1] Bioconductor #> DelayedMatrixStats 1.22.1 2023-06-09 [1] Bioconductor #> digest 0.6.33 2023-07-07 [3] RSPM (R 4.2.0) #> dqrng 0.3.0 2021-05-01 [3] CRAN (R 4.1.1) #> edgeR 3.42.4 2023-05-31 [3] Bioconductor #> evaluate 0.21 2023-05-05 [3] RSPM (R 4.2.0) #> fastmap 1.1.1 2023-02-24 [3] RSPM (R 4.2.0) #> fs 1.6.2 2023-04-25 [3] RSPM (R 4.2.0) #> GenomeInfoDb * 1.36.1 2023-06-21 [3] Bioconductor #> GenomeInfoDbData 1.2.10