From e1e2ab4c24e7e0791c02def89a1ecbdeac03a1fa Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Todor=20Kondi=C4=87?= <todor.kondic@uni.lu>
Date: Fri, 17 May 2019 13:43:00 +0200
Subject: [PATCH] Complete the single mixture function

* mix.R

** rmbmix.single

   Add the archive directory argument. Also, perform steps 2-8 of the
   standard workflow.
---
 mix.R | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/mix.R b/mix.R
index 6c2ccc6..8649b49 100644
--- a/mix.R
+++ b/mix.R
@@ -46,10 +46,9 @@ rmbmix.gen_comp_list<-function(src_fn,dest_fn) {
 ## fn_cmpd_list is the compound list. Argument wd is the scratch dir
 ## to hold generated ini files and the like. Arguments mode and
 ## readMethod are the same as in msmsRead.
-rmbmix.single<-function(fn_data,sett_alist,fn_cmpd_list,wd,mode,readMethod="mzR") {
+rmbmix.single<-function(fn_data,sett_alist,fn_cmpd_list,wd,mode,readMethod="mzR",archdir="archive") {
     
     require(RMassBank)
-
     ## Generate settings file and load.
     sfn<-file.path(wd,paste(fn_data,".ini",sep=''))
     rmbmix.mk_sett_file(sett_alist,sfn)
@@ -67,8 +66,10 @@ rmbmix.single<-function(fn_data,sett_alist,fn_cmpd_list,wd,mode,readMethod="mzR"
 
     ## Make empty workspace.
     w <- newMsmsWorkspace()
-    #w <-msmsRead(w,filetable=fn_table,readMethod="mzR",mode=mode)
     ## Run the workflow.
     message(paste("Reading in file:",fn_data))
     w <-msmsRead(w,filetable=fn_table,readMethod="mzR",mode=mode)
+    if (!dir.exists(archdir)) dir.create(archdir)
+    fn_arch<-file.path(archdir,paste(fn_data,".archive",sep=''))
+    msmsWorkflow(w, mode=mode, steps=c(2:8),archivename=fn_arch)
 }
-- 
GitLab