Mercurial > repos > yguitton > metams_rungc
comparison metams.r @ 3:c75532b75ba1 draft
Uploaded version 2.1.1
author | yguitton |
---|---|
date | Thu, 08 Jun 2017 11:53:35 -0400 |
parents | 142fbe102a9d |
children |
comparison
equal
deleted
inserted
replaced
2:8e1b99a7d733 | 3:c75532b75ba1 |
---|---|
1 #!/usr/local/public/bin/Rscript --vanilla --slave --no-site-file | 1 #!/usr/local/public/bin/Rscript --vanilla --slave --no-site-file |
2 # metams.r version="2.0" | 2 # metams.r version="2.1.1" |
3 #created by Yann GUITTON | 3 #created by Yann GUITTON |
4 #use RI options | 4 #use RI options + add try on plotUnknown add session Info |
5 | 5 |
6 #Redirect all stdout to the log file | 6 #Redirect all stdout to the log file |
7 log_file=file("metams.log", open = "wt") | 7 log_file=file("metams.log", open = "wt") |
8 sink(log_file) | 8 sink(log_file) |
9 sink(log_file, type = "out") | 9 sink(log_file, type = "out") |
14 source_local <- function(fname) { | 14 source_local <- function(fname) { |
15 argv <- commandArgs(trailingOnly = FALSE) | 15 argv <- commandArgs(trailingOnly = FALSE) |
16 base_dir <- dirname(substring(argv[grep("--file=", argv)], 8)) | 16 base_dir <- dirname(substring(argv[grep("--file=", argv)], 8)) |
17 source(paste(base_dir, fname, sep="/")) | 17 source(paste(base_dir, fname, sep="/")) |
18 } | 18 } |
19 print("step1") | 19 # print("step1") |
20 | 20 |
21 | 21 |
22 listArguments = parseCommandArgs(evaluate=FALSE) #interpretation of arguments given in command line as an R list of objects | 22 listArguments = parseCommandArgs(evaluate=FALSE) #interpretation of arguments given in command line as an R list of objects |
23 print("new version 2.0") | 23 # print("new version 2.0") |
24 | 24 ## constants |
25 | 25 ##---------- |
26 | |
27 modNamC <- "metaMS:runGC" ## module name | |
28 | |
29 | |
30 ## log file | |
31 ##--------- | |
32 cat("\nStart of the '", modNamC, "' Galaxy module call: ", | |
33 format(Sys.time(), "%a %d %b %Y %X"), "\n", sep="") | |
34 | |
35 | |
36 cat("\n1) Parameters:\n") | |
26 print(listArguments) | 37 print(listArguments) |
27 | 38 |
28 | 39 |
29 if (listArguments[["ri"]]!="NULL"){ | 40 if (listArguments[["ri"]]!="NULL"){ |
30 RIarg=read.table(listArguments[["ri"]]) | 41 RIarg=read.table(listArguments[["ri"]]) |
341 | 352 |
342 print("Step QC plot") | 353 print("Step QC plot") |
343 | 354 |
344 #to do check if no peaks found | 355 #to do check if no peaks found |
345 #Quality controls plots but only working in R (don't know why) | 356 #Quality controls plots but only working in R (don't know why) |
346 a<-plotUnknowns(resGC=resGC, unkn=unknarg) #use unknparam value | 357 a<-try(plotUnknowns(resGC=resGC, unkn=unknarg)); #use unknparam value |
347 | 358 if(class(a) == "try-error") { |
359 pdf("Unknown_Error.pdf") | |
360 plot.new() | |
361 text(x=0.5,y=1,pos=1, labels="Error generating EICs\n please use none instead of a vector in plotUnknown") | |
362 dev.off() | |
363 } | |
348 # create a mergpdf | 364 # create a mergpdf |
349 | 365 |
350 #test | 366 #test |
351 system(paste('gs -o TICsBPCs_merged.pdf -sDEVICE=pdfwrite -dPDFSETTINGS=/prepress *Cs_raw.pdf')) | 367 system(paste('gs -o TICsBPCs_merged.pdf -sDEVICE=pdfwrite -dPDFSETTINGS=/prepress *Cs_raw.pdf')) |
352 system(paste('gs -o GCMS_EIC.pdf -sDEVICE=pdfwrite -dPDFSETTINGS=/prepress Unknown_*')) | 368 system(paste('gs -o GCMS_EIC.pdf -sDEVICE=pdfwrite -dPDFSETTINGS=/prepress Unknown_*')) |
368 rm(listArguments) | 384 rm(listArguments) |
369 | 385 |
370 #saving R data in .Rdata file to save the variables used in the present tool | 386 #saving R data in .Rdata file to save the variables used in the present tool |
371 save.image(paste("runGC","RData",sep=".")) | 387 save.image(paste("runGC","RData",sep=".")) |
372 | 388 |
389 ## Closing | |
390 ##-------- | |
391 | |
392 cat("\nEnd of '", modNamC, "' Galaxy module call: ", | |
393 as.character(Sys.time()), "\n", sep = "") | |
394 | |
395 cat("\n\n\n============================================================================") | |
396 cat("\nAdditional information about the call:\n") | |
397 # cat("\n1) Parameters:\n") | |
398 # print(cbind(value = argVc)) | |
399 | |
400 cat("\n1) Session Info:\n") | |
401 sessioninfo <- sessionInfo() | |
402 cat(sessioninfo$R.version$version.string,"\n") | |
403 cat("Main packages:\n") | |
404 for (pkg in names(sessioninfo$otherPkgs)) { cat(paste(pkg,packageVersion(pkg)),"\t") }; cat("\n") | |
405 cat("Other loaded packages:\n") | |
406 for (pkg in names(sessioninfo$loadedOnly)) { cat(paste(pkg,packageVersion(pkg)),"\t") }; cat("\n") | |
407 | |
408 cat("============================================================================\n") | |
409 | |
410 sink() | |
411 | |
412 rm(list = ls()) |