comparison checkformat_wrapper.R @ 0:059eb452931e draft

planemo upload for repository https://github.com/workflow4metabolomics/checkformat.git commit e17f78630b4d21b54a4edd6015d50969ac859d6b
author ethevenot
date Tue, 24 Oct 2017 08:44:02 -0400
parents
children b642f4f87022
comparison
equal deleted inserted replaced
-1:000000000000 0:059eb452931e
1 #!/usr/bin/env Rscript
2
3 library(batch) ## parseCommandArgs
4
5 source_local <- function(fname){
6 argv <- commandArgs(trailingOnly = FALSE)
7 base_dir <- dirname(substring(argv[grep("--file=", argv)], 8))
8 source(paste(base_dir, fname, sep="/"))
9 }
10
11 source_local("checkformat_script.R")
12
13 argVc <- unlist(parseCommandArgs(evaluate = FALSE))
14
15
16 ##------------------------------
17 ## Initializing
18 ##------------------------------
19
20 ## options
21 ##--------
22
23 strAsFacL <- options()$stringsAsFactors
24 options(stringsAsFactors = FALSE)
25
26 ## constants
27 ##----------
28
29 modNamC <- "Check Format" ## module name
30
31 ## log file
32 ##---------
33
34 sink(argVc["information"])
35
36 cat("\nStart of the '", modNamC, "' Galaxy module call: ",
37 format(Sys.time(), "%a %d %b %Y %X"), "\n", sep="")
38
39
40 ##------------------------------
41 ## Computation
42 ##------------------------------
43
44
45 resLs <- readAndCheckF(argVc["dataMatrix_in"],
46 argVc["sampleMetadata_in"],
47 argVc["variableMetadata_in"])
48 chkL <- resLs[["chkL"]]
49
50
51 ##------------------------------
52 ## Ending
53 ##------------------------------
54
55
56 if(chkL) {
57
58 cat("\nTable formats are OK; enjoy your analyses!\n", sep="")
59
60 cat("\nEnd of the '", modNamC, "' Galaxy module call: ",
61 format(Sys.time(), "%a %d %b %Y %X"), "\n", sep="")
62
63 cat("\n\n\n============================================================================")
64 cat("\nAdditional information about the call:\n")
65 cat("\n1) Parameters:\n")
66 print(cbind(value = argVc))
67
68 cat("\n2) Session Info:\n")
69 sessioninfo <- sessionInfo()
70 cat(sessioninfo$R.version$version.string,"\n")
71 cat("Main packages:\n")
72 for (pkg in names(sessioninfo$otherPkgs)) { cat(paste(pkg,packageVersion(pkg)),"\t") }; cat("\n")
73 cat("Other loaded packages:\n")
74 for (pkg in names(sessioninfo$loadedOnly)) { cat(paste(pkg,packageVersion(pkg)),"\t") }; cat("\n")
75
76 cat("============================================================================\n")
77
78 sink()
79
80 } else {
81
82 cat("\n\n\n============================================================================")
83 cat("\nAdditional information about the call:\n")
84 cat("\n1) Parameters:\n")
85 print(cbind(value = argVc))
86
87 cat("\n2) Session Info:\n")
88 sessioninfo <- sessionInfo()
89 cat(sessioninfo$R.version$version.string,"\n")
90 cat("Main packages:\n")
91 for (pkg in names(sessioninfo$otherPkgs)) { cat(paste(pkg,packageVersion(pkg)),"\t") }; cat("\n")
92 cat("Other loaded packages:\n")
93 for (pkg in names(sessioninfo$loadedOnly)) { cat(paste(pkg,packageVersion(pkg)),"\t") }; cat("\n")
94
95 cat("============================================================================\n")
96
97 sink()
98 stop("Please check the generated 'information' file")
99
100 }
101
102 ## closing
103 ##--------
104
105 options(stringsAsFactors = strAsFacL)
106
107 rm(list = ls())