annotate transformation_wrapper.R @ 2:0ccfc3e15710 draft

planemo upload for repository https://github.com/workflow4metabolomics/transformation.git commit b0373e2f4702a572450205419e2d64579c24c9ae
author ethevenot
date Tue, 06 Jun 2017 11:55:21 -0400
parents d9e05021553c
children cc0e9eff0de2
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
1
d9e05021553c planemo upload for repository https://github.com/workflow4metabolomics/transformation.git commit c4b65942d74d5bdfd46e748c0040a8b5ebe4fd1d
ethevenot
parents: 0
diff changeset
1 #!/usr/bin/env Rscript
0
eacea1349a7c planemo upload for repository https://github.com/workflow4metabolomics/transformation.git commit 83f2d1045c0bf086bbe2de5204cd5c1d8354116f
ethevenot
parents:
diff changeset
2
eacea1349a7c planemo upload for repository https://github.com/workflow4metabolomics/transformation.git commit 83f2d1045c0bf086bbe2de5204cd5c1d8354116f
ethevenot
parents:
diff changeset
3 library(batch) ## parseCommandArgs
eacea1349a7c planemo upload for repository https://github.com/workflow4metabolomics/transformation.git commit 83f2d1045c0bf086bbe2de5204cd5c1d8354116f
ethevenot
parents:
diff changeset
4
eacea1349a7c planemo upload for repository https://github.com/workflow4metabolomics/transformation.git commit 83f2d1045c0bf086bbe2de5204cd5c1d8354116f
ethevenot
parents:
diff changeset
5 source_local <- function(fname){
eacea1349a7c planemo upload for repository https://github.com/workflow4metabolomics/transformation.git commit 83f2d1045c0bf086bbe2de5204cd5c1d8354116f
ethevenot
parents:
diff changeset
6 argv <- commandArgs(trailingOnly = FALSE)
eacea1349a7c planemo upload for repository https://github.com/workflow4metabolomics/transformation.git commit 83f2d1045c0bf086bbe2de5204cd5c1d8354116f
ethevenot
parents:
diff changeset
7 base_dir <- dirname(substring(argv[grep("--file=", argv)], 8))
eacea1349a7c planemo upload for repository https://github.com/workflow4metabolomics/transformation.git commit 83f2d1045c0bf086bbe2de5204cd5c1d8354116f
ethevenot
parents:
diff changeset
8 source(paste(base_dir, fname, sep="/"))
eacea1349a7c planemo upload for repository https://github.com/workflow4metabolomics/transformation.git commit 83f2d1045c0bf086bbe2de5204cd5c1d8354116f
ethevenot
parents:
diff changeset
9 }
eacea1349a7c planemo upload for repository https://github.com/workflow4metabolomics/transformation.git commit 83f2d1045c0bf086bbe2de5204cd5c1d8354116f
ethevenot
parents:
diff changeset
10
eacea1349a7c planemo upload for repository https://github.com/workflow4metabolomics/transformation.git commit 83f2d1045c0bf086bbe2de5204cd5c1d8354116f
ethevenot
parents:
diff changeset
11 source_local("transformation_script.R")
eacea1349a7c planemo upload for repository https://github.com/workflow4metabolomics/transformation.git commit 83f2d1045c0bf086bbe2de5204cd5c1d8354116f
ethevenot
parents:
diff changeset
12
eacea1349a7c planemo upload for repository https://github.com/workflow4metabolomics/transformation.git commit 83f2d1045c0bf086bbe2de5204cd5c1d8354116f
ethevenot
parents:
diff changeset
13 argVc <- unlist(parseCommandArgs(evaluate=FALSE))
eacea1349a7c planemo upload for repository https://github.com/workflow4metabolomics/transformation.git commit 83f2d1045c0bf086bbe2de5204cd5c1d8354116f
ethevenot
parents:
diff changeset
14
eacea1349a7c planemo upload for repository https://github.com/workflow4metabolomics/transformation.git commit 83f2d1045c0bf086bbe2de5204cd5c1d8354116f
ethevenot
parents:
diff changeset
15
eacea1349a7c planemo upload for repository https://github.com/workflow4metabolomics/transformation.git commit 83f2d1045c0bf086bbe2de5204cd5c1d8354116f
ethevenot
parents:
diff changeset
16 ##------------------------------
eacea1349a7c planemo upload for repository https://github.com/workflow4metabolomics/transformation.git commit 83f2d1045c0bf086bbe2de5204cd5c1d8354116f
ethevenot
parents:
diff changeset
17 ## Initializing
eacea1349a7c planemo upload for repository https://github.com/workflow4metabolomics/transformation.git commit 83f2d1045c0bf086bbe2de5204cd5c1d8354116f
ethevenot
parents:
diff changeset
18 ##------------------------------
eacea1349a7c planemo upload for repository https://github.com/workflow4metabolomics/transformation.git commit 83f2d1045c0bf086bbe2de5204cd5c1d8354116f
ethevenot
parents:
diff changeset
19
eacea1349a7c planemo upload for repository https://github.com/workflow4metabolomics/transformation.git commit 83f2d1045c0bf086bbe2de5204cd5c1d8354116f
ethevenot
parents:
diff changeset
20 ## options
eacea1349a7c planemo upload for repository https://github.com/workflow4metabolomics/transformation.git commit 83f2d1045c0bf086bbe2de5204cd5c1d8354116f
ethevenot
parents:
diff changeset
21 ##--------
eacea1349a7c planemo upload for repository https://github.com/workflow4metabolomics/transformation.git commit 83f2d1045c0bf086bbe2de5204cd5c1d8354116f
ethevenot
parents:
diff changeset
22
eacea1349a7c planemo upload for repository https://github.com/workflow4metabolomics/transformation.git commit 83f2d1045c0bf086bbe2de5204cd5c1d8354116f
ethevenot
parents:
diff changeset
23 strAsFacL <- options()[["stringsAsFactors"]]
eacea1349a7c planemo upload for repository https://github.com/workflow4metabolomics/transformation.git commit 83f2d1045c0bf086bbe2de5204cd5c1d8354116f
ethevenot
parents:
diff changeset
24 options(stringsAsFactors=FALSE)
eacea1349a7c planemo upload for repository https://github.com/workflow4metabolomics/transformation.git commit 83f2d1045c0bf086bbe2de5204cd5c1d8354116f
ethevenot
parents:
diff changeset
25
eacea1349a7c planemo upload for repository https://github.com/workflow4metabolomics/transformation.git commit 83f2d1045c0bf086bbe2de5204cd5c1d8354116f
ethevenot
parents:
diff changeset
26 ## constants
eacea1349a7c planemo upload for repository https://github.com/workflow4metabolomics/transformation.git commit 83f2d1045c0bf086bbe2de5204cd5c1d8354116f
ethevenot
parents:
diff changeset
27 ##----------
eacea1349a7c planemo upload for repository https://github.com/workflow4metabolomics/transformation.git commit 83f2d1045c0bf086bbe2de5204cd5c1d8354116f
ethevenot
parents:
diff changeset
28
eacea1349a7c planemo upload for repository https://github.com/workflow4metabolomics/transformation.git commit 83f2d1045c0bf086bbe2de5204cd5c1d8354116f
ethevenot
parents:
diff changeset
29 modNamC <- "Transformation" ## module name
eacea1349a7c planemo upload for repository https://github.com/workflow4metabolomics/transformation.git commit 83f2d1045c0bf086bbe2de5204cd5c1d8354116f
ethevenot
parents:
diff changeset
30
eacea1349a7c planemo upload for repository https://github.com/workflow4metabolomics/transformation.git commit 83f2d1045c0bf086bbe2de5204cd5c1d8354116f
ethevenot
parents:
diff changeset
31
eacea1349a7c planemo upload for repository https://github.com/workflow4metabolomics/transformation.git commit 83f2d1045c0bf086bbe2de5204cd5c1d8354116f
ethevenot
parents:
diff changeset
32 ## log file
eacea1349a7c planemo upload for repository https://github.com/workflow4metabolomics/transformation.git commit 83f2d1045c0bf086bbe2de5204cd5c1d8354116f
ethevenot
parents:
diff changeset
33 ##---------
eacea1349a7c planemo upload for repository https://github.com/workflow4metabolomics/transformation.git commit 83f2d1045c0bf086bbe2de5204cd5c1d8354116f
ethevenot
parents:
diff changeset
34
eacea1349a7c planemo upload for repository https://github.com/workflow4metabolomics/transformation.git commit 83f2d1045c0bf086bbe2de5204cd5c1d8354116f
ethevenot
parents:
diff changeset
35 sink(argVc[["information"]])
eacea1349a7c planemo upload for repository https://github.com/workflow4metabolomics/transformation.git commit 83f2d1045c0bf086bbe2de5204cd5c1d8354116f
ethevenot
parents:
diff changeset
36
eacea1349a7c planemo upload for repository https://github.com/workflow4metabolomics/transformation.git commit 83f2d1045c0bf086bbe2de5204cd5c1d8354116f
ethevenot
parents:
diff changeset
37 cat("\nStart of the '", modNamC, "' module: ",
eacea1349a7c planemo upload for repository https://github.com/workflow4metabolomics/transformation.git commit 83f2d1045c0bf086bbe2de5204cd5c1d8354116f
ethevenot
parents:
diff changeset
38 format(Sys.time(), "%a %d %b %Y %X"), "\n", sep="")
eacea1349a7c planemo upload for repository https://github.com/workflow4metabolomics/transformation.git commit 83f2d1045c0bf086bbe2de5204cd5c1d8354116f
ethevenot
parents:
diff changeset
39
eacea1349a7c planemo upload for repository https://github.com/workflow4metabolomics/transformation.git commit 83f2d1045c0bf086bbe2de5204cd5c1d8354116f
ethevenot
parents:
diff changeset
40 ## loading
eacea1349a7c planemo upload for repository https://github.com/workflow4metabolomics/transformation.git commit 83f2d1045c0bf086bbe2de5204cd5c1d8354116f
ethevenot
parents:
diff changeset
41 ##--------
eacea1349a7c planemo upload for repository https://github.com/workflow4metabolomics/transformation.git commit 83f2d1045c0bf086bbe2de5204cd5c1d8354116f
ethevenot
parents:
diff changeset
42
eacea1349a7c planemo upload for repository https://github.com/workflow4metabolomics/transformation.git commit 83f2d1045c0bf086bbe2de5204cd5c1d8354116f
ethevenot
parents:
diff changeset
43 datMN <- t(as.matrix(read.table(argVc[["dataMatrix_in"]],
eacea1349a7c planemo upload for repository https://github.com/workflow4metabolomics/transformation.git commit 83f2d1045c0bf086bbe2de5204cd5c1d8354116f
ethevenot
parents:
diff changeset
44 check.names = FALSE,
eacea1349a7c planemo upload for repository https://github.com/workflow4metabolomics/transformation.git commit 83f2d1045c0bf086bbe2de5204cd5c1d8354116f
ethevenot
parents:
diff changeset
45 header = TRUE,
eacea1349a7c planemo upload for repository https://github.com/workflow4metabolomics/transformation.git commit 83f2d1045c0bf086bbe2de5204cd5c1d8354116f
ethevenot
parents:
diff changeset
46 row.names = 1,
eacea1349a7c planemo upload for repository https://github.com/workflow4metabolomics/transformation.git commit 83f2d1045c0bf086bbe2de5204cd5c1d8354116f
ethevenot
parents:
diff changeset
47 sep = "\t")))
eacea1349a7c planemo upload for repository https://github.com/workflow4metabolomics/transformation.git commit 83f2d1045c0bf086bbe2de5204cd5c1d8354116f
ethevenot
parents:
diff changeset
48
eacea1349a7c planemo upload for repository https://github.com/workflow4metabolomics/transformation.git commit 83f2d1045c0bf086bbe2de5204cd5c1d8354116f
ethevenot
parents:
diff changeset
49 metC <- argVc[["method"]]
eacea1349a7c planemo upload for repository https://github.com/workflow4metabolomics/transformation.git commit 83f2d1045c0bf086bbe2de5204cd5c1d8354116f
ethevenot
parents:
diff changeset
50
eacea1349a7c planemo upload for repository https://github.com/workflow4metabolomics/transformation.git commit 83f2d1045c0bf086bbe2de5204cd5c1d8354116f
ethevenot
parents:
diff changeset
51
eacea1349a7c planemo upload for repository https://github.com/workflow4metabolomics/transformation.git commit 83f2d1045c0bf086bbe2de5204cd5c1d8354116f
ethevenot
parents:
diff changeset
52 ##------------------------------
eacea1349a7c planemo upload for repository https://github.com/workflow4metabolomics/transformation.git commit 83f2d1045c0bf086bbe2de5204cd5c1d8354116f
ethevenot
parents:
diff changeset
53 ## Computation
eacea1349a7c planemo upload for repository https://github.com/workflow4metabolomics/transformation.git commit 83f2d1045c0bf086bbe2de5204cd5c1d8354116f
ethevenot
parents:
diff changeset
54 ##------------------------------
eacea1349a7c planemo upload for repository https://github.com/workflow4metabolomics/transformation.git commit 83f2d1045c0bf086bbe2de5204cd5c1d8354116f
ethevenot
parents:
diff changeset
55
eacea1349a7c planemo upload for repository https://github.com/workflow4metabolomics/transformation.git commit 83f2d1045c0bf086bbe2de5204cd5c1d8354116f
ethevenot
parents:
diff changeset
56
eacea1349a7c planemo upload for repository https://github.com/workflow4metabolomics/transformation.git commit 83f2d1045c0bf086bbe2de5204cd5c1d8354116f
ethevenot
parents:
diff changeset
57 datMN <- transformF(datMN = datMN, ## dataMatrix
eacea1349a7c planemo upload for repository https://github.com/workflow4metabolomics/transformation.git commit 83f2d1045c0bf086bbe2de5204cd5c1d8354116f
ethevenot
parents:
diff changeset
58 metC = metC) ## transformation method
eacea1349a7c planemo upload for repository https://github.com/workflow4metabolomics/transformation.git commit 83f2d1045c0bf086bbe2de5204cd5c1d8354116f
ethevenot
parents:
diff changeset
59
eacea1349a7c planemo upload for repository https://github.com/workflow4metabolomics/transformation.git commit 83f2d1045c0bf086bbe2de5204cd5c1d8354116f
ethevenot
parents:
diff changeset
60
eacea1349a7c planemo upload for repository https://github.com/workflow4metabolomics/transformation.git commit 83f2d1045c0bf086bbe2de5204cd5c1d8354116f
ethevenot
parents:
diff changeset
61 ##------------------------------
eacea1349a7c planemo upload for repository https://github.com/workflow4metabolomics/transformation.git commit 83f2d1045c0bf086bbe2de5204cd5c1d8354116f
ethevenot
parents:
diff changeset
62 ## Ending
eacea1349a7c planemo upload for repository https://github.com/workflow4metabolomics/transformation.git commit 83f2d1045c0bf086bbe2de5204cd5c1d8354116f
ethevenot
parents:
diff changeset
63 ##------------------------------
eacea1349a7c planemo upload for repository https://github.com/workflow4metabolomics/transformation.git commit 83f2d1045c0bf086bbe2de5204cd5c1d8354116f
ethevenot
parents:
diff changeset
64
eacea1349a7c planemo upload for repository https://github.com/workflow4metabolomics/transformation.git commit 83f2d1045c0bf086bbe2de5204cd5c1d8354116f
ethevenot
parents:
diff changeset
65
eacea1349a7c planemo upload for repository https://github.com/workflow4metabolomics/transformation.git commit 83f2d1045c0bf086bbe2de5204cd5c1d8354116f
ethevenot
parents:
diff changeset
66 ## saving
eacea1349a7c planemo upload for repository https://github.com/workflow4metabolomics/transformation.git commit 83f2d1045c0bf086bbe2de5204cd5c1d8354116f
ethevenot
parents:
diff changeset
67 ##-------
eacea1349a7c planemo upload for repository https://github.com/workflow4metabolomics/transformation.git commit 83f2d1045c0bf086bbe2de5204cd5c1d8354116f
ethevenot
parents:
diff changeset
68
eacea1349a7c planemo upload for repository https://github.com/workflow4metabolomics/transformation.git commit 83f2d1045c0bf086bbe2de5204cd5c1d8354116f
ethevenot
parents:
diff changeset
69 datDF <- cbind.data.frame(dataMatrix = colnames(datMN),
eacea1349a7c planemo upload for repository https://github.com/workflow4metabolomics/transformation.git commit 83f2d1045c0bf086bbe2de5204cd5c1d8354116f
ethevenot
parents:
diff changeset
70 as.data.frame(t(datMN)))
eacea1349a7c planemo upload for repository https://github.com/workflow4metabolomics/transformation.git commit 83f2d1045c0bf086bbe2de5204cd5c1d8354116f
ethevenot
parents:
diff changeset
71 write.table(datDF,
eacea1349a7c planemo upload for repository https://github.com/workflow4metabolomics/transformation.git commit 83f2d1045c0bf086bbe2de5204cd5c1d8354116f
ethevenot
parents:
diff changeset
72 file = argVc[["dataMatrix_out"]],
eacea1349a7c planemo upload for repository https://github.com/workflow4metabolomics/transformation.git commit 83f2d1045c0bf086bbe2de5204cd5c1d8354116f
ethevenot
parents:
diff changeset
73 quote = FALSE,
eacea1349a7c planemo upload for repository https://github.com/workflow4metabolomics/transformation.git commit 83f2d1045c0bf086bbe2de5204cd5c1d8354116f
ethevenot
parents:
diff changeset
74 row.names = FALSE,
eacea1349a7c planemo upload for repository https://github.com/workflow4metabolomics/transformation.git commit 83f2d1045c0bf086bbe2de5204cd5c1d8354116f
ethevenot
parents:
diff changeset
75 sep = "\t")
eacea1349a7c planemo upload for repository https://github.com/workflow4metabolomics/transformation.git commit 83f2d1045c0bf086bbe2de5204cd5c1d8354116f
ethevenot
parents:
diff changeset
76
eacea1349a7c planemo upload for repository https://github.com/workflow4metabolomics/transformation.git commit 83f2d1045c0bf086bbe2de5204cd5c1d8354116f
ethevenot
parents:
diff changeset
77 ## ending
eacea1349a7c planemo upload for repository https://github.com/workflow4metabolomics/transformation.git commit 83f2d1045c0bf086bbe2de5204cd5c1d8354116f
ethevenot
parents:
diff changeset
78 ##-------
eacea1349a7c planemo upload for repository https://github.com/workflow4metabolomics/transformation.git commit 83f2d1045c0bf086bbe2de5204cd5c1d8354116f
ethevenot
parents:
diff changeset
79
eacea1349a7c planemo upload for repository https://github.com/workflow4metabolomics/transformation.git commit 83f2d1045c0bf086bbe2de5204cd5c1d8354116f
ethevenot
parents:
diff changeset
80 cat("\nEnd of the '", modNamC, "' Galaxy module call: ",
eacea1349a7c planemo upload for repository https://github.com/workflow4metabolomics/transformation.git commit 83f2d1045c0bf086bbe2de5204cd5c1d8354116f
ethevenot
parents:
diff changeset
81 format(Sys.time(), "%a %d %b %Y %X"), "\n", sep = "")
eacea1349a7c planemo upload for repository https://github.com/workflow4metabolomics/transformation.git commit 83f2d1045c0bf086bbe2de5204cd5c1d8354116f
ethevenot
parents:
diff changeset
82
2
0ccfc3e15710 planemo upload for repository https://github.com/workflow4metabolomics/transformation.git commit b0373e2f4702a572450205419e2d64579c24c9ae
ethevenot
parents: 1
diff changeset
83 cat("\n\n\n============================================================================")
0ccfc3e15710 planemo upload for repository https://github.com/workflow4metabolomics/transformation.git commit b0373e2f4702a572450205419e2d64579c24c9ae
ethevenot
parents: 1
diff changeset
84 cat("\nAdditional information about the call:\n")
0ccfc3e15710 planemo upload for repository https://github.com/workflow4metabolomics/transformation.git commit b0373e2f4702a572450205419e2d64579c24c9ae
ethevenot
parents: 1
diff changeset
85 cat("\n1) Parameters:\n")
0ccfc3e15710 planemo upload for repository https://github.com/workflow4metabolomics/transformation.git commit b0373e2f4702a572450205419e2d64579c24c9ae
ethevenot
parents: 1
diff changeset
86 print(cbind(value = argVc))
0ccfc3e15710 planemo upload for repository https://github.com/workflow4metabolomics/transformation.git commit b0373e2f4702a572450205419e2d64579c24c9ae
ethevenot
parents: 1
diff changeset
87
0ccfc3e15710 planemo upload for repository https://github.com/workflow4metabolomics/transformation.git commit b0373e2f4702a572450205419e2d64579c24c9ae
ethevenot
parents: 1
diff changeset
88 cat("\n2) Session Info:\n")
0ccfc3e15710 planemo upload for repository https://github.com/workflow4metabolomics/transformation.git commit b0373e2f4702a572450205419e2d64579c24c9ae
ethevenot
parents: 1
diff changeset
89 sessioninfo <- sessionInfo()
0ccfc3e15710 planemo upload for repository https://github.com/workflow4metabolomics/transformation.git commit b0373e2f4702a572450205419e2d64579c24c9ae
ethevenot
parents: 1
diff changeset
90 cat(sessioninfo$R.version$version.string,"\n")
0ccfc3e15710 planemo upload for repository https://github.com/workflow4metabolomics/transformation.git commit b0373e2f4702a572450205419e2d64579c24c9ae
ethevenot
parents: 1
diff changeset
91 cat("Main packages:\n")
0ccfc3e15710 planemo upload for repository https://github.com/workflow4metabolomics/transformation.git commit b0373e2f4702a572450205419e2d64579c24c9ae
ethevenot
parents: 1
diff changeset
92 for (pkg in names(sessioninfo$otherPkgs)) { cat(paste(pkg,packageVersion(pkg)),"\t") }; cat("\n")
0ccfc3e15710 planemo upload for repository https://github.com/workflow4metabolomics/transformation.git commit b0373e2f4702a572450205419e2d64579c24c9ae
ethevenot
parents: 1
diff changeset
93 cat("Other loaded packages:\n")
0ccfc3e15710 planemo upload for repository https://github.com/workflow4metabolomics/transformation.git commit b0373e2f4702a572450205419e2d64579c24c9ae
ethevenot
parents: 1
diff changeset
94 for (pkg in names(sessioninfo$loadedOnly)) { cat(paste(pkg,packageVersion(pkg)),"\t") }; cat("\n")
0ccfc3e15710 planemo upload for repository https://github.com/workflow4metabolomics/transformation.git commit b0373e2f4702a572450205419e2d64579c24c9ae
ethevenot
parents: 1
diff changeset
95
0ccfc3e15710 planemo upload for repository https://github.com/workflow4metabolomics/transformation.git commit b0373e2f4702a572450205419e2d64579c24c9ae
ethevenot
parents: 1
diff changeset
96 cat("============================================================================\n")
0ccfc3e15710 planemo upload for repository https://github.com/workflow4metabolomics/transformation.git commit b0373e2f4702a572450205419e2d64579c24c9ae
ethevenot
parents: 1
diff changeset
97
0
eacea1349a7c planemo upload for repository https://github.com/workflow4metabolomics/transformation.git commit 83f2d1045c0bf086bbe2de5204cd5c1d8354116f
ethevenot
parents:
diff changeset
98 sink()
eacea1349a7c planemo upload for repository https://github.com/workflow4metabolomics/transformation.git commit 83f2d1045c0bf086bbe2de5204cd5c1d8354116f
ethevenot
parents:
diff changeset
99
eacea1349a7c planemo upload for repository https://github.com/workflow4metabolomics/transformation.git commit 83f2d1045c0bf086bbe2de5204cd5c1d8354116f
ethevenot
parents:
diff changeset
100 options(stringsAsFactors = strAsFacL)
eacea1349a7c planemo upload for repository https://github.com/workflow4metabolomics/transformation.git commit 83f2d1045c0bf086bbe2de5204cd5c1d8354116f
ethevenot
parents:
diff changeset
101
eacea1349a7c planemo upload for repository https://github.com/workflow4metabolomics/transformation.git commit 83f2d1045c0bf086bbe2de5204cd5c1d8354116f
ethevenot
parents:
diff changeset
102
eacea1349a7c planemo upload for repository https://github.com/workflow4metabolomics/transformation.git commit 83f2d1045c0bf086bbe2de5204cd5c1d8354116f
ethevenot
parents:
diff changeset
103 rm(list = ls())