From 2c784c63404e353dc9042f07c5407fbb1dd5e362 Mon Sep 17 00:00:00 2001 From: philchalmers Date: Tue, 3 Dec 2024 21:31:57 -0500 Subject: [PATCH] add verbose flag for non-interactive use (see #43) --- R/runArraySimulation.R | 11 ++++++++--- man/runArraySimulation.Rd | 8 +++++++- 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/R/runArraySimulation.R b/R/runArraySimulation.R index 17ac7027..931a89bd 100644 --- a/R/runArraySimulation.R +++ b/R/runArraySimulation.R @@ -111,6 +111,11 @@ #' #' @param ... additional arguments to be passed to \code{\link{runSimulation}} #' +#' @param verbose logical; pass a verbose flag to \code{\link{runSimulation}}. +#' Unlike \code{\link{runSimulation}} this is set to FALSE during interactive +#' sessions, though set to TRUE when non-interactive and information about the +#' session itself should be stored (e.g., in SLURM \code{.out} files) +#' #' @export #' #' @author Phil Chalmers \email{rphilip.chalmers@@gmail.com} @@ -289,8 +294,8 @@ runArraySimulation <- function(design, ..., replications, addArrayInfo = TRUE, parallel = FALSE, cl = NULL, ncores = parallelly::availableCores(omit = 1L), - save_details = list(), - control = list()){ + save_details = list(), control = list(), + verbose = ifelse(interactive(), FALSE, TRUE)){ dots <- list(...) if(parallel && ncores == 1L) parallel <- FALSE if(!is.null(dots$save_results) && isTRUE(dots$save_results)) @@ -339,7 +344,7 @@ runArraySimulation <- function(design, ..., replications, dsub <- design[row, , drop=FALSE] attr(dsub, 'Design.ID') <- attr(design, 'Design.ID')[row] ret <- runSimulation(design=dsub, replications=replications, seed=seed, - verbose=FALSE, save_details=save_details, + verbose=verbose, save_details=save_details, parallel=parallel, cl=cl, control=control, save=FALSE, ...) attr(ret, 'extra_info')$number_of_conditions <- nrow(design) diff --git a/man/runArraySimulation.Rd b/man/runArraySimulation.Rd index bcdab522..99d8dba2 100644 --- a/man/runArraySimulation.Rd +++ b/man/runArraySimulation.Rd @@ -18,7 +18,8 @@ runArraySimulation( cl = NULL, ncores = parallelly::availableCores(omit = 1L), save_details = list(), - control = list() + control = list(), + verbose = ifelse(interactive(), FALSE, TRUE) ) } \arguments{ @@ -101,6 +102,11 @@ See \code{\link{runSimulation}}} Useful for larger HPC cluster jobs with RAM constraints that could terminate abruptly. As a rule of thumb this should be set to around 90% of the maximum possible storage available. Default applies no memory limit} + +\item{verbose}{logical; pass a verbose flag to \code{\link{runSimulation}}. +Unlike \code{\link{runSimulation}} this is set to FALSE during interactive +sessions, though set to TRUE when non-interactive and information about the +session itself should be stored (e.g., in SLURM \code{.out} files)} } \description{ This function has the same purpose as \code{\link{runSimulation}}, however