diff --git a/NAMESPACE b/NAMESPACE index 3cfa939c79fa3e3767d965d2849eb0ebca3d3c9a..5c54f9ee486b77912b8b0cb22cdb9d4f1e6837d1 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -16,6 +16,7 @@ export(get_rt_interval) export(get_val_unit) export(grab_unit) export(import_project) +export(init) export(list2rev) export(load_compound_input) export(load_data_input) diff --git a/R/api.R b/R/api.R index dd9b24ac187012c276426410bc7857de13278faf..577ec70e53926075912e4b3e82377b278708f923 100644 --- a/R/api.R +++ b/R/api.R @@ -11,20 +11,19 @@ ## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. ## See the License for the specific language governing permissions and ## limitations under the License. - -##' @export -##' @param project `character(1)`, a directory containing input data. -##' @param top_data_dir `character(1)`, a directory contining data -##' subdirs. -##' @param metfrag_db_dir `character(1)`, a directory containing -##' MetFrag DBs. -##' @param m `state`, a Shinyscreen state. -##' @param phases `character(n)`, a character vector of Shinyscreen -##' phases. -##' @param help `logical(1)`, print help? -run <- function(project="", - top_data_dir="", - metfrag_db_dir="", +#' @title Run Shinyscreen Pipeline +#' +#' @details TODO. +#' +#' @param envopts `envopts`, an `envopts` object. +#' @param project `character(1)`, a directory containing input data. +#' @param m `state`, a Shinyscreen state. +#' @param phases `character(n)`, a character vector of Shinyscreen +#' phases. +#' @param help `logical(1)`, print help? +#' @export +run <- function(envopts, + project="", m=NULL, phases=NULL, help=F) { @@ -53,19 +52,26 @@ run <- function(project="", } all_phases[phases] + } - eo = prepare_paths(project=project, - projects="", - top_data_dir=top_data_dir, - metfrag_db_dir=metfrag_db_dir) - - - m <- if (nchar(project)!=0) new_project(project,envopts=eo) else if (!is.null(m)) m else stop("(run): Either the YAML config file (project),\n or the starting state (m) must be provided\n as the argument to the run function.") - ## m$conf$project <- norm_path(m$conf$project) #FIXME: Test in all workflows! - m <- withr::with_dir(new=m$run$paths$project,code = Reduce(function (prev,f) f(prev), - x = the_phases, - init = m)) + + m = if (is.null(m)) { + ## A project from scratch. + new_project(project,envopts=envopts) + } else { + ## Regenerate the runtime environment. + + project = if (nchar(project)==0L) m$run$project else project + m$run = new_runtime_state(project=project, + envopts = envopts, + conf=m$conf) + m + } + + m = withr::with_dir(new=m$run$paths$project,code = Reduce(function (prev,f) f(prev), + x = the_phases, + init = m)) return(invisible(m)) } @@ -697,78 +703,12 @@ create_plots <- function(m) { m } - -prepare_paths <- function(project, - projects, - top_data_dir, - metfrag_db_dir) { - - ## Get system-wide config. - eo = load_envopts() - - ## Figure out how to run. - - - if (nchar(top_data_dir)>0) { - ## Specified `top_data_dir` overrides everything. - eo$top_data_dir = norm_path(top_data_dir) - } else { - ## If no user supplied `top_data_dir`, check if envopts - ## top_data_dir is empty. - if (nchar(eo$top_data_dir)==0L) { - ## If yes, the last attempt is to designate - ## `project` dir as `top_data_dir` directory. - if (dir.exists(project)) eo$top_data_dir=norm_path(project) - } - - } - - - ## In case `project` is a not a zero-length string. - if (nchar(project)!=0) { - ## The variable `projects` is alwas a super-directory of - ## `project`. - withr::with_dir(project,{ - eo$projects=norm_path("..") - }) - } else { - if (nchar(projects)!=0) { - eo$projects=projects - } - } - - - ## Override the default `db_dir` if `metfrag_db_dir` supplied. - if (nchar(metfrag_db_dir)>0) { - eo$metfrag$db_dir = norm_path(metfrag_db_dir) - } else { - ## If no default `db_dir`, try with `project`. - if (nchar(eo$metfrag$db_dir)==0L) { - eo$metfrag$db_dir = norm_path(project) - } - } - eo -} - prepare_app <- function(dir_before, - projects, - top_data_dir, - metfrag_db_dir) { - + envopts) { ## Information that needs to be availabe to the shiny server. init <- list() init$dir_before <- dir_before - init$envopts = prepare_paths(project="", - projects=projects, - top_data_dir=top_data_dir, - metfrag_db_dir=metfrag_db_dir) - init$top_data_dir <- init$envopts$top_data_dir - init$projects <- init$envopts$projects - - - check_dir_absent(init$top_data_dir,what="top-data-dir") - check_dir_absent(init$projects,what="projects") - + init$envopts = envopts ## Create independent starting `home' for the server. dir_start <- tempfile("shinyscreen") @@ -788,14 +728,10 @@ prepare_app <- function(dir_before, dir_start } + #' @export #' @title app -#' @param projects `character(1)`, a location on the server side -#' containing project directories. -#' @param top_data_dir `character(1)`, a location on the server side -#' containing data directories. -#' @param metfrag_db_dir `character(1)`, a location on the server side -#' containing MetFrag databases. +#' @param envopts `envopts`. Shinyscreen environment options. #' @param shiny_args `list`, optional list of arguments conveyed to #' `rmarkdown::run` `shiny_args` argument. #' @param render_args `list`, optional list of arguments conveyed to @@ -804,19 +740,15 @@ prepare_app <- function(dir_before, #' of the MetFrag jar file. #' @return Nada. #' @author Todor Kondić -app <- function(projects="", - top_data_dir="", - metfrag_db_dir="", +app <- function(envopts, shiny_args=list(launch.browser=F), render_args=NULL) { dir_before = getwd() message("dir_before: ", dir_before) - message("top_data_dir: ", top_data_dir) - message("projects: ", projects) + message("top_data_dir: ", envopts$top_data_dir) + message("projects: ", evnopts$projects) dir_start = prepare_app(dir_before=dir_before, - projects=projects, - top_data_dir=top_data_dir, - metfrag_db_dir=metfrag_db_dir) + envopts=envopts) on.exit(expr=setwd(dir_before)) setwd(dir_start) @@ -826,22 +758,21 @@ app <- function(projects="", #' @export #' @title serve -#' @param top_data_dir `character(1)`, a location on the server side -#' containing data directories. -#' @param metfrag_db_dir `character(1)`, a location on the server side -#' containing MetFrag DBs. -#' @param usersdir `character(1)`, a location on the server side -#' containing individual user directories. +#' @param envopts `envopts`, an `envopts` object. #' @param user `character(1)`, subdir of usersdir. #' @param host `character(1)`, optional, address where the page is #' served. #' @param port `integer(1)`, optional, port at which the page is #' served. +#' @param top_data_dir `character(1)`, a location on the server side +#' containing data directories. +#' @param metfrag_db_dir `character(1)`, a location on the server side +#' containing MetFrag DBs. #' @return Nada. #' @author Todor Kondić -serve <- function(top_data_dir,metfrag_db_dir,usersdir,user,host='0.0.0.0',port=7777) { +serve <- function(envopts,user,host='0.0.0.0',port=7777) { shiny_args <- c(list(launch.browser=F),list(host=host,port=port)) - projects <- file.path(usersdir,user) + projects <- file.path(envopts$users_dir,user) if (!dir.exists(projects)) { dir.create(projects) message('Created projects: ',projects) @@ -849,9 +780,7 @@ serve <- function(top_data_dir,metfrag_db_dir,usersdir,user,host='0.0.0.0',port= message('Using existing projects: ', projects) } app(shiny_args=shiny_args, - top_data_dir=top_data_dir, - projects=projects, - metfrag_db_dir=metfrag_db_dir) + envopts=envopts) } @@ -941,24 +870,65 @@ report <- function(m) { #' @title Initialise Shinyscreen Configuration #' @details This function is used to inform `shinyscreen` about the -#' working environment. It is only necessary to call it once. The -#' parameters will be memorised. +#' working environment. If argument `save` is T, the configuration +#' will be memorised. Subsequent calls to `init` without arguments +#' will just load the configuration. If `merge` argument is T, the +#' resulting configuration object is going to be a merge between +#' the new parameters and the memorised ones. Those arguments not +#' mentioned in the argument list will be remembered from the save +#' config. #' @inheritParams envopts -#' @return Nothing. +#' @param merge `logical(1)`, optional. If T, merge with saved +#' configuration. +#' @param save `logical(1)`, optional. If T, save configuration, +#' otherwise just return the Shinyscreen environment options. +#' @return An `envopts` object. #' @author Todor Kondić -init <- function(projects="", - top_data_dir="", - metfrag_db_dir="", - metfrag_jar="", - java_bin=Sys.which("java"), - metfrag_max_proc=parallel::detectCores()) { - e = envopts(projects = projects, - top_data_dir = top_data_dir, - metfrag_db_dir = metfrag_db_dir, - metfrag_jar = metfrag_jar, - java_bin = java_bin, - metfrag_max_proc = metfrag_max_proc) - save_envopts(o=e) +#' @export +init <- function(projects=NULL, + top_data_dir=NULL, + metfrag_db_dir=NULL, + metfrag_jar=NULL, + java_bin=NULL, + metfrag_max_proc=NULL, + merge=T, + save=F) { + + + env = environment() + eargs = list() + ## Merge into the untouched (NULLs), only. + if (merge) { + ## Merge with old values + eold = load_envopts() + cargs = formalArgs(envopts) + if (length(eold)>0L) { + for (a in cargs) { + if (is.null(env[[a]])) eargs[[a]] = eold[[a]] else eargs[[a]]=env[[a]] + } + } + } + + ## Default values = "" . + chrargs = c("projects","top_data_dir","metfrag_db_dir") + + for (ca in chrargs) { + if (is.null(eargs[[ca]])) eargs[[ca]]="" + } + + if (is.null(java_bin)) { + eargs[["java_bin"]]= Sys.which("java") + } + + if (is.null(metfrag_max_proc)) { + eargs$metfrag_max_proc = parallel::detectCores() + } + + e = do.call(envopts,eargs) + + + if (save) save_envopts(o=e) + e } #' @title Run MetFrag diff --git a/R/envopts.R b/R/envopts.R index cfccd2e41825af8c7521a153e8c5ff4da1c4d598..f4beb664f2f6005a8d1d3935c9c79ffced34b6f0 100644 --- a/R/envopts.R +++ b/R/envopts.R @@ -22,6 +22,14 @@ +mk_envopts <- function() { + res = list() + class(res) = c("envopts","list") #Just to officially make it an + #object. + res +} + + #' @title Create a `envopts` Object #' @details An `envopts` object is Shinyscreen way to store settings #' related to a specific computing environment. Information such @@ -37,6 +45,8 @@ #' @param metfrag_db_dir `character(1)`, a path to the directory which #' contains MetFrag databases. #' @param metfrag_jar `character(1)`, a path to MetFrag JAR file. +#' @param users_dir `character(1)`, a location on the server side +#' containing individual user directories. #' @param java_bin `character(1)`, a path to jave runtime #' (optional). We try to detect this. #' @param metfrag_max_proc `integer(1)`, maximum number of CPU cores @@ -47,18 +57,22 @@ envopts <- function(projects="", top_data_dir="", metfrag_db_dir="", metfrag_jar="", + users_dir="", java_bin=Sys.which("java"), metfrag_max_proc = parallel::detectCores()) { + res = mk_envopts() res = list(metfrag=list()) - class(res) = c("envopts","list") #Just to officially make it an - #object. - - check_dir_absent_nz(projects,what="projects-dir") + + check_dir_absent(projects,what="projects-dir") res$projects = projects - check_dir_absent_nz(top_data_dir,what="top-data-dir") + check_dir_absent(top_data_dir,what="top-data-dir") res$top_data_dir=top_data_dir - check_dir_absent_nz(metfrag_db_dir,what="mf-db-dir") + + check_dir_absent(users_dir,what="users-dir") + res$users_dir=users_dir + + check_dir_absent(metfrag_db_dir,what="mf-db-dir") res$metfrag$db_dir = norm_path(metfrag_db_dir) check_file_absent(metfrag_jar,what="mf-jar") @@ -94,8 +108,7 @@ get_envopts_fn <- function() { load_envopts <- function() { cfgfile = get_envopts_fn() - check_conf_absent(cfgfile) - readRDS(cfgfile) + if (file.exists(cfgfile)) readRDS(cfgfile) else mk_envopts() } diff --git a/R/errors.R b/R/errors.R index 32e69d91f72a1309bf08fd8e19d85863ca79240f..5d0f71a280e538abbcf10af42c28e9a13047866f 100644 --- a/R/errors.R +++ b/R/errors.R @@ -14,13 +14,18 @@ errc_conf_file_absent <- errorCondition("There is no config file in the project directory.",class="conf-file-absent") -check_notastring <- function(value,what) { - if (!is.character(value)) stop(errorCondition(paste0("The value (",str(value),") of, ",what," is not a character vector."),class=paste0(what,'-notastring'))) +check_notastring <- function(value, what, strict=F) { + cond = !is.character(value) + if (strict) cond = cond || is.na(value) + + if (cond) stop(errorCondition(paste0("The value (",value,") of, ",what," is not a character vector (or, it is, maybe, a missing value)."),class=paste0(what,'-notastring'))) } -check_dir_absent <- function(dir,what) { - check_notastring(dir,what) - if (nchar(dir)>0L && !dir.exists(dir)) stop(errorCondition(paste0("The ", what, " directory --- ", dir, "--- does not exist, or cannot be found."), class=paste0(what,'-absent'))) +check_dir_absent <- function(dir,what,strict=F) { + check_notastring(dir,what,strict=strict) + cond = !dir.exists(dir) + if (!strict) cond = cond && nchar(dir)>0L + if (cond) stop(errorCondition(paste0("The ", what, " directory --- ", dir, "--- does not exist, or cannot be found."), class=paste0(what,'-absent'))) } check_dir_absent_nz <- function(dir,what) { diff --git a/R/shiny-state.R b/R/shiny-state.R index 43c190d578f68f92ea3ad3d0230b1b665885ca7b..31bf6295557b63bf4f7e2056416e2f67ecd7aac8 100644 --- a/R/shiny-state.R +++ b/R/shiny-state.R @@ -251,8 +251,8 @@ unpack_app_state <- function(session,envopts,input,top_data_dir,project_path,pac gui$datatab$tag <- packed_state$datatab$tag gui$datatab$set <- packed_state$datatab$set x <- packed_state$paths$data - gui$paths$data <- if (length(x)>0 & nchar(x)>0) file.path(top_data_dir,basename(x)) - if (!dir.exists(gui$paths$data)) {warning("Data directory ", gui$paths$data, " does not exist. You must select one.")} + gui$paths$data = if (length(x)>0 && nchar(x)>0) basename(x) else "" + if (!dir.exists(file.path(top_data_dir,gui$paths$data))) {warning("Data directory ", gui$paths$data, " does not exist. You must select one.")} gui }) @@ -271,7 +271,7 @@ input2conf_setup <- function(input,gui,conf=list()) { conf$compounds$sets <- gui$compounds$sets - conf$paths$data = gui$paths$data + conf$paths$data = basename(gui$paths$data) conf } @@ -362,7 +362,6 @@ app_state2state <- function(input,gui,envopts,m=NULL) { m$conf = input2conf_setup(input=input, gui=gui) - m = app_update_conf(input=input, gui=gui, envopts=envopts, @@ -373,33 +372,10 @@ app_state2state <- function(input,gui,envopts,m=NULL) { "metfrag"), m=m) - ## m$conf = input2conf_setup(input,gui=gui) - ## m$conf = input2conf_prescreen(input=input,conf=m$conf) - ## m$conf = input2conf_figures(input,conf=m$conf) - ## m$conf = input2conf_report(input,conf=m$conf) - ## m$conf = input2conf_metfrag(input,conf=m$conf) - - - - ## m$run <- new_runtime_state(project=gui$paths$project, - ## envopts = envopts, - ## conf=m$conf) - - - m$input$tab$mzml <- gui2datatab(gui) + m$input$tab$mzml = gui2datatab(gui) m } - - - - -gen_comp_state <- function(input,gui) { - m <- app_state2state(input,gui) - run(m=m,phases=c("setup","mk_comp_tab")) - -} - get_sets <- function(gui) { fn_sets <- file.path(gui$paths$project,gui$compounds$sets) diff --git a/R/shiny-ui-base.R b/R/shiny-ui-base.R index 007489ed254cf3e34437e7b2f95c059280fa0329..710e3d8a9d0393a44a07f2eb3a852ac915e17c72 100644 --- a/R/shiny-ui-base.R +++ b/R/shiny-ui-base.R @@ -708,24 +708,6 @@ mk_shinyscreen_server <- function(projects,init) { }) - rf_setup_state <- reactive({ - rvs$gui$project - rvs$gui$datatab$file - rvs$gui$datatab$tag - rvs$gui$datatab$adduct - rvs$gui$datatab$set - rvs$gui$paths$data - rvs$gui$paths$project - isolate({ - req(pre_setup_val_block(rvs$gui)) - q = app_state2state(input,rvs$gui,envopts=init$envopts) - - }) - run(m=q,phases=c("setup","comptab")) - }) - - - ## REACTIVE FUNCTIONS: COMPOUND INDEX rf_get_cindex <- reactive({ @@ -945,7 +927,7 @@ mk_shinyscreen_server <- function(projects,init) { updateSelectInput(session = session, inputId = "top_data_dir_list", selected = basename(top_data_dir), - choices = list.dirs(path = init$top_data_dir, + choices = list.dirs(path = init$envopts$top_data_dir, full.names = F, recursive = F)) }) @@ -964,7 +946,7 @@ mk_shinyscreen_server <- function(projects,init) { observeEvent(rtimer1000(),{ projects = rv_projects() - curr_projects = list.dirs(path=init$projects, full.names = F, recursive = F) + curr_projects = list.dirs(path=init$envopts$projects, full.names = F, recursive = F) if (length(union(curr_projects,projects)) != length(intersect(curr_projects,projects))) { updateSelectInput(session=session, inputId="proj_list", @@ -983,7 +965,7 @@ mk_shinyscreen_server <- function(projects,init) { ## loaded. Everything else works off rvs$m and rvs$gui. wd = input$proj_list req(!is.null(wd) && !is.na(wd) && nchar(wd)>0) - fullwd = file.path(init$projects,wd) + fullwd = file.path(init$envopts$projects,wd) check_dir_absent(fullwd,what="project") ## Load saved state if existing, create if it does not. fn_packed_state = file.path(fullwd,FN_GUI_STATE) @@ -994,7 +976,7 @@ mk_shinyscreen_server <- function(projects,init) { rvs$gui = unpack_app_state(session=session, envopt=init$envopts, input=input, - top_data_dir=init$top_data_dir, + top_data_dir=init$envopts$top_data_dir, project_path=fullwd, packed_state=pack) ## Load computational state. @@ -1050,7 +1032,7 @@ mk_shinyscreen_server <- function(projects,init) { observeEvent(input$sel_data_dir_b,{ data_dir = input$top_data_dir_list req(isTruthy(data_dir)) - rvs$gui$paths$data = file.path(init$top_data_dir, data_dir) + rvs$gui$paths$data = file.path(init$envopts$top_data_dir, data_dir) message("Selected data dir:",rvs$gui$paths$data) @@ -1154,7 +1136,10 @@ mk_shinyscreen_server <- function(projects,init) { isolate({ if (rv_extr_flag()) { rv_extr_flag(F) - rvs$m = run(m=rvs$m,phases=c("setup","comptab","extract")) + rvs$m = run(m=rvs$m, + top_data_dir=init$envopts$top_data_dir, + metfrag_db_dir=init$envopts$metfrag$db_dir, + phases=c("setup","comptab","extract")) rvs$status$is_extracted_stat = "Yes." rvs$status$is_qa_stat = "No." fn_c_state = file.path(rvs$m$run$paths$project, @@ -1202,7 +1187,10 @@ mk_shinyscreen_server <- function(projects,init) { shinymsg("Prescreening started. Please wait.") rv_presc_flag(F) ## If user changed prescreening params. - rvs$m = run(m=rvs$m,phases="prescreen") + rvs$m = run(m=rvs$m, + top_data_dir=init$envopts$top_data_dir, + metfrag_db_dir=init$envopts$metfrag$db_dir, + phases="prescreen") rvs$status$is_qa_stat = "Yes." shinymsg("Prescreening has been completed.") } diff --git a/R/state.R b/R/state.R index 466f597d1090978f7e195a29118cc0d433fe4d83..54450c7a3e6878383eb64d732f1bac6d69a2f055 100644 --- a/R/state.R +++ b/R/state.R @@ -54,21 +54,6 @@ runtime_from_conf <- function(run,conf) { run } -reinit_run_data <- function(projects,top_data_dir,project,run=NULL) { - if (!is.null(run)) { - olddata <- run$paths$data - oldproject <- basename(run$paths$project) - if (project != oldproject) { - message("Project has been renamed to: ",project) - message("Old project name was: ", oldproject) - } - if (isTruthy(olddata)) run$paths$data <- file.path(top_user_dir,basename(olddata)) - } - run$project <- project - run$paths$project <- file.path(projects,project) - run -} - #' @title Create Runtime Configuration #' @details This is a part of the configuration that can only be #' diagnosed at runtime. @@ -163,9 +148,9 @@ new_runtime_state <- function(project,envopts,conf=NULL) { } ## Check if all OK with project name. - check_notastring(project,"project") - project_path = norm_path(project) - check_dir_absent(project_path,"project") + check_notastring(project,"project",strict=T) + project_path = file.path(envopts$projects,basename(project)) + check_dir_absent(project_path,"project_path", strict=T) project = basename(project) run = list() run$project = project @@ -176,7 +161,7 @@ new_runtime_state <- function(project,envopts,conf=NULL) { run$paths$data = norm_path(file.path(envopts$top_data_dir,conf$paths$data)) - check_dir_absent(run$paths$data,"data-dir") + check_dir_absent(run$paths$data,"data-dir", strict=T) if (!is.null(conf)) runtime_from_conf(run=run,conf=conf) else run diff --git a/man/app.Rd b/man/app.Rd index a8967036119890a602e80afeee3afa7889f10dcb..9c2b84dd46b6fbc9c89cd212d71f0b7deff22b31 100644 --- a/man/app.Rd +++ b/man/app.Rd @@ -4,19 +4,10 @@ \alias{app} \title{app} \usage{ -app( - projects = getwd(), - top_data_dir = getwd(), - shiny_args = list(launch.browser = F), - render_args = NULL -) +app(envopts, shiny_args = list(launch.browser = F), render_args = NULL) } \arguments{ -\item{projects}{\code{character(1)}, a location on the server side -containing project directories.} - -\item{top_data_dir}{\code{character(1)}, a location on the server side -containing data directories.} +\item{envopts}{\code{envopts}. Shinyscreen environment options.} \item{shiny_args}{\code{list}, optional list of arguments conveyed to \code{rmarkdown::run} \code{shiny_args} argument.} @@ -24,9 +15,6 @@ containing data directories.} \item{render_args}{\code{list}, optional list of arguments conveyed to \code{rmarkdown::run} \code{render_args} argument.} -\item{metfrag_db_dir}{\code{character(1)}, a location on the server side -containing MetFrag databases.} - \item{metfrag_runtime}{\code{character(1)}, a location on the server side of the MetFrag jar file.} } diff --git a/man/envopts.Rd b/man/envopts.Rd index 336ba3cceb0db73dac2b7b02bafaf7de877fe2d6..38c21b2845b82bb0325fd5b4ab0b143a70921ea7 100644 --- a/man/envopts.Rd +++ b/man/envopts.Rd @@ -5,16 +5,34 @@ \title{Create a \code{envopts} Object} \usage{ envopts( + projects = "", + top_data_dir = "", metfrag_db_dir = "", metfrag_jar = "", + users_dir = "", java_bin = Sys.which("java"), metfrag_max_proc = parallel::detectCores() ) } \arguments{ -\item{metfrag_db_dir}{\code{character(1)}, a path to the directory which contains MetFrag databases} +\item{projects}{\code{character(1)}, a directory which contains all +shinyscreen projects directories. A single project directory +contains input and output files.} -\item{metfrag_jar}{\code{character(1)}, a path to MetFrag JAR file} +\item{top_data_dir}{\code{character(1)}, a directory which contains all +\code{data} directories. A single \code{data} directory contains \code{mzML} +spectrometry data files.} + +\item{metfrag_db_dir}{\code{character(1)}, a path to the directory which +contains MetFrag databases.} + +\item{metfrag_jar}{\code{character(1)}, a path to MetFrag JAR file.} + +\item{users_dir}{\code{character(1)}, a location on the server side +containing individual user directories.} + +\item{java_bin}{\code{character(1)}, a path to jave runtime +(optional). We try to detect this.} \item{metfrag_max_proc}{\code{integer(1)}, maximum number of CPU cores available for MetFrag.} @@ -26,7 +44,7 @@ An \code{envopts} object. Create a \code{envopts} Object } \details{ -A \code{envopts} object is Shinyscreen way to store settings +An \code{envopts} object is Shinyscreen way to store settings related to a specific computing environment. Information such as the run time path to a MetFrag JAR will vary from one to another setup and we need to convey this to the \code{shinyscreen} diff --git a/man/init.Rd b/man/init.Rd index b45624b9db07ee044fcacc1df88925b65e632556..399987dceccdc866225a79f73db11ae3bc41b6f8 100644 --- a/man/init.Rd +++ b/man/init.Rd @@ -5,30 +5,57 @@ \title{Initialise Shinyscreen Configuration} \usage{ init( + projects = "", + top_data_dir = "", metfrag_db_dir = "", metfrag_jar = "", java_bin = Sys.which("java"), - metfrag_max_proc = parallel::detectCores() + metfrag_max_proc = parallel::detectCores(), + merge = T, + save = F ) } \arguments{ -\item{metfrag_db_dir}{\code{character(1)}, a path to the directory which contains MetFrag databases} +\item{projects}{\code{character(1)}, a directory which contains all +shinyscreen projects directories. A single project directory +contains input and output files.} -\item{metfrag_jar}{\code{character(1)}, a path to MetFrag JAR file} +\item{top_data_dir}{\code{character(1)}, a directory which contains all +\code{data} directories. A single \code{data} directory contains \code{mzML} +spectrometry data files.} + +\item{metfrag_db_dir}{\code{character(1)}, a path to the directory which +contains MetFrag databases.} + +\item{metfrag_jar}{\code{character(1)}, a path to MetFrag JAR file.} + +\item{java_bin}{\code{character(1)}, a path to jave runtime +(optional). We try to detect this.} \item{metfrag_max_proc}{\code{integer(1)}, maximum number of CPU cores available for MetFrag.} + +\item{merge}{\code{logical(1)}, optional. If T, merge with saved +configuration.} + +\item{save}{\code{logical(1)}, optional. If T, save configuration, +otherwise just return the Shinyscreen environment options.} } \value{ -Nothing. +An \code{envopts} object. } \description{ Initialise Shinyscreen Configuration } \details{ This function is used to inform \code{shinyscreen} about the -working environment. It is only necessary to call it once. The -parameters will be memorised. +working environment. If argument \code{save} is T, the configuration +will be memorised. Subsequent calls to \code{init} without arguments +will just load the configuration. If \code{merge} argument is T, the +resulting configuration object is going to be a merge between +the new parameters and the memorised ones. Those arguments not +mentioned in the argument list will be remembered from the save +config. } \author{ Todor Kondić diff --git a/man/metfrag.Rd b/man/metfrag.Rd new file mode 100644 index 0000000000000000000000000000000000000000..916d5e4f666fe2f0708a62dbe45fc4419752ba83 --- /dev/null +++ b/man/metfrag.Rd @@ -0,0 +1,20 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/api.R +\name{metfrag} +\alias{metfrag} +\title{Run MetFrag} +\usage{ +metfrag(m) +} +\arguments{ +\item{m}{\code{state}, a state object.} +} +\value{ +m +} +\description{ +Run MetFrag +} +\author{ +Todor Kondić +} diff --git a/man/run.Rd b/man/run.Rd new file mode 100644 index 0000000000000000000000000000000000000000..0c376a2be2a6532e4e3655f722b286ee8a718edf --- /dev/null +++ b/man/run.Rd @@ -0,0 +1,26 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/api.R +\name{run} +\alias{run} +\title{Run Shinyscreen Pipeline} +\usage{ +run(envopts, project = "", m = NULL, phases = NULL, help = F) +} +\arguments{ +\item{envopts}{\code{envopts}, an \code{envopts} object.} + +\item{project}{\code{character(1)}, a directory containing input data.} + +\item{m}{\code{state}, a Shinyscreen state.} + +\item{phases}{\code{character(n)}, a character vector of Shinyscreen +phases.} + +\item{help}{\code{logical(1)}, print help?} +} +\description{ +Run Shinyscreen Pipeline +} +\details{ +TODO. +} diff --git a/man/serve.Rd b/man/serve.Rd index 531f87eddf9a519154f83c34f56727ad2f0496ed..c9e16ed35e31deda862499472d3007ad139c2738 100644 --- a/man/serve.Rd +++ b/man/serve.Rd @@ -4,14 +4,10 @@ \alias{serve} \title{serve} \usage{ -serve(top_data_dir, usersdir, user, host = "0.0.0.0", port = 7777) +serve(envopts, user, host = "0.0.0.0", port = 7777) } \arguments{ -\item{top_data_dir}{\code{character(1)}, a location on the server side -containing data directories.} - -\item{usersdir}{\code{character(1)}, a location on the server side -containing individual user directories.} +\item{envopts}{\code{envopts}, an \code{envopts} object.} \item{user}{\code{character(1)}, subdir of usersdir.} @@ -20,6 +16,12 @@ served.} \item{port}{\code{integer(1)}, optional, port at which the page is served.} + +\item{top_data_dir}{\code{character(1)}, a location on the server side +containing data directories.} + +\item{metfrag_db_dir}{\code{character(1)}, a location on the server side +containing MetFrag DBs.} } \value{ Nada.