Skip to content
Snippets Groups Projects
Commit 3dd2b609 authored by Todor Kondic's avatar Todor Kondic
Browse files

Extend sw.do to use parallel features

* R/run.R(sw.do): New argument.
  [proc]

* man/sw.do.Rd: Update docs.
parent ba39c920
No related branches found
No related tags found
No related merge requests found
......@@ -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
......
......@@ -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.
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment