From 04386f6487d23f137b1a6b989506cb66d435aa51 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Todor=20Kondi=C4=87?= <todor.kondic@uni.lu>
Date: Mon, 17 Jun 2019 14:43:42 +0200
Subject: [PATCH] Update vectorised and parallel versions of sw.single with
 lastStep

* R/mix.R(p.sw,v): New argument.
  [lastStep]

* man/p.sw.Rd: New function documentation.

* man/v.Rd: Update.
---
 R/mix.R     |  8 +++++---
 man/p.sw.Rd | 39 +++++++++++++++++++++++++++++++++++++++
 man/v.Rd    |  4 +++-
 3 files changed, 47 insertions(+), 4 deletions(-)
 create mode 100644 man/p.sw.Rd

diff --git a/R/mix.R b/R/mix.R
index fdbbae3..1b91299 100644
--- a/R/mix.R
+++ b/R/mix.R
@@ -194,10 +194,11 @@ mb.single<-function(mb,infodir,fn_stgs) {
 ##' @param mode Same as in msmsRead.
 ##' @param readMethod Same as in msmsRead.
 ##' @param archdir Name of the archive.
+##' @param lastStep The last step of the spectral workflow. 
 ##' @return A named list of spectral workspaces. The names are derived
 ##'     from data filenames.
 ##' @author Todor Kondić
-v<-function(fn_data,stgs_alist,wd,fn_cmpd_list,mode,readMethod="mzR",archdir="archive") {
+v<-function(fn_data,stgs_alist,wd,fn_cmpd_list,mode,readMethod="mzR",archdir="archive",lastStep=8) {
     f<-Vectorize(single.sw,vectorize.args=c("wd","fn_data","stgs_alist"),SIMPLIFY=F)
     x<-f(fn_data,stgs_alist,wd,fn_cmpd_list,mode,readMethod=readMethod,archdir=archdir)
     names(x)<-basename(fn_data)
@@ -215,13 +216,14 @@ v<-function(fn_data,stgs_alist,wd,fn_cmpd_list,mode,readMethod="mzR",archdir="ar
 ##' @param mode Same as in msmsRead.
 ##' @param readMethod Same as in msmsRead.
 ##' @param archdir Name of the archive.
+##' @param lastStep The last step in spectral workflow.
 ##' @param cl Cluster.
 ##' @return A named list of spectral workspaces. The names are derived
 ##'     from data filenames.
 ##' @author Todor Kondić
-p.sw<-function(fn_data,stgs_alist,wd,fn_cmpd_list,mode,readMethod="mzR",archdir="archive",cl=NULL) {
+p.sw<-function(fn_data,stgs_alist,wd,fn_cmpd_list,mode,readMethod="mzR",archdir="archive",lastStep=8,cl=NULL) {
     f<-function(fn,stgs,wd) {
-        single.sw(fn,stgs,wd,fn_cmpd_list,mode,readMethod,archdir)
+        single.sw(fn,stgs,wd,fn_cmpd_list,mode,readMethod,archdir,lastStep)
     }
         
     x<-parallel::clusterMap(cl,f,fn_data,stgs_alist,wd)
diff --git a/man/p.sw.Rd b/man/p.sw.Rd
new file mode 100644
index 0000000..c5608c9
--- /dev/null
+++ b/man/p.sw.Rd
@@ -0,0 +1,39 @@
+% Generated by roxygen2: do not edit by hand
+% Please edit documentation in R/mix.R
+\name{p.sw}
+\alias{p.sw}
+\title{Parallel Spectral Workflow.}
+\usage{
+p.sw(fn_data, stgs_alist, wd, fn_cmpd_list, mode, readMethod = "mzR",
+  archdir = "archive", lastStep = 8, cl = NULL)
+}
+\arguments{
+\item{fn_data}{A sequence of mzML input files.}
+
+\item{stgs_alist}{A list of named list of settings, or a list of
+filenames of YAML files containing the settings.}
+
+\item{wd}{The list of working directories.}
+
+\item{fn_cmpd_list}{The compound list characterising the mixtures.}
+
+\item{mode}{Same as in msmsRead.}
+
+\item{readMethod}{Same as in msmsRead.}
+
+\item{archdir}{Name of the archive.}
+
+\item{lastStep}{The last step in spectral workflow.}
+
+\item{cl}{Cluster.}
+}
+\value{
+A named list of spectral workspaces. The names are derived
+from data filenames.
+}
+\description{
+Interface to parallel spectral workflow.
+}
+\author{
+Todor Kondić
+}
diff --git a/man/v.Rd b/man/v.Rd
index e7a38b3..29e840e 100644
--- a/man/v.Rd
+++ b/man/v.Rd
@@ -5,7 +5,7 @@
 \title{Vectorised Spectral Workflow.}
 \usage{
 v(fn_data, stgs_alist, wd, fn_cmpd_list, mode, readMethod = "mzR",
-  archdir = "archive")
+  archdir = "archive", lastStep = 8)
 }
 \arguments{
 \item{fn_data}{A sequence of mzML input files.}
@@ -22,6 +22,8 @@ filenames of YAML files containing the settings.}
 \item{readMethod}{Same as in msmsRead.}
 
 \item{archdir}{Name of the archive.}
+
+\item{lastStep}{The last step of the spectral workflow.}
 }
 \value{
 A named list of spectral workspaces. The names are derived
-- 
GitLab