Source: TBA

Intro

How many parallel threads should be used for pathway enrichment analysis?

AMD Ryzen Threadripper 1900X 8-Core Processor (16 parallel threads).

BiocManager::install(c("getDEE2","DESeq2","mitch","fgsea"))
## 'getOption("repos")' replaces Bioconductor standard repositories, see
## '?repositories' for details
## 
## replacement repositories:
##     CRAN: https://packagemanager.rstudio.com/all/__linux__/focal/latest
## Bioconductor version 3.13 (BiocManager 1.30.16), R 4.1.1 (2021-08-10)
## Warning: package(s) not installed when version(s) same as current; use `force = TRUE` to
##   re-install: 'getDEE2' 'DESeq2' 'mitch' 'fgsea'
## Old packages: 'askpass', 'BiocManager', 'brew', 'brio', 'cachem', 'callr',
##   'clipr', 'commonmark', 'crayon', 'credentials', 'curl', 'desc', 'devtools',
##   'diffobj', 'digest', 'fansi', 'formatR', 'fs', 'generics', 'gert', 'gh',
##   'gitcreds', 'httr', 'jsonlite', 'littler', 'magrittr', 'mime', 'openssl',
##   'pkgbuild', 'pkgload', 'prettyunits', 'processx', 'ps', 'rapiclient',
##   'remotes', 'roxygen2', 'rprojroot', 'rstudioapi', 'rversions', 'sessioninfo',
##   'stringi', 'sys', 'testthat', 'usethis', 'utf8', 'waldo', 'whisker', 'xml2',
##   'xopen', 'yaml', 'zip', 'boot', 'class', 'cluster', 'codetools', 'foreign',
##   'KernSmooth', 'lattice', 'mgcv', 'nlme', 'nnet', 'rpart', 'spatial',
##   'survival'
install.packages(c("tictoc","RhpcBLASctl","peakRAM"))
## Installing packages into '/usr/local/lib/R/site-library'
## (as 'lib' is unspecified)
library("getDEE2")
library("DESeq2")
## Loading required package: S4Vectors
## Loading required package: stats4
## Loading required package: BiocGenerics
## Loading required package: parallel
## 
## Attaching package: 'BiocGenerics'
## The following objects are masked from 'package:parallel':
## 
##     clusterApply, clusterApplyLB, clusterCall, clusterEvalQ,
##     clusterExport, clusterMap, parApply, parCapply, parLapply,
##     parLapplyLB, parRapply, parSapply, parSapplyLB
## The following objects are masked from 'package:stats':
## 
##     IQR, mad, sd, var, xtabs
## The following objects are masked from 'package:base':
## 
##     anyDuplicated, append, as.data.frame, basename, cbind, colnames,
##     dirname, do.call, duplicated, eval, evalq, Filter, Find, get, grep,
##     grepl, intersect, is.unsorted, lapply, Map, mapply, match, mget,
##     order, paste, pmax, pmax.int, pmin, pmin.int, Position, rank,
##     rbind, Reduce, rownames, sapply, setdiff, sort, table, tapply,
##     union, unique, unsplit, which.max, which.min
## 
## Attaching package: 'S4Vectors'
## The following objects are masked from 'package:base':
## 
##     expand.grid, I, unname
## Loading required package: IRanges
## Loading required package: GenomicRanges
## Loading required package: GenomeInfoDb
## Loading required package: SummarizedExperiment
## Loading required package: MatrixGenerics
## Loading required package: matrixStats
## 
## Attaching package: 'MatrixGenerics'
## The following objects are masked from 'package:matrixStats':
## 
##     colAlls, colAnyNAs, colAnys, colAvgsPerRowSet, colCollapse,
##     colCounts, colCummaxs, colCummins, colCumprods, colCumsums,
##     colDiffs, colIQRDiffs, colIQRs, colLogSumExps, colMadDiffs,
##     colMads, colMaxs, colMeans2, colMedians, colMins, colOrderStats,
##     colProds, colQuantiles, colRanges, colRanks, colSdDiffs, colSds,
##     colSums2, colTabulates, colVarDiffs, colVars, colWeightedMads,
##     colWeightedMeans, colWeightedMedians, colWeightedSds,
##     colWeightedVars, rowAlls, rowAnyNAs, rowAnys, rowAvgsPerColSet,
##     rowCollapse, rowCounts, rowCummaxs, rowCummins, rowCumprods,
##     rowCumsums, rowDiffs, rowIQRDiffs, rowIQRs, rowLogSumExps,
##     rowMadDiffs, rowMads, rowMaxs, rowMeans2, rowMedians, rowMins,
##     rowOrderStats, rowProds, rowQuantiles, rowRanges, rowRanks,
##     rowSdDiffs, rowSds, rowSums2, rowTabulates, rowVarDiffs, rowVars,
##     rowWeightedMads, rowWeightedMeans, rowWeightedMedians,
##     rowWeightedSds, rowWeightedVars
## Loading required package: Biobase
## Welcome to Bioconductor
## 
##     Vignettes contain introductory material; view with
##     'browseVignettes()'. To cite Bioconductor, see
##     'citation("Biobase")', and for packages 'citation("pkgname")'.
## 
## Attaching package: 'Biobase'
## The following object is masked from 'package:MatrixGenerics':
## 
##     rowMedians
## The following objects are masked from 'package:matrixStats':
## 
##     anyMissing, rowMedians
library("mitch")
## Registered S3 method overwritten by 'GGally':
##   method from   
##   +.gg   ggplot2
library("fgsea")
library("tictoc")
## 
## Attaching package: 'tictoc'
## The following object is masked from 'package:SummarizedExperiment':
## 
##     shift
## The following object is masked from 'package:GenomicRanges':
## 
##     shift
## The following object is masked from 'package:IRanges':
## 
##     shift
library("RhpcBLASctl")
library("peakRAM")
blas_set_num_threads(1)

Get gene expression data

download.file("https://ziemann-lab.net/public/fgseatest/de.Rds",
  "de.Rds")

de <- readRDS("de.Rds")
head(de)
##                          baseMean log2FoldChange      lfcSE      stat
## ENSG00000165949 IFI27   1960.1970      -3.384492 0.09388689 -36.04861
## ENSG00000090382 LYZ     7596.0299      -1.650342 0.05611430 -29.41036
## ENSG00000115461 IGFBP5   531.2217      -5.071157 0.17952391 -28.24781
## ENSG00000157601 MX1      827.1511      -2.877795 0.10478234 -27.46450
## ENSG00000111331 OAS3    2127.2010      -2.661214 0.09721242 -27.37525
## ENSG00000070915 SLC12A3  424.5509      -3.374852 0.12986708 -25.98697
##                                pvalue          padj SRR1171523 SRR1171524
## ENSG00000165949 IFI27   1.450013e-284 1.909377e-280   12.05759   12.12946
## ENSG00000090382 LYZ     4.048160e-190 2.665308e-186   13.52939   13.52615
## ENSG00000115461 IGFBP5  1.514307e-175 6.646797e-172   10.60714   10.46316
## ENSG00000157601 MX1     4.663288e-166 1.535154e-162   10.88831   11.08737
## ENSG00000111331 OAS3    5.406541e-165 1.423867e-161   11.92053   12.26289
## ENSG00000070915 SLC12A3 6.951548e-149 1.525633e-145   10.35061   10.33824
##                         SRR1171525 SRR1171526 SRR1171527 SRR1171528
## ENSG00000165949 IFI27     11.82385   9.646471   9.705799   9.623453
## ENSG00000090382 LYZ       13.62313  12.080100  12.012891  12.031277
## ENSG00000115461 IGFBP5    10.69892   8.568916   8.566744   8.693134
## ENSG00000157601 MX1       10.86873   9.322793   9.356473   9.267699
## ENSG00000111331 OAS3      11.91655  10.108651  10.070989  10.012229
## ENSG00000070915 SLC12A3   10.26395   8.844934   8.904787   8.871748

Get pathways

download.file("https://ziemann-lab.net/public/fgseatest/c5.go.v2023.2.Hs.symbols.gmt",
  "c5.go.v2023.2.Hs.symbols.gmt")

pw <- gmt_import("c5.go.v2023.2.Hs.symbols.gmt")

Mitch

gt <- data.frame(rownames(de))
gt$g <- sapply(strsplit(gt[,1]," "),"[[",2)

m <- mitch_import(x=de,DEtype="deseq2",geneTable=gt)
## The input is a single dataframe; one contrast only. Converting
##         it to a list for you.
## Note: Mean no. genes in input = 13168
## Note: no. genes in output = 13164
## Note: estimated proportion of input genes in output = 1
corerange <- 1:16

mres <- lapply(corerange, function(cores) {
  tic()
  mres <- mitch_calc(x=m,genesets=pw,cores=cores)
  toc()
} )
## Note: When prioritising by significance (ie: small
##             p-values), large effect sizes might be missed.
## 46.789 sec elapsed
## Note: When prioritising by significance (ie: small
##             p-values), large effect sizes might be missed.
## 27.022 sec elapsed
## Note: When prioritising by significance (ie: small
##             p-values), large effect sizes might be missed.
## 22.123 sec elapsed
## Note: When prioritising by significance (ie: small
##             p-values), large effect sizes might be missed.
## 19.781 sec elapsed
## Note: When prioritising by significance (ie: small
##             p-values), large effect sizes might be missed.
## 18.546 sec elapsed
## Note: When prioritising by significance (ie: small
##             p-values), large effect sizes might be missed.
## 14.706 sec elapsed
## Note: When prioritising by significance (ie: small
##             p-values), large effect sizes might be missed.
## 16.227 sec elapsed
## Note: When prioritising by significance (ie: small
##             p-values), large effect sizes might be missed.
## 15.224 sec elapsed
## Note: When prioritising by significance (ie: small
##             p-values), large effect sizes might be missed.
## 15.191 sec elapsed
## Note: When prioritising by significance (ie: small
##             p-values), large effect sizes might be missed.
## 14.105 sec elapsed
## Note: When prioritising by significance (ie: small
##             p-values), large effect sizes might be missed.
## 15.127 sec elapsed
## Note: When prioritising by significance (ie: small
##             p-values), large effect sizes might be missed.
## 16.851 sec elapsed
## Note: When prioritising by significance (ie: small
##             p-values), large effect sizes might be missed.
## 14.302 sec elapsed
## Note: When prioritising by significance (ie: small
##             p-values), large effect sizes might be missed.
## 14.866 sec elapsed
## Note: When prioritising by significance (ie: small
##             p-values), large effect sizes might be missed.
## 15.508 sec elapsed
## Note: When prioritising by significance (ie: small
##             p-values), large effect sizes might be missed.
## 16.329 sec elapsed
peakRAM(mxres <- mitch_calc(x=m,genesets=pw,cores=1))
## Note: When prioritising by significance (ie: small
##             p-values), large effect sizes might be missed.
##                                Function_Call Elapsed_Time_sec
## 1 mxres<-mitch_calc(x=m,genesets=pw,cores=1)            43.48
##   Total_RAM_Used_MiB Peak_RAM_Used_MiB
## 1                  1             122.7
mres <- do.call(rbind,lapply(mres,unlist))
mres <- as.numeric(mres[,2]) - as.numeric(mres[,1])
names(mres) <- corerange

mres
##      1      2      3      4      5      6      7      8      9     10     11 
## 46.789 27.022 22.123 19.781 18.546 14.706 16.227 15.224 15.191 14.105 15.127 
##     12     13     14     15     16 
## 16.851 14.302 14.866 15.508 16.329
barplot(mres,ylab="elapsed time in s",xlab="parallel threads", main="mitch")

FGSEA

f <- as.vector(m[,1])
names(f) <- rownames(m)

corerange <- 1:16

fres <- lapply(corerange, function(cores) {
  tic()
  fgseaRes <- fgsea(pathways = pw,
                  stats    = f,
                  minSize  = 10,
                  nproc=cores)
  toc()
} )
## Warning in fgseaMultilevel(...): There were 29 pathways for which P-values were
## not calculated properly due to unbalanced (positive and negative) gene-level
## statistic values. For such pathways pval, padj, NES, log2err are set to NA. You
## can try to increase the value of the argument nPermSimple (for example set it
## nPermSimple = 10000)
## Warning in fgseaMultilevel(...): For some of the pathways the P-values were
## likely overestimated. For such pathways log2err is set to NA.
## Warning in fgseaMultilevel(...): For some pathways, in reality P-values are
## less than 1e-10. You can set the `eps` argument to zero for better estimation.
## 99.256 sec elapsed
## Warning in fgseaMultilevel(...): There were 24 pathways for which P-values were
## not calculated properly due to unbalanced (positive and negative) gene-level
## statistic values. For such pathways pval, padj, NES, log2err are set to NA. You
## can try to increase the value of the argument nPermSimple (for example set it
## nPermSimple = 10000)
## Warning in fgseaMultilevel(...): For some of the pathways the P-values were
## likely overestimated. For such pathways log2err is set to NA.
## Warning in fgseaMultilevel(...): For some pathways, in reality P-values are
## less than 1e-10. You can set the `eps` argument to zero for better estimation.
## 52.141 sec elapsed
## Warning in fgseaMultilevel(...): There were 21 pathways for which P-values were
## not calculated properly due to unbalanced (positive and negative) gene-level
## statistic values. For such pathways pval, padj, NES, log2err are set to NA. You
## can try to increase the value of the argument nPermSimple (for example set it
## nPermSimple = 10000)
## Warning in fgseaMultilevel(...): For some of the pathways the P-values were
## likely overestimated. For such pathways log2err is set to NA.
## Warning in fgseaMultilevel(...): For some pathways, in reality P-values are
## less than 1e-10. You can set the `eps` argument to zero for better estimation.
## 41.858 sec elapsed
## Warning in fgseaMultilevel(...): There were 14 pathways for which P-values were
## not calculated properly due to unbalanced (positive and negative) gene-level
## statistic values. For such pathways pval, padj, NES, log2err are set to NA. You
## can try to increase the value of the argument nPermSimple (for example set it
## nPermSimple = 10000)
## Warning in fgseaMultilevel(...): For some of the pathways the P-values were
## likely overestimated. For such pathways log2err is set to NA.
## Warning in fgseaMultilevel(...): For some pathways, in reality P-values are
## less than 1e-10. You can set the `eps` argument to zero for better estimation.
## 33.207 sec elapsed
## Warning in fgseaMultilevel(...): There were 23 pathways for which P-values were
## not calculated properly due to unbalanced (positive and negative) gene-level
## statistic values. For such pathways pval, padj, NES, log2err are set to NA. You
## can try to increase the value of the argument nPermSimple (for example set it
## nPermSimple = 10000)
## Warning in fgseaMultilevel(...): For some of the pathways the P-values were
## likely overestimated. For such pathways log2err is set to NA.
## Warning in fgseaMultilevel(...): For some pathways, in reality P-values are
## less than 1e-10. You can set the `eps` argument to zero for better estimation.
## 26.326 sec elapsed
## Warning in fgseaMultilevel(...): There were 21 pathways for which P-values were
## not calculated properly due to unbalanced (positive and negative) gene-level
## statistic values. For such pathways pval, padj, NES, log2err are set to NA. You
## can try to increase the value of the argument nPermSimple (for example set it
## nPermSimple = 10000)
## Warning in fgseaMultilevel(...): For some of the pathways the P-values were
## likely overestimated. For such pathways log2err is set to NA.
## Warning in fgseaMultilevel(...): For some pathways, in reality P-values are
## less than 1e-10. You can set the `eps` argument to zero for better estimation.
## 22.537 sec elapsed
## Warning in fgseaMultilevel(...): There were 19 pathways for which P-values were
## not calculated properly due to unbalanced (positive and negative) gene-level
## statistic values. For such pathways pval, padj, NES, log2err are set to NA. You
## can try to increase the value of the argument nPermSimple (for example set it
## nPermSimple = 10000)
## Warning in fgseaMultilevel(...): For some of the pathways the P-values were
## likely overestimated. For such pathways log2err is set to NA.
## Warning in fgseaMultilevel(...): For some pathways, in reality P-values are
## less than 1e-10. You can set the `eps` argument to zero for better estimation.
## 22.489 sec elapsed
## Warning in fgseaMultilevel(...): There were 27 pathways for which P-values were
## not calculated properly due to unbalanced (positive and negative) gene-level
## statistic values. For such pathways pval, padj, NES, log2err are set to NA. You
## can try to increase the value of the argument nPermSimple (for example set it
## nPermSimple = 10000)
## Warning in fgseaMultilevel(...): For some of the pathways the P-values were
## likely overestimated. For such pathways log2err is set to NA.
## Warning in fgseaMultilevel(...): For some pathways, in reality P-values are
## less than 1e-10. You can set the `eps` argument to zero for better estimation.
## 19.19 sec elapsed
## Warning in fgseaMultilevel(...): There were 35 pathways for which P-values were
## not calculated properly due to unbalanced (positive and negative) gene-level
## statistic values. For such pathways pval, padj, NES, log2err are set to NA. You
## can try to increase the value of the argument nPermSimple (for example set it
## nPermSimple = 10000)
## Warning in fgseaMultilevel(...): For some pathways, in reality P-values are
## less than 1e-10. You can set the `eps` argument to zero for better estimation.
## 21.085 sec elapsed
## Warning in fgseaMultilevel(...): There were 30 pathways for which P-values were
## not calculated properly due to unbalanced (positive and negative) gene-level
## statistic values. For such pathways pval, padj, NES, log2err are set to NA. You
## can try to increase the value of the argument nPermSimple (for example set it
## nPermSimple = 10000)
## Warning in fgseaMultilevel(...): For some of the pathways the P-values were
## likely overestimated. For such pathways log2err is set to NA.
## Warning in fgseaMultilevel(...): For some pathways, in reality P-values are
## less than 1e-10. You can set the `eps` argument to zero for better estimation.
## 18.788 sec elapsed
## Warning in fgseaMultilevel(...): There were 20 pathways for which P-values were
## not calculated properly due to unbalanced (positive and negative) gene-level
## statistic values. For such pathways pval, padj, NES, log2err are set to NA. You
## can try to increase the value of the argument nPermSimple (for example set it
## nPermSimple = 10000)
## Warning in fgseaMultilevel(...): For some of the pathways the P-values were
## likely overestimated. For such pathways log2err is set to NA.
## Warning in fgseaMultilevel(...): For some pathways, in reality P-values are
## less than 1e-10. You can set the `eps` argument to zero for better estimation.
## 18.803 sec elapsed
## Warning in fgseaMultilevel(...): There were 26 pathways for which P-values were
## not calculated properly due to unbalanced (positive and negative) gene-level
## statistic values. For such pathways pval, padj, NES, log2err are set to NA. You
## can try to increase the value of the argument nPermSimple (for example set it
## nPermSimple = 10000)
## Warning in fgseaMultilevel(...): For some of the pathways the P-values were
## likely overestimated. For such pathways log2err is set to NA.
## Warning in fgseaMultilevel(...): For some pathways, in reality P-values are
## less than 1e-10. You can set the `eps` argument to zero for better estimation.
## 17.278 sec elapsed
## Warning in fgseaMultilevel(...): There were 25 pathways for which P-values were
## not calculated properly due to unbalanced (positive and negative) gene-level
## statistic values. For such pathways pval, padj, NES, log2err are set to NA. You
## can try to increase the value of the argument nPermSimple (for example set it
## nPermSimple = 10000)
## Warning in fgseaMultilevel(...): For some of the pathways the P-values were
## likely overestimated. For such pathways log2err is set to NA.
## Warning in fgseaMultilevel(...): For some pathways, in reality P-values are
## less than 1e-10. You can set the `eps` argument to zero for better estimation.
## 17.683 sec elapsed
## Warning in fgseaMultilevel(...): There were 20 pathways for which P-values were
## not calculated properly due to unbalanced (positive and negative) gene-level
## statistic values. For such pathways pval, padj, NES, log2err are set to NA. You
## can try to increase the value of the argument nPermSimple (for example set it
## nPermSimple = 10000)
## Warning in fgseaMultilevel(...): For some of the pathways the P-values were
## likely overestimated. For such pathways log2err is set to NA.
## Warning in fgseaMultilevel(...): For some pathways, in reality P-values are
## less than 1e-10. You can set the `eps` argument to zero for better estimation.
## 16.674 sec elapsed
## Warning in fgseaMultilevel(...): There were 12 pathways for which P-values were
## not calculated properly due to unbalanced (positive and negative) gene-level
## statistic values. For such pathways pval, padj, NES, log2err are set to NA. You
## can try to increase the value of the argument nPermSimple (for example set it
## nPermSimple = 10000)
## Warning in fgseaMultilevel(...): For some of the pathways the P-values were
## likely overestimated. For such pathways log2err is set to NA.
## Warning in fgseaMultilevel(...): For some pathways, in reality P-values are
## less than 1e-10. You can set the `eps` argument to zero for better estimation.
## 19.324 sec elapsed
## Warning in fgseaMultilevel(...): There were 20 pathways for which P-values were
## not calculated properly due to unbalanced (positive and negative) gene-level
## statistic values. For such pathways pval, padj, NES, log2err are set to NA. You
## can try to increase the value of the argument nPermSimple (for example set it
## nPermSimple = 10000)
## Warning in fgseaMultilevel(...): For some of the pathways the P-values were
## likely overestimated. For such pathways log2err is set to NA.
## Warning in fgseaMultilevel(...): For some pathways, in reality P-values are
## less than 1e-10. You can set the `eps` argument to zero for better estimation.
## 17.176 sec elapsed
blas_set_num_threads(1)
peakRAM(fgseaRes <- fgsea(pathways = pw,
                  stats    = f,
                  minSize  = 10,
                  nproc=1))
## Warning in fgseaMultilevel(...): There were 21 pathways for which P-values were
## not calculated properly due to unbalanced (positive and negative) gene-level
## statistic values. For such pathways pval, padj, NES, log2err are set to NA. You
## can try to increase the value of the argument nPermSimple (for example set it
## nPermSimple = 10000)
## Warning in fgseaMultilevel(...): For some of the pathways the P-values were
## likely overestimated. For such pathways log2err is set to NA.
## Warning in fgseaMultilevel(...): For some pathways, in reality P-values are
## less than 1e-10. You can set the `eps` argument to zero for better estimation.
##                                             Function_Call Elapsed_Time_sec
## 1 fgseaRes<-fgsea(pathways=pw,stats=f,minSize=10,nproc=1)          101.992
##   Total_RAM_Used_MiB Peak_RAM_Used_MiB
## 1              -23.2              87.4
blas_set_num_threads(8)
peakRAM(fgseaRes <- fgsea(pathways = pw,
                  stats    = f,
                  minSize  = 10,
                  nproc=1))
## Warning in fgseaMultilevel(...): There were 10 pathways for which P-values were
## not calculated properly due to unbalanced (positive and negative) gene-level
## statistic values. For such pathways pval, padj, NES, log2err are set to NA. You
## can try to increase the value of the argument nPermSimple (for example set it
## nPermSimple = 10000)
## Warning in fgseaMultilevel(...): For some of the pathways the P-values were
## likely overestimated. For such pathways log2err is set to NA.
## Warning in fgseaMultilevel(...): For some pathways, in reality P-values are
## less than 1e-10. You can set the `eps` argument to zero for better estimation.
##                                             Function_Call Elapsed_Time_sec
## 1 fgseaRes<-fgsea(pathways=pw,stats=f,minSize=10,nproc=1)          107.143
##   Total_RAM_Used_MiB Peak_RAM_Used_MiB
## 1                8.3             118.8
blas_set_num_threads(1)
peakRAM(fgseaRes <- fgsea(pathways = pw,
                  stats    = f,
                  minSize  = 10,
                  nproc=8))
## Warning in fgseaMultilevel(...): There were 26 pathways for which P-values were
## not calculated properly due to unbalanced (positive and negative) gene-level
## statistic values. For such pathways pval, padj, NES, log2err are set to NA. You
## can try to increase the value of the argument nPermSimple (for example set it
## nPermSimple = 10000)
## Warning in fgseaMultilevel(...): For some of the pathways the P-values were
## likely overestimated. For such pathways log2err is set to NA.
## Warning in fgseaMultilevel(...): For some pathways, in reality P-values are
## less than 1e-10. You can set the `eps` argument to zero for better estimation.
##                                             Function_Call Elapsed_Time_sec
## 1 fgseaRes<-fgsea(pathways=pw,stats=f,minSize=10,nproc=8)           16.661
##   Total_RAM_Used_MiB Peak_RAM_Used_MiB
## 1                9.1             118.8
blas_set_num_threads(4)
peakRAM(fgseaRes <- fgsea(pathways = pw,
                  stats    = f,
                  minSize  = 10,
                  nproc=4))
## Warning in fgseaMultilevel(...): There were 24 pathways for which P-values were
## not calculated properly due to unbalanced (positive and negative) gene-level
## statistic values. For such pathways pval, padj, NES, log2err are set to NA. You
## can try to increase the value of the argument nPermSimple (for example set it
## nPermSimple = 10000)
## Warning in fgseaMultilevel(...): For some of the pathways the P-values were
## likely overestimated. For such pathways log2err is set to NA.
## Warning in fgseaMultilevel(...): For some pathways, in reality P-values are
## less than 1e-10. You can set the `eps` argument to zero for better estimation.
##                                             Function_Call Elapsed_Time_sec
## 1 fgseaRes<-fgsea(pathways=pw,stats=f,minSize=10,nproc=4)           29.379
##   Total_RAM_Used_MiB Peak_RAM_Used_MiB
## 1                9.1             118.8
fres <- do.call(rbind,lapply(fres,unlist))
fres <- as.numeric(fres[,2]) - as.numeric(fres[,1])
names(fres) <- corerange

fres
##      1      2      3      4      5      6      7      8      9     10     11 
## 99.256 52.141 41.858 33.207 26.326 22.537 22.489 19.190 21.085 18.788 18.803 
##     12     13     14     15     16 
## 17.278 17.683 16.674 19.324 17.176
barplot(fres,ylab="elapsed time in s",xlab="parallel threads", main="fgsea")

Session information

sessionInfo()
## R version 4.1.1 (2021-08-10)
## Platform: x86_64-pc-linux-gnu (64-bit)
## Running under: Ubuntu 20.04.3 LTS
## 
## Matrix products: default
## BLAS/LAPACK: /usr/lib/x86_64-linux-gnu/openblas-pthread/libopenblasp-r0.3.8.so
## 
## 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=C             
##  [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       
## 
## attached base packages:
## [1] parallel  stats4    stats     graphics  grDevices utils     datasets 
## [8] methods   base     
## 
## other attached packages:
##  [1] peakRAM_1.0.2               RhpcBLASctl_0.23-42        
##  [3] tictoc_1.2.1                fgsea_1.18.0               
##  [5] mitch_1.4.1                 DESeq2_1.32.0              
##  [7] SummarizedExperiment_1.22.0 Biobase_2.52.0             
##  [9] MatrixGenerics_1.4.3        matrixStats_1.3.0          
## [11] GenomicRanges_1.44.0        GenomeInfoDb_1.28.4        
## [13] IRanges_2.26.0              S4Vectors_0.30.2           
## [15] BiocGenerics_0.38.0         getDEE2_1.2.0              
## 
## loaded via a namespace (and not attached):
##  [1] bitops_1.0-7           bit64_4.0.5            RColorBrewer_1.1-3    
##  [4] httr_1.4.2             tools_4.1.1            bslib_0.7.0           
##  [7] utf8_1.2.2             R6_2.5.1               KernSmooth_2.23-20    
## [10] DBI_1.2.3              colorspace_2.1-0       htm2txt_2.2.2         
## [13] tidyselect_1.2.1       gridExtra_2.3          GGally_2.2.1          
## [16] bit_4.0.5              compiler_4.1.1         cli_3.6.3             
## [19] DelayedArray_0.18.0    sass_0.4.9             caTools_1.18.2        
## [22] scales_1.3.0           genefilter_1.74.1      stringr_1.5.1         
## [25] digest_0.6.28          rmarkdown_2.27         XVector_0.32.0        
## [28] pkgconfig_2.0.3        htmltools_0.5.8.1      highr_0.11            
## [31] fastmap_1.2.0          htmlwidgets_1.6.4      rlang_1.1.4           
## [34] RSQLite_2.3.7          shiny_1.8.1.1          jquerylib_0.1.4       
## [37] generics_0.1.0         jsonlite_1.7.2         gtools_3.9.5          
## [40] BiocParallel_1.26.2    dplyr_1.1.4            RCurl_1.98-1.16       
## [43] magrittr_2.0.1         GenomeInfoDbData_1.2.6 Matrix_1.3-4          
## [46] Rcpp_1.0.13            munsell_0.5.1          fansi_0.5.0           
## [49] lifecycle_1.0.4        stringi_1.7.4          yaml_2.2.1            
## [52] MASS_7.3-54            zlibbioc_1.38.0        gplots_3.1.3.1        
## [55] plyr_1.8.9             grid_4.1.1             ggstats_0.6.0         
## [58] blob_1.2.4             promises_1.3.0         crayon_1.4.1          
## [61] lattice_0.20-45        Biostrings_2.60.2      echarts4r_0.4.5       
## [64] splines_4.1.1          annotate_1.70.0        KEGGREST_1.32.0       
## [67] locfit_1.5-9.10        knitr_1.48             pillar_1.9.0          
## [70] reshape2_1.4.4         geneplotter_1.70.0     fastmatch_1.1-4       
## [73] XML_3.99-0.17          glue_1.7.0             evaluate_0.24.0       
## [76] data.table_1.15.4      BiocManager_1.30.16    png_0.1-8             
## [79] vctrs_0.6.5            httpuv_1.6.15          gtable_0.3.5          
## [82] purrr_1.0.2            tidyr_1.3.1            cachem_1.0.6          
## [85] ggplot2_3.5.1          xfun_0.46              mime_0.11             
## [88] xtable_1.8-4           later_1.3.2            survival_3.2-13       
## [91] tibble_3.2.1           beeswarm_0.4.0         AnnotationDbi_1.54.1  
## [94] memoise_2.0.1