From 51db456e7af7bf64db346668a664529cc43a1738 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Todor=20Kondi=C4=87?= <todor.kondic@uni.lu>
Date: Wed, 19 Jun 2019 16:59:39 +0200
Subject: [PATCH] Generate combined settings

---
 R/mix.R | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/R/mix.R b/R/mix.R
index 8594f4d..168a262 100644
--- a/R/mix.R
+++ b/R/mix.R
@@ -217,19 +217,26 @@ mb.single<-function(mb,infodir,fn_stgs) {
 ##'     from data filenames.
 ##' @author Todor Kondić
 v<-function(fn_data,stgs_alist,wd,fn_cmpd_list,mode,readMethod="mzR",archdir="archive",lastStep=8,combine=F) {
+    idir<-function(n) file.path(rdir,stripext(n))
     f<-Vectorize(single.sw,vectorize.args=c("wd","fn_data","stgs_alist"),SIMPLIFY=F)
     rootdir <- getwd()
     if (combine) {
         z<-f(fn_data,stgs_alist,wd,fn_cmpd_list,mode,readMethod=readMethod,archdir=archdir,lastStep=7)
         names(z)<-basename(fn_data)
         zz<-RMassBank::combineMultiplicities(z)
+
         combdir<-"combined"
         archdir<-file.path(rootdir,combdir,archdir)
         no_drama_mkdir(combdir)
         no_drama_mkdir(archdir)
         fn_arch<-file.path(archdir,"archive")
+        fn_comb_stgs <- file.path(rootdir,combdir,paste(combdir,".mzML.ini",sep=''))
+        ddirs <- sapply(names(z),idir)
+        stgs_fls <- sapply(ddirs,function(x) file.path(x,paste(x,".mzML.ini",sep='')))
+        mk_combine_file(stgs_fls,fn_comb_stgs)
+
         res<-list(RMassBank::msmsWorkflow(zz, steps=8, mode=mode, archivename = fn_arch))
-        names(res)<-paste(combdir,".yml",sep='') #Clearly a hack.
+        names(res)<-paste(combdir,".mzML",sep='') #Clearly a hack.
         res
     } else {
         z<-f(fn_data,stgs_alist,wd,fn_cmpd_list,mode,readMethod=readMethod,archdir=archdir,lastStep=lastStep)
-- 
GitLab