diff --git a/R/run.R b/R/run.R index 755d4e73947a76e730268eea592731895d6954f6..38f9a02eb2f1dd68aea261209c4487889fa6bd8f 100644 --- a/R/run.R +++ b/R/run.R @@ -31,16 +31,22 @@ attch<-function(...) paste(...,sep='') ##' @param rdir The root data directory. ##' @param combine If TRUE, use combineMultiplicies to merge ##' workspaces corresponding to different collisional energies. +##' @param proc Split work between this amount of processes. If FALSE +##' (or, 1), run sequential. ##' @return A named list of msmsWorkspace objects. ##' @author Todor Kondić ##' @export -sw.do<-function(fn_data,fn_cmpd_list,mode,rdir=".",combine=F) { - +sw.do<-function(fn_data,fn_cmpd_list,mode,rdir=".",combine=F,proc=F) { no_drama_mkdir(rdir) wdirs<-sapply(basename(fn_data),function(nm) file.path(rdir,stripext(nm))) sapply(wdirs,no_drama_mkdir) stgs<-sapply(basename(wdirs),function (nm) paste(nm,"yml",sep='.')) - v(fn_data,stgs,wdirs,fn_cmpd_list,mode,combine=combine) + cl<-parallel::makeCluster(proc) + if (proc) { + p.sw(fn_data,stgs,wdirs,fn_cmpd_list,mode,combine=combine,cl=cl) + } else { + v(fn_data,stgs,wdirs,fn_cmpd_list,mode,combine=combine) + } } ##' Creates and prepares mbWorkspace objects before the full workflow diff --git a/man/sw.do.Rd b/man/sw.do.Rd index bb2a0494d0bc2ef45c467725a774af74c197583e..a025d6c3c00957a17650cd9bd59bf124e82bf9ef 100644 --- a/man/sw.do.Rd +++ b/man/sw.do.Rd @@ -4,7 +4,7 @@ \alias{sw.do} \title{Perform MassBank Workflow on Multiple Compound Mixtures} \usage{ -sw.do(fn_data, fn_cmpd_list, mode, rdir = ".", combine = F) +sw.do(fn_data, fn_cmpd_list, mode, rdir = ".", combine = F, proc = F) } \arguments{ \item{fn_data}{List of mzML data filenames to be processed.} @@ -17,6 +17,9 @@ sw.do(fn_data, fn_cmpd_list, mode, rdir = ".", combine = F) \item{combine}{If TRUE, use combineMultiplicies to merge workspaces corresponding to different collisional energies.} + +\item{proc}{Split work between this amount of processes. If FALSE +(or, 1), run sequential.} } \value{ A named list of msmsWorkspace objects.