##' @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="",
m=NULL,
phases=NULL,
help=F){
## Get system-wide config.
eo=load_envopts()
all_phases=list(setup=setup_phase,
...
...
@@ -40,7 +52,14 @@ run <- function(project="",m=NULL,phases=NULL,help=F) {
stop("Aborting.")
}
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)elseif(!is.null(m))melsestop("(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!
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_nz<-function(dir,what){
check_notastring(dir,what)
if(nchar(dir)>0L){
check_dir_absent(dir,what)
}
}
check_file_absent<-function(file,what){
check_notastring(file,what)
if(nchar(file)>0L&&!file.exists(file))stop(errorCondition(paste0("The ",what," file --- ",file,"--- does not exist, or cannot be found."),class=paste0(what,'-absent')))
}
check_file_absent_nz<-function(file,what){
check_notastring(file,what)
if(nchar(file)>0L){
check_file_absent(file,what)
}
}
check_not_one<-function(value,what){
if(length(value)!=1L)stop(errorCondition(paste0("Size of",what," is not one."),class=paste0(what,'-not-one')))