broadinstitute / ssGSEA2.0

Single sample Gene Set Enrichment analysis (ssGSEA) and PTM Enrichment Analysis (PTM-SEA)
Other
230 stars 79 forks source link

Number of cores in ssgsea-cli.R is hardcoded but should be set using command line arguments #33

Open sstein93 opened 1 month ago

sstein93 commented 1 month ago

The number of cores in ssgsea-cli.R is hard coded, and should be set using an input command line argument instead.

Currently, parallel processing is set to use all available cores, i.e.:

## in ssgsea-cli.R
# hard-coded parameters
spare.cores <- 0 # use all available cpus

## then in ssGSEA.2.0.R
## register cores
cl <- parallel::makeCluster(detectCores() - spare.cores)
doParallel::registerDoParallel(cl)

This is problematic when using a job scheduler in an HPC environment, since detectCores() returns the number of CPU cores on the current machine regardless of how many cores the job has been allotted by the scheduler.

Is it possible to add a command line argument --cores (or some other name) to specify the number of cores one wants to use, and then in ssGSEA.2.0.R use cl <- parallel::makeCluster(cores)?

Thanks!