diff metaMS_runGC.r @ 5:b8d4129dd2a6 draft

planemo upload for repository https://github.com/workflow4metabolomics/metaMS commit c7a518686137f6d62b7415715152e8d5a9953ed7
author yguitton
date Fri, 06 Sep 2019 06:09:10 -0400
parents c10824185547
children 286ebb9f6e84
line wrap: on
line diff
--- a/metaMS_runGC.r	Wed Jul 03 05:14:32 2019 -0400
+++ b/metaMS_runGC.r	Fri Sep 06 06:09:10 2019 -0400
@@ -194,7 +194,7 @@
 #runGC accept either a list of files a zip folder or an xset object from xcms.xcmsSet tool
 #From xset is an .RData file necessary to use the xcmsSet object generated by xcms.xcmsSet given by previous tools
 if (!is.null(args$singlefile_galaxyPath)){
-    cat("Loading datas from XCMS file(s)...\n")
+    cat("Loading datas from XCMS files...\n")
     load(args$singlefile_galaxyPath)
     
     #Transform XCMS object if needed
@@ -207,6 +207,12 @@
             stop(error_message)
         }
     }
+    #Verify that there are more than 1 file (can't run metaMS on only 1 file)
+    if(length(rownames(xdata@phenoData)) < 2){
+        error_message="You need more than 1 file to be able to run metaMS"
+        print(error_message)
+        stop(error_message)
+    }
 
     #xset from xcms.xcmsSet is not well formatted for metaMS this function do the formatting
     if (class(xset)=="xcmsSet"){
@@ -253,7 +259,7 @@
         
         #default settings for GC from Wehrens et al
         cat("Process runGC with metaMS package...\n\n")
-        print(str(TSQXLS.GC))  
+        print(str(TSQXLS.GC))
         resGC<-runGC(xset=xsetCAM,settings=TSQXLS.GC, rtrange=rtrange, DB= DBgc, removeArtefacts = TRUE, 
                     findUnknowns = TRUE, returnXset = TRUE, RIstandards = RIarg, nSlaves = nSlaves)
     } else {
@@ -328,4 +334,12 @@
 objects2save <- c("resGC", "xset", "singlefile", "zipfile", "DBgc")
 save(list = objects2save[objects2save %in% ls()], file = "runGC.RData")
 
-cat("\nEnd of '", modNamC, "' Galaxy module call: ", as.character(Sys.time()), "\n", sep = "")
\ No newline at end of file
+cat("\nEnd of '", modNamC, "' Galaxy module call: ", as.character(Sys.time()), "\n", sep = "")
+
+#WARNING if user has CDF files (not yet good for plotting)
+files <- paste("./",names(singlefile),sep="")
+if(MSnbase:::isCdfFile(files)){
+    warning_message <- "You have CDF files, for the moment you can't obtain plot after runGC! A new update will follow with the good correction"
+    warning(warning_message)
+    cat(paste("\n","/!\\Warning/!\\",warning_message,sep="\n"))
+}
\ No newline at end of file