R/fix_threads.R

Defines functions fix_threads

# input is passed number of threads
# return as-is, unless threads are missing (0, NULL, or NA), then autodetecs available threads and returns that
fix_threads <- function(threads) {
    # several obvious missing values should trigger full multithreaded behavior
    if (is.null(threads) || is.na(threads) || threads == 0)
        threads <- parallel::detectCores()
    # return
    return(threads)
}
OchoaLab/genbin documentation built on Nov. 14, 2024, 7:33 p.m.