From a2f07acf62468bc3b7c1bcd394091ead0a58cfb2 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Todor=20Kondi=C4=87?= <todor.kondic@uni.lu>
Date: Wed, 19 Jun 2019 14:13:34 +0200
Subject: [PATCH] FIX Test with full path

* R/mix.R(p.sw,v): Try with full path
---
 R/mix.R | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/R/mix.R b/R/mix.R
index f4994d9..1516d5a 100644
--- a/R/mix.R
+++ b/R/mix.R
@@ -202,15 +202,17 @@ mb.single<-function(mb,infodir,fn_stgs) {
 ##' @author Todor Kondić
 v<-function(fn_data,stgs_alist,wd,fn_cmpd_list,mode,readMethod="mzR",archdir="archive",lastStep=8,combine=F) {
     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(combdir,archdir)
+        archdir<-file.path(rootdir,combdir,archdir)
         no_drama_mkdir(combdir)
         no_drama_mkdir(archdir)
         fn_arch<-file.path(archdir,paste(fn_data,".archive",sep=''))
+        print((paste("Save in archive:",fn_arch)))
         RMassBank::msmsWorkflow(zz, steps=8, mode=mode, archivename = fn_arch)
     } else {
         z<-f(fn_data,stgs_alist,wd,fn_cmpd_list,mode,readMethod=readMethod,archdir=archdir,lastStep=lastStep)
@@ -247,15 +249,17 @@ p.sw<-function(fn_data,stgs_alist,wd,fn_cmpd_list,mode,readMethod="mzR",archdir=
     }
 
     if (combine) {
+        rootdir <- getwd()
         z<-parallel::clusterMap(cl,fcomb,fn_data,stgs_alist,wd)
         names(z)<-basename(fn_data)
         zz<-RMassBank::combineMultiplicities(z)
         
         combdir<-"combined"
-        archdir<-file.path(combdir,archdir)
+        archdir<-file.path(rootdir,combdir,archdir)
         no_drama_mkdir(combdir)
         no_drama_mkdir(archdir)
         fn_arch<-file.path(archdir,paste(fn_data,".archive",sep=''))
+        print((paste("Save in archive:",fn_arch)))
         RMassBank::msmsWorkflow(zz, steps=8, mode=mode, archivename = fn_arch)
     } else {
         z<-parallel::clusterMap(cl,fnocomb,fn_data,stgs_alist,wd)
-- 
GitLab