annotate transformation_wrapper.R @ 1:d9e05021553c draft

planemo upload for repository https://github.com/workflow4metabolomics/transformation.git commit c4b65942d74d5bdfd46e748c0040a8b5ebe4fd1d
author ethevenot
date Sat, 06 Aug 2016 12:02:52 -0400
parents eacea1349a7c
children 0ccfc3e15710
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
eacea1349a7c planemo upload for repository https://github.com/workflow4metabolomics/transformation.git commit 83f2d1045c0bf086bbe2de5204cd5c1d8354116f
ethevenot
parents:
diff changeset
83 sink()
eacea1349a7c planemo upload for repository https://github.com/workflow4metabolomics/transformation.git commit 83f2d1045c0bf086bbe2de5204cd5c1d8354116f
ethevenot
parents:
diff changeset
84
eacea1349a7c planemo upload for repository https://github.com/workflow4metabolomics/transformation.git commit 83f2d1045c0bf086bbe2de5204cd5c1d8354116f
ethevenot
parents:
diff changeset
85 options(stringsAsFactors = strAsFacL)
eacea1349a7c planemo upload for repository https://github.com/workflow4metabolomics/transformation.git commit 83f2d1045c0bf086bbe2de5204cd5c1d8354116f
ethevenot
parents:
diff changeset
86
eacea1349a7c planemo upload for repository https://github.com/workflow4metabolomics/transformation.git commit 83f2d1045c0bf086bbe2de5204cd5c1d8354116f
ethevenot
parents:
diff changeset
87
eacea1349a7c planemo upload for repository https://github.com/workflow4metabolomics/transformation.git commit 83f2d1045c0bf086bbe2de5204cd5c1d8354116f
ethevenot
parents:
diff changeset
88 rm(list = ls())