comparison 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
comparison
equal deleted inserted replaced
4:c10824185547 5:b8d4129dd2a6
192 cat("\t\tCOMPUTE\n\n") 192 cat("\t\tCOMPUTE\n\n")
193 193
194 #runGC accept either a list of files a zip folder or an xset object from xcms.xcmsSet tool 194 #runGC accept either a list of files a zip folder or an xset object from xcms.xcmsSet tool
195 #From xset is an .RData file necessary to use the xcmsSet object generated by xcms.xcmsSet given by previous tools 195 #From xset is an .RData file necessary to use the xcmsSet object generated by xcms.xcmsSet given by previous tools
196 if (!is.null(args$singlefile_galaxyPath)){ 196 if (!is.null(args$singlefile_galaxyPath)){
197 cat("Loading datas from XCMS file(s)...\n") 197 cat("Loading datas from XCMS files...\n")
198 load(args$singlefile_galaxyPath) 198 load(args$singlefile_galaxyPath)
199 199
200 #Transform XCMS object if needed 200 #Transform XCMS object if needed
201 if(!exists("xset")) { 201 if(!exists("xset")) {
202 if(exists("xdata")) { 202 if(exists("xdata")) {
204 } else { 204 } else {
205 error_message="no xset and no xdata... Probably a problem" 205 error_message="no xset and no xdata... Probably a problem"
206 print(error_message) 206 print(error_message)
207 stop(error_message) 207 stop(error_message)
208 } 208 }
209 }
210 #Verify that there are more than 1 file (can't run metaMS on only 1 file)
211 if(length(rownames(xdata@phenoData)) < 2){
212 error_message="You need more than 1 file to be able to run metaMS"
213 print(error_message)
214 stop(error_message)
209 } 215 }
210 216
211 #xset from xcms.xcmsSet is not well formatted for metaMS this function do the formatting 217 #xset from xcms.xcmsSet is not well formatted for metaMS this function do the formatting
212 if (class(xset)=="xcmsSet"){ 218 if (class(xset)=="xcmsSet"){
213 if (length(xset@rt$raw)>1){ 219 if (length(xset@rt$raw)>1){
251 xsetCAM <- xset.l 257 xsetCAM <- xset.l
252 } 258 }
253 259
254 #default settings for GC from Wehrens et al 260 #default settings for GC from Wehrens et al
255 cat("Process runGC with metaMS package...\n\n") 261 cat("Process runGC with metaMS package...\n\n")
256 print(str(TSQXLS.GC)) 262 print(str(TSQXLS.GC))
257 resGC<-runGC(xset=xsetCAM,settings=TSQXLS.GC, rtrange=rtrange, DB= DBgc, removeArtefacts = TRUE, 263 resGC<-runGC(xset=xsetCAM,settings=TSQXLS.GC, rtrange=rtrange, DB= DBgc, removeArtefacts = TRUE,
258 findUnknowns = TRUE, returnXset = TRUE, RIstandards = RIarg, nSlaves = nSlaves) 264 findUnknowns = TRUE, returnXset = TRUE, RIstandards = RIarg, nSlaves = nSlaves)
259 } else { 265 } else {
260 if(args$settings == "User_defined") { 266 if(args$settings == "User_defined") {
261 settingslist=GALAXY.GC 267 settingslist=GALAXY.GC
327 #saving R data in .Rdata file to save the variables used in the present tool 333 #saving R data in .Rdata file to save the variables used in the present tool
328 objects2save <- c("resGC", "xset", "singlefile", "zipfile", "DBgc") 334 objects2save <- c("resGC", "xset", "singlefile", "zipfile", "DBgc")
329 save(list = objects2save[objects2save %in% ls()], file = "runGC.RData") 335 save(list = objects2save[objects2save %in% ls()], file = "runGC.RData")
330 336
331 cat("\nEnd of '", modNamC, "' Galaxy module call: ", as.character(Sys.time()), "\n", sep = "") 337 cat("\nEnd of '", modNamC, "' Galaxy module call: ", as.character(Sys.time()), "\n", sep = "")
338
339 #WARNING if user has CDF files (not yet good for plotting)
340 files <- paste("./",names(singlefile),sep="")
341 if(MSnbase:::isCdfFile(files)){
342 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"
343 warning(warning_message)
344 cat(paste("\n","/!\\Warning/!\\",warning_message,sep="\n"))
345 }