annotate univariate_wrapper.R @ 5:5687435b182c draft default tip

planemo upload for repository https://github.com/workflow4metabolomics/univariate.git commit 957d0e442c875f7cf8461866fac9695175ab371b
author ethevenot
date Wed, 28 Feb 2018 06:29:34 -0500
parents 3017385625f6
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
ef64d3752050 planemo upload for repository https://github.com/workflow4metabolomics/univariate.git commit ca0e312e1c986c45310f37effe031f60009fbcab
ethevenot
parents:
diff changeset
1 #!/usr/bin/env Rscript
ef64d3752050 planemo upload for repository https://github.com/workflow4metabolomics/univariate.git commit ca0e312e1c986c45310f37effe031f60009fbcab
ethevenot
parents:
diff changeset
2
ef64d3752050 planemo upload for repository https://github.com/workflow4metabolomics/univariate.git commit ca0e312e1c986c45310f37effe031f60009fbcab
ethevenot
parents:
diff changeset
3 library(batch) ## parseCommandArgs
ef64d3752050 planemo upload for repository https://github.com/workflow4metabolomics/univariate.git commit ca0e312e1c986c45310f37effe031f60009fbcab
ethevenot
parents:
diff changeset
4
4
3017385625f6 planemo upload for repository https://github.com/workflow4metabolomics/univariate.git commit a81d4cc1df719dcc66def660927abda74972afaa
ethevenot
parents: 3
diff changeset
5 # Constants
3017385625f6 planemo upload for repository https://github.com/workflow4metabolomics/univariate.git commit a81d4cc1df719dcc66def660927abda74972afaa
ethevenot
parents: 3
diff changeset
6 argv <- commandArgs(trailingOnly = FALSE)
3017385625f6 planemo upload for repository https://github.com/workflow4metabolomics/univariate.git commit a81d4cc1df719dcc66def660927abda74972afaa
ethevenot
parents: 3
diff changeset
7 script.path <- sub("--file=","",argv[grep("--file=",argv)])
3017385625f6 planemo upload for repository https://github.com/workflow4metabolomics/univariate.git commit a81d4cc1df719dcc66def660927abda74972afaa
ethevenot
parents: 3
diff changeset
8 prog.name <- basename(script.path)
3017385625f6 planemo upload for repository https://github.com/workflow4metabolomics/univariate.git commit a81d4cc1df719dcc66def660927abda74972afaa
ethevenot
parents: 3
diff changeset
9
3017385625f6 planemo upload for repository https://github.com/workflow4metabolomics/univariate.git commit a81d4cc1df719dcc66def660927abda74972afaa
ethevenot
parents: 3
diff changeset
10 # Print help
3017385625f6 planemo upload for repository https://github.com/workflow4metabolomics/univariate.git commit a81d4cc1df719dcc66def660927abda74972afaa
ethevenot
parents: 3
diff changeset
11 if (length(grep('-h', argv)) >0) {
3017385625f6 planemo upload for repository https://github.com/workflow4metabolomics/univariate.git commit a81d4cc1df719dcc66def660927abda74972afaa
ethevenot
parents: 3
diff changeset
12 cat("Usage:", prog.name,
3017385625f6 planemo upload for repository https://github.com/workflow4metabolomics/univariate.git commit a81d4cc1df719dcc66def660927abda74972afaa
ethevenot
parents: 3
diff changeset
13 "dataMatrix_in myDataMatrix.tsv",
3017385625f6 planemo upload for repository https://github.com/workflow4metabolomics/univariate.git commit a81d4cc1df719dcc66def660927abda74972afaa
ethevenot
parents: 3
diff changeset
14 "sampleMetadata_in mySampleData.tsv",
3017385625f6 planemo upload for repository https://github.com/workflow4metabolomics/univariate.git commit a81d4cc1df719dcc66def660927abda74972afaa
ethevenot
parents: 3
diff changeset
15 "variableMetadata_in myVariableMetadata.tsv",
3017385625f6 planemo upload for repository https://github.com/workflow4metabolomics/univariate.git commit a81d4cc1df719dcc66def660927abda74972afaa
ethevenot
parents: 3
diff changeset
16 "facC qual",
3017385625f6 planemo upload for repository https://github.com/workflow4metabolomics/univariate.git commit a81d4cc1df719dcc66def660927abda74972afaa
ethevenot
parents: 3
diff changeset
17 "tesC kruskal",
3017385625f6 planemo upload for repository https://github.com/workflow4metabolomics/univariate.git commit a81d4cc1df719dcc66def660927abda74972afaa
ethevenot
parents: 3
diff changeset
18 "adjC fdr",
3017385625f6 planemo upload for repository https://github.com/workflow4metabolomics/univariate.git commit a81d4cc1df719dcc66def660927abda74972afaa
ethevenot
parents: 3
diff changeset
19 "thrN 0.05",
3017385625f6 planemo upload for repository https://github.com/workflow4metabolomics/univariate.git commit a81d4cc1df719dcc66def660927abda74972afaa
ethevenot
parents: 3
diff changeset
20 "variableMetadata_out myVariableMetadata_out.tsv",
3017385625f6 planemo upload for repository https://github.com/workflow4metabolomics/univariate.git commit a81d4cc1df719dcc66def660927abda74972afaa
ethevenot
parents: 3
diff changeset
21 "figure figure.pdf",
3017385625f6 planemo upload for repository https://github.com/workflow4metabolomics/univariate.git commit a81d4cc1df719dcc66def660927abda74972afaa
ethevenot
parents: 3
diff changeset
22 "information information.txt",
3017385625f6 planemo upload for repository https://github.com/workflow4metabolomics/univariate.git commit a81d4cc1df719dcc66def660927abda74972afaa
ethevenot
parents: 3
diff changeset
23 "\n")
3017385625f6 planemo upload for repository https://github.com/workflow4metabolomics/univariate.git commit a81d4cc1df719dcc66def660927abda74972afaa
ethevenot
parents: 3
diff changeset
24 quit(status = 0)
3017385625f6 planemo upload for repository https://github.com/workflow4metabolomics/univariate.git commit a81d4cc1df719dcc66def660927abda74972afaa
ethevenot
parents: 3
diff changeset
25 }
3017385625f6 planemo upload for repository https://github.com/workflow4metabolomics/univariate.git commit a81d4cc1df719dcc66def660927abda74972afaa
ethevenot
parents: 3
diff changeset
26
0
ef64d3752050 planemo upload for repository https://github.com/workflow4metabolomics/univariate.git commit ca0e312e1c986c45310f37effe031f60009fbcab
ethevenot
parents:
diff changeset
27 source_local <- function(fname){
ef64d3752050 planemo upload for repository https://github.com/workflow4metabolomics/univariate.git commit ca0e312e1c986c45310f37effe031f60009fbcab
ethevenot
parents:
diff changeset
28 argv <- commandArgs(trailingOnly = FALSE)
ef64d3752050 planemo upload for repository https://github.com/workflow4metabolomics/univariate.git commit ca0e312e1c986c45310f37effe031f60009fbcab
ethevenot
parents:
diff changeset
29 base_dir <- dirname(substring(argv[grep("--file=", argv)], 8))
ef64d3752050 planemo upload for repository https://github.com/workflow4metabolomics/univariate.git commit ca0e312e1c986c45310f37effe031f60009fbcab
ethevenot
parents:
diff changeset
30 source(paste(base_dir, fname, sep="/"))
ef64d3752050 planemo upload for repository https://github.com/workflow4metabolomics/univariate.git commit ca0e312e1c986c45310f37effe031f60009fbcab
ethevenot
parents:
diff changeset
31 }
ef64d3752050 planemo upload for repository https://github.com/workflow4metabolomics/univariate.git commit ca0e312e1c986c45310f37effe031f60009fbcab
ethevenot
parents:
diff changeset
32
ef64d3752050 planemo upload for repository https://github.com/workflow4metabolomics/univariate.git commit ca0e312e1c986c45310f37effe031f60009fbcab
ethevenot
parents:
diff changeset
33 source_local("univariate_script.R")
ef64d3752050 planemo upload for repository https://github.com/workflow4metabolomics/univariate.git commit ca0e312e1c986c45310f37effe031f60009fbcab
ethevenot
parents:
diff changeset
34
ef64d3752050 planemo upload for repository https://github.com/workflow4metabolomics/univariate.git commit ca0e312e1c986c45310f37effe031f60009fbcab
ethevenot
parents:
diff changeset
35 argVc <- unlist(parseCommandArgs(evaluate=FALSE))
ef64d3752050 planemo upload for repository https://github.com/workflow4metabolomics/univariate.git commit ca0e312e1c986c45310f37effe031f60009fbcab
ethevenot
parents:
diff changeset
36
ef64d3752050 planemo upload for repository https://github.com/workflow4metabolomics/univariate.git commit ca0e312e1c986c45310f37effe031f60009fbcab
ethevenot
parents:
diff changeset
37 ##------------------------------
ef64d3752050 planemo upload for repository https://github.com/workflow4metabolomics/univariate.git commit ca0e312e1c986c45310f37effe031f60009fbcab
ethevenot
parents:
diff changeset
38 ## Initializing
ef64d3752050 planemo upload for repository https://github.com/workflow4metabolomics/univariate.git commit ca0e312e1c986c45310f37effe031f60009fbcab
ethevenot
parents:
diff changeset
39 ##------------------------------
ef64d3752050 planemo upload for repository https://github.com/workflow4metabolomics/univariate.git commit ca0e312e1c986c45310f37effe031f60009fbcab
ethevenot
parents:
diff changeset
40
ef64d3752050 planemo upload for repository https://github.com/workflow4metabolomics/univariate.git commit ca0e312e1c986c45310f37effe031f60009fbcab
ethevenot
parents:
diff changeset
41 ## options
ef64d3752050 planemo upload for repository https://github.com/workflow4metabolomics/univariate.git commit ca0e312e1c986c45310f37effe031f60009fbcab
ethevenot
parents:
diff changeset
42 ##--------
ef64d3752050 planemo upload for repository https://github.com/workflow4metabolomics/univariate.git commit ca0e312e1c986c45310f37effe031f60009fbcab
ethevenot
parents:
diff changeset
43
ef64d3752050 planemo upload for repository https://github.com/workflow4metabolomics/univariate.git commit ca0e312e1c986c45310f37effe031f60009fbcab
ethevenot
parents:
diff changeset
44 strAsFacL <- options()$stringsAsFactors
ef64d3752050 planemo upload for repository https://github.com/workflow4metabolomics/univariate.git commit ca0e312e1c986c45310f37effe031f60009fbcab
ethevenot
parents:
diff changeset
45 options(stringsAsFactors = FALSE)
ef64d3752050 planemo upload for repository https://github.com/workflow4metabolomics/univariate.git commit ca0e312e1c986c45310f37effe031f60009fbcab
ethevenot
parents:
diff changeset
46
ef64d3752050 planemo upload for repository https://github.com/workflow4metabolomics/univariate.git commit ca0e312e1c986c45310f37effe031f60009fbcab
ethevenot
parents:
diff changeset
47 ## packages
ef64d3752050 planemo upload for repository https://github.com/workflow4metabolomics/univariate.git commit ca0e312e1c986c45310f37effe031f60009fbcab
ethevenot
parents:
diff changeset
48 ##---------
ef64d3752050 planemo upload for repository https://github.com/workflow4metabolomics/univariate.git commit ca0e312e1c986c45310f37effe031f60009fbcab
ethevenot
parents:
diff changeset
49
ef64d3752050 planemo upload for repository https://github.com/workflow4metabolomics/univariate.git commit ca0e312e1c986c45310f37effe031f60009fbcab
ethevenot
parents:
diff changeset
50 library(PMCMR)
ef64d3752050 planemo upload for repository https://github.com/workflow4metabolomics/univariate.git commit ca0e312e1c986c45310f37effe031f60009fbcab
ethevenot
parents:
diff changeset
51
ef64d3752050 planemo upload for repository https://github.com/workflow4metabolomics/univariate.git commit ca0e312e1c986c45310f37effe031f60009fbcab
ethevenot
parents:
diff changeset
52 ## constants
ef64d3752050 planemo upload for repository https://github.com/workflow4metabolomics/univariate.git commit ca0e312e1c986c45310f37effe031f60009fbcab
ethevenot
parents:
diff changeset
53 ##----------
ef64d3752050 planemo upload for repository https://github.com/workflow4metabolomics/univariate.git commit ca0e312e1c986c45310f37effe031f60009fbcab
ethevenot
parents:
diff changeset
54
ef64d3752050 planemo upload for repository https://github.com/workflow4metabolomics/univariate.git commit ca0e312e1c986c45310f37effe031f60009fbcab
ethevenot
parents:
diff changeset
55 modNamC <- "Univariate" ## module name
ef64d3752050 planemo upload for repository https://github.com/workflow4metabolomics/univariate.git commit ca0e312e1c986c45310f37effe031f60009fbcab
ethevenot
parents:
diff changeset
56
ef64d3752050 planemo upload for repository https://github.com/workflow4metabolomics/univariate.git commit ca0e312e1c986c45310f37effe031f60009fbcab
ethevenot
parents:
diff changeset
57 topEnvC <- environment()
ef64d3752050 planemo upload for repository https://github.com/workflow4metabolomics/univariate.git commit ca0e312e1c986c45310f37effe031f60009fbcab
ethevenot
parents:
diff changeset
58 flagC <- "\n"
ef64d3752050 planemo upload for repository https://github.com/workflow4metabolomics/univariate.git commit ca0e312e1c986c45310f37effe031f60009fbcab
ethevenot
parents:
diff changeset
59
ef64d3752050 planemo upload for repository https://github.com/workflow4metabolomics/univariate.git commit ca0e312e1c986c45310f37effe031f60009fbcab
ethevenot
parents:
diff changeset
60 ## functions
ef64d3752050 planemo upload for repository https://github.com/workflow4metabolomics/univariate.git commit ca0e312e1c986c45310f37effe031f60009fbcab
ethevenot
parents:
diff changeset
61 ##----------
ef64d3752050 planemo upload for repository https://github.com/workflow4metabolomics/univariate.git commit ca0e312e1c986c45310f37effe031f60009fbcab
ethevenot
parents:
diff changeset
62
ef64d3752050 planemo upload for repository https://github.com/workflow4metabolomics/univariate.git commit ca0e312e1c986c45310f37effe031f60009fbcab
ethevenot
parents:
diff changeset
63 flgF <- function(tesC,
ef64d3752050 planemo upload for repository https://github.com/workflow4metabolomics/univariate.git commit ca0e312e1c986c45310f37effe031f60009fbcab
ethevenot
parents:
diff changeset
64 envC = topEnvC,
ef64d3752050 planemo upload for repository https://github.com/workflow4metabolomics/univariate.git commit ca0e312e1c986c45310f37effe031f60009fbcab
ethevenot
parents:
diff changeset
65 txtC = NA) { ## management of warning and error messages
ef64d3752050 planemo upload for repository https://github.com/workflow4metabolomics/univariate.git commit ca0e312e1c986c45310f37effe031f60009fbcab
ethevenot
parents:
diff changeset
66
ef64d3752050 planemo upload for repository https://github.com/workflow4metabolomics/univariate.git commit ca0e312e1c986c45310f37effe031f60009fbcab
ethevenot
parents:
diff changeset
67 tesL <- eval(parse(text = tesC), envir = envC)
ef64d3752050 planemo upload for repository https://github.com/workflow4metabolomics/univariate.git commit ca0e312e1c986c45310f37effe031f60009fbcab
ethevenot
parents:
diff changeset
68
ef64d3752050 planemo upload for repository https://github.com/workflow4metabolomics/univariate.git commit ca0e312e1c986c45310f37effe031f60009fbcab
ethevenot
parents:
diff changeset
69 if(!tesL) {
ef64d3752050 planemo upload for repository https://github.com/workflow4metabolomics/univariate.git commit ca0e312e1c986c45310f37effe031f60009fbcab
ethevenot
parents:
diff changeset
70
ef64d3752050 planemo upload for repository https://github.com/workflow4metabolomics/univariate.git commit ca0e312e1c986c45310f37effe031f60009fbcab
ethevenot
parents:
diff changeset
71 sink(NULL)
ef64d3752050 planemo upload for repository https://github.com/workflow4metabolomics/univariate.git commit ca0e312e1c986c45310f37effe031f60009fbcab
ethevenot
parents:
diff changeset
72 stpTxtC <- ifelse(is.na(txtC),
ef64d3752050 planemo upload for repository https://github.com/workflow4metabolomics/univariate.git commit ca0e312e1c986c45310f37effe031f60009fbcab
ethevenot
parents:
diff changeset
73 paste0(tesC, " is FALSE"),
ef64d3752050 planemo upload for repository https://github.com/workflow4metabolomics/univariate.git commit ca0e312e1c986c45310f37effe031f60009fbcab
ethevenot
parents:
diff changeset
74 txtC)
ef64d3752050 planemo upload for repository https://github.com/workflow4metabolomics/univariate.git commit ca0e312e1c986c45310f37effe031f60009fbcab
ethevenot
parents:
diff changeset
75
ef64d3752050 planemo upload for repository https://github.com/workflow4metabolomics/univariate.git commit ca0e312e1c986c45310f37effe031f60009fbcab
ethevenot
parents:
diff changeset
76 stop(stpTxtC,
ef64d3752050 planemo upload for repository https://github.com/workflow4metabolomics/univariate.git commit ca0e312e1c986c45310f37effe031f60009fbcab
ethevenot
parents:
diff changeset
77 call. = FALSE)
ef64d3752050 planemo upload for repository https://github.com/workflow4metabolomics/univariate.git commit ca0e312e1c986c45310f37effe031f60009fbcab
ethevenot
parents:
diff changeset
78
ef64d3752050 planemo upload for repository https://github.com/workflow4metabolomics/univariate.git commit ca0e312e1c986c45310f37effe031f60009fbcab
ethevenot
parents:
diff changeset
79 }
ef64d3752050 planemo upload for repository https://github.com/workflow4metabolomics/univariate.git commit ca0e312e1c986c45310f37effe031f60009fbcab
ethevenot
parents:
diff changeset
80
ef64d3752050 planemo upload for repository https://github.com/workflow4metabolomics/univariate.git commit ca0e312e1c986c45310f37effe031f60009fbcab
ethevenot
parents:
diff changeset
81 } ## flgF
ef64d3752050 planemo upload for repository https://github.com/workflow4metabolomics/univariate.git commit ca0e312e1c986c45310f37effe031f60009fbcab
ethevenot
parents:
diff changeset
82
ef64d3752050 planemo upload for repository https://github.com/workflow4metabolomics/univariate.git commit ca0e312e1c986c45310f37effe031f60009fbcab
ethevenot
parents:
diff changeset
83 ## log file
ef64d3752050 planemo upload for repository https://github.com/workflow4metabolomics/univariate.git commit ca0e312e1c986c45310f37effe031f60009fbcab
ethevenot
parents:
diff changeset
84 ##---------
ef64d3752050 planemo upload for repository https://github.com/workflow4metabolomics/univariate.git commit ca0e312e1c986c45310f37effe031f60009fbcab
ethevenot
parents:
diff changeset
85
ef64d3752050 planemo upload for repository https://github.com/workflow4metabolomics/univariate.git commit ca0e312e1c986c45310f37effe031f60009fbcab
ethevenot
parents:
diff changeset
86 sink(argVc["information"])
ef64d3752050 planemo upload for repository https://github.com/workflow4metabolomics/univariate.git commit ca0e312e1c986c45310f37effe031f60009fbcab
ethevenot
parents:
diff changeset
87
ef64d3752050 planemo upload for repository https://github.com/workflow4metabolomics/univariate.git commit ca0e312e1c986c45310f37effe031f60009fbcab
ethevenot
parents:
diff changeset
88 cat("\nStart of the '", modNamC, "' Galaxy module call: ",
ef64d3752050 planemo upload for repository https://github.com/workflow4metabolomics/univariate.git commit ca0e312e1c986c45310f37effe031f60009fbcab
ethevenot
parents:
diff changeset
89 format(Sys.time(), "%a %d %b %Y %X"), "\n", sep="")
ef64d3752050 planemo upload for repository https://github.com/workflow4metabolomics/univariate.git commit ca0e312e1c986c45310f37effe031f60009fbcab
ethevenot
parents:
diff changeset
90
ef64d3752050 planemo upload for repository https://github.com/workflow4metabolomics/univariate.git commit ca0e312e1c986c45310f37effe031f60009fbcab
ethevenot
parents:
diff changeset
91 ## loading
ef64d3752050 planemo upload for repository https://github.com/workflow4metabolomics/univariate.git commit ca0e312e1c986c45310f37effe031f60009fbcab
ethevenot
parents:
diff changeset
92 ##--------
ef64d3752050 planemo upload for repository https://github.com/workflow4metabolomics/univariate.git commit ca0e312e1c986c45310f37effe031f60009fbcab
ethevenot
parents:
diff changeset
93
ef64d3752050 planemo upload for repository https://github.com/workflow4metabolomics/univariate.git commit ca0e312e1c986c45310f37effe031f60009fbcab
ethevenot
parents:
diff changeset
94 datMN <- t(as.matrix(read.table(argVc["dataMatrix_in"],
ef64d3752050 planemo upload for repository https://github.com/workflow4metabolomics/univariate.git commit ca0e312e1c986c45310f37effe031f60009fbcab
ethevenot
parents:
diff changeset
95 check.names = FALSE,
ef64d3752050 planemo upload for repository https://github.com/workflow4metabolomics/univariate.git commit ca0e312e1c986c45310f37effe031f60009fbcab
ethevenot
parents:
diff changeset
96 header = TRUE,
ef64d3752050 planemo upload for repository https://github.com/workflow4metabolomics/univariate.git commit ca0e312e1c986c45310f37effe031f60009fbcab
ethevenot
parents:
diff changeset
97 row.names = 1,
ef64d3752050 planemo upload for repository https://github.com/workflow4metabolomics/univariate.git commit ca0e312e1c986c45310f37effe031f60009fbcab
ethevenot
parents:
diff changeset
98 sep = "\t")))
ef64d3752050 planemo upload for repository https://github.com/workflow4metabolomics/univariate.git commit ca0e312e1c986c45310f37effe031f60009fbcab
ethevenot
parents:
diff changeset
99
ef64d3752050 planemo upload for repository https://github.com/workflow4metabolomics/univariate.git commit ca0e312e1c986c45310f37effe031f60009fbcab
ethevenot
parents:
diff changeset
100 samDF <- read.table(argVc["sampleMetadata_in"],
ef64d3752050 planemo upload for repository https://github.com/workflow4metabolomics/univariate.git commit ca0e312e1c986c45310f37effe031f60009fbcab
ethevenot
parents:
diff changeset
101 check.names = FALSE,
ef64d3752050 planemo upload for repository https://github.com/workflow4metabolomics/univariate.git commit ca0e312e1c986c45310f37effe031f60009fbcab
ethevenot
parents:
diff changeset
102 header = TRUE,
ef64d3752050 planemo upload for repository https://github.com/workflow4metabolomics/univariate.git commit ca0e312e1c986c45310f37effe031f60009fbcab
ethevenot
parents:
diff changeset
103 row.names = 1,
ef64d3752050 planemo upload for repository https://github.com/workflow4metabolomics/univariate.git commit ca0e312e1c986c45310f37effe031f60009fbcab
ethevenot
parents:
diff changeset
104 sep = "\t")
ef64d3752050 planemo upload for repository https://github.com/workflow4metabolomics/univariate.git commit ca0e312e1c986c45310f37effe031f60009fbcab
ethevenot
parents:
diff changeset
105
ef64d3752050 planemo upload for repository https://github.com/workflow4metabolomics/univariate.git commit ca0e312e1c986c45310f37effe031f60009fbcab
ethevenot
parents:
diff changeset
106 varDF <- read.table(argVc["variableMetadata_in"],
ef64d3752050 planemo upload for repository https://github.com/workflow4metabolomics/univariate.git commit ca0e312e1c986c45310f37effe031f60009fbcab
ethevenot
parents:
diff changeset
107 check.names = FALSE,
ef64d3752050 planemo upload for repository https://github.com/workflow4metabolomics/univariate.git commit ca0e312e1c986c45310f37effe031f60009fbcab
ethevenot
parents:
diff changeset
108 header = TRUE,
ef64d3752050 planemo upload for repository https://github.com/workflow4metabolomics/univariate.git commit ca0e312e1c986c45310f37effe031f60009fbcab
ethevenot
parents:
diff changeset
109 row.names = 1,
ef64d3752050 planemo upload for repository https://github.com/workflow4metabolomics/univariate.git commit ca0e312e1c986c45310f37effe031f60009fbcab
ethevenot
parents:
diff changeset
110 sep = "\t")
ef64d3752050 planemo upload for repository https://github.com/workflow4metabolomics/univariate.git commit ca0e312e1c986c45310f37effe031f60009fbcab
ethevenot
parents:
diff changeset
111
ef64d3752050 planemo upload for repository https://github.com/workflow4metabolomics/univariate.git commit ca0e312e1c986c45310f37effe031f60009fbcab
ethevenot
parents:
diff changeset
112 tesC <- argVc["tesC"]
ef64d3752050 planemo upload for repository https://github.com/workflow4metabolomics/univariate.git commit ca0e312e1c986c45310f37effe031f60009fbcab
ethevenot
parents:
diff changeset
113
ef64d3752050 planemo upload for repository https://github.com/workflow4metabolomics/univariate.git commit ca0e312e1c986c45310f37effe031f60009fbcab
ethevenot
parents:
diff changeset
114 ## checking
ef64d3752050 planemo upload for repository https://github.com/workflow4metabolomics/univariate.git commit ca0e312e1c986c45310f37effe031f60009fbcab
ethevenot
parents:
diff changeset
115 ##---------
ef64d3752050 planemo upload for repository https://github.com/workflow4metabolomics/univariate.git commit ca0e312e1c986c45310f37effe031f60009fbcab
ethevenot
parents:
diff changeset
116
ef64d3752050 planemo upload for repository https://github.com/workflow4metabolomics/univariate.git commit ca0e312e1c986c45310f37effe031f60009fbcab
ethevenot
parents:
diff changeset
117 flgF("identical(rownames(datMN), rownames(samDF))", txtC = "Column names of the dataMatrix are not identical to the row names of the sampleMetadata; check your data with the 'Check Format' module in the 'Quality Control' section")
ef64d3752050 planemo upload for repository https://github.com/workflow4metabolomics/univariate.git commit ca0e312e1c986c45310f37effe031f60009fbcab
ethevenot
parents:
diff changeset
118 flgF("identical(colnames(datMN), rownames(varDF))", txtC = "Row names of the dataMatrix are not identical to the row names of the variableMetadata; check your data with the 'Check Format' module in the 'Quality Control' section")
ef64d3752050 planemo upload for repository https://github.com/workflow4metabolomics/univariate.git commit ca0e312e1c986c45310f37effe031f60009fbcab
ethevenot
parents:
diff changeset
119
ef64d3752050 planemo upload for repository https://github.com/workflow4metabolomics/univariate.git commit ca0e312e1c986c45310f37effe031f60009fbcab
ethevenot
parents:
diff changeset
120 flgF("argVc['facC'] %in% colnames(samDF)", txtC = paste0("Required factor of interest '", argVc['facC'], "' could not be found in the column names of the sampleMetadata"))
ef64d3752050 planemo upload for repository https://github.com/workflow4metabolomics/univariate.git commit ca0e312e1c986c45310f37effe031f60009fbcab
ethevenot
parents:
diff changeset
121 flgF("mode(samDF[, argVc['facC']]) %in% c('character', 'numeric')", txtC = paste0("The '", argVc['facC'], "' column of the sampleMetadata should contain either number only, or character only"))
ef64d3752050 planemo upload for repository https://github.com/workflow4metabolomics/univariate.git commit ca0e312e1c986c45310f37effe031f60009fbcab
ethevenot
parents:
diff changeset
122
ef64d3752050 planemo upload for repository https://github.com/workflow4metabolomics/univariate.git commit ca0e312e1c986c45310f37effe031f60009fbcab
ethevenot
parents:
diff changeset
123 flgF("!(tesC %in% c('ttest', 'wilcoxon')) || (mode(samDF[, argVc['facC']]) == 'character' && length(unique(samDF[, argVc['facC']])) == 2)", txtC = paste0("For 'ttest' and 'wilcoxon', the chosen factor column ('", argVc['facC'], "') of the sampleMetadata should contain characters with only two different classes"))
ef64d3752050 planemo upload for repository https://github.com/workflow4metabolomics/univariate.git commit ca0e312e1c986c45310f37effe031f60009fbcab
ethevenot
parents:
diff changeset
124 flgF("!(tesC %in% c('anova', 'kruskal')) || (mode(samDF[, argVc['facC']]) == 'character' && length(unique(samDF[, argVc['facC']])) > 2)", txtC = paste0("For 'anova' and 'kruskal', the chosen factor column ('", argVc['facC'], "') of the sampleMetadata should contain characters with at least three different classes"))
ef64d3752050 planemo upload for repository https://github.com/workflow4metabolomics/univariate.git commit ca0e312e1c986c45310f37effe031f60009fbcab
ethevenot
parents:
diff changeset
125 flgF("!(tesC %in% c('pearson', 'spearman')) || mode(samDF[, argVc['facC']]) == 'numeric'", txtC = paste0("For 'pearson' and 'spearman', the chosen factor column ('", argVc['facC'], "') of the sampleMetadata should contain numbers only"))
ef64d3752050 planemo upload for repository https://github.com/workflow4metabolomics/univariate.git commit ca0e312e1c986c45310f37effe031f60009fbcab
ethevenot
parents:
diff changeset
126
ef64d3752050 planemo upload for repository https://github.com/workflow4metabolomics/univariate.git commit ca0e312e1c986c45310f37effe031f60009fbcab
ethevenot
parents:
diff changeset
127 flgF("argVc['adjC'] %in% c('holm', 'hochberg', 'hommel', 'bonferroni', 'BH', 'BY', 'fdr', 'none')")
ef64d3752050 planemo upload for repository https://github.com/workflow4metabolomics/univariate.git commit ca0e312e1c986c45310f37effe031f60009fbcab
ethevenot
parents:
diff changeset
128
ef64d3752050 planemo upload for repository https://github.com/workflow4metabolomics/univariate.git commit ca0e312e1c986c45310f37effe031f60009fbcab
ethevenot
parents:
diff changeset
129 flgF("0 <= as.numeric(argVc['thrN']) && as.numeric(argVc['thrN']) <= 1",
ef64d3752050 planemo upload for repository https://github.com/workflow4metabolomics/univariate.git commit ca0e312e1c986c45310f37effe031f60009fbcab
ethevenot
parents:
diff changeset
130 txtC = "(corrected) p-value threshold must be between 0 and 1")
ef64d3752050 planemo upload for repository https://github.com/workflow4metabolomics/univariate.git commit ca0e312e1c986c45310f37effe031f60009fbcab
ethevenot
parents:
diff changeset
131
ef64d3752050 planemo upload for repository https://github.com/workflow4metabolomics/univariate.git commit ca0e312e1c986c45310f37effe031f60009fbcab
ethevenot
parents:
diff changeset
132
ef64d3752050 planemo upload for repository https://github.com/workflow4metabolomics/univariate.git commit ca0e312e1c986c45310f37effe031f60009fbcab
ethevenot
parents:
diff changeset
133 ##------------------------------
ef64d3752050 planemo upload for repository https://github.com/workflow4metabolomics/univariate.git commit ca0e312e1c986c45310f37effe031f60009fbcab
ethevenot
parents:
diff changeset
134 ## Computation
ef64d3752050 planemo upload for repository https://github.com/workflow4metabolomics/univariate.git commit ca0e312e1c986c45310f37effe031f60009fbcab
ethevenot
parents:
diff changeset
135 ##------------------------------
ef64d3752050 planemo upload for repository https://github.com/workflow4metabolomics/univariate.git commit ca0e312e1c986c45310f37effe031f60009fbcab
ethevenot
parents:
diff changeset
136
ef64d3752050 planemo upload for repository https://github.com/workflow4metabolomics/univariate.git commit ca0e312e1c986c45310f37effe031f60009fbcab
ethevenot
parents:
diff changeset
137
ef64d3752050 planemo upload for repository https://github.com/workflow4metabolomics/univariate.git commit ca0e312e1c986c45310f37effe031f60009fbcab
ethevenot
parents:
diff changeset
138 varDF <- univariateF(datMN = datMN,
ef64d3752050 planemo upload for repository https://github.com/workflow4metabolomics/univariate.git commit ca0e312e1c986c45310f37effe031f60009fbcab
ethevenot
parents:
diff changeset
139 samDF = samDF,
ef64d3752050 planemo upload for repository https://github.com/workflow4metabolomics/univariate.git commit ca0e312e1c986c45310f37effe031f60009fbcab
ethevenot
parents:
diff changeset
140 varDF = varDF,
ef64d3752050 planemo upload for repository https://github.com/workflow4metabolomics/univariate.git commit ca0e312e1c986c45310f37effe031f60009fbcab
ethevenot
parents:
diff changeset
141 facC = argVc["facC"],
ef64d3752050 planemo upload for repository https://github.com/workflow4metabolomics/univariate.git commit ca0e312e1c986c45310f37effe031f60009fbcab
ethevenot
parents:
diff changeset
142 tesC = tesC,
ef64d3752050 planemo upload for repository https://github.com/workflow4metabolomics/univariate.git commit ca0e312e1c986c45310f37effe031f60009fbcab
ethevenot
parents:
diff changeset
143 adjC = argVc["adjC"],
3
140290de7986 planemo upload for repository https://github.com/workflow4metabolomics/univariate.git commit 27bc6157f43574f038b3fb1be1f46ce4786e24b1
ethevenot
parents: 2
diff changeset
144 thrN = as.numeric(argVc["thrN"]),
140290de7986 planemo upload for repository https://github.com/workflow4metabolomics/univariate.git commit 27bc6157f43574f038b3fb1be1f46ce4786e24b1
ethevenot
parents: 2
diff changeset
145 pdfC = argVc["figure"])
0
ef64d3752050 planemo upload for repository https://github.com/workflow4metabolomics/univariate.git commit ca0e312e1c986c45310f37effe031f60009fbcab
ethevenot
parents:
diff changeset
146
ef64d3752050 planemo upload for repository https://github.com/workflow4metabolomics/univariate.git commit ca0e312e1c986c45310f37effe031f60009fbcab
ethevenot
parents:
diff changeset
147
ef64d3752050 planemo upload for repository https://github.com/workflow4metabolomics/univariate.git commit ca0e312e1c986c45310f37effe031f60009fbcab
ethevenot
parents:
diff changeset
148 ##------------------------------
ef64d3752050 planemo upload for repository https://github.com/workflow4metabolomics/univariate.git commit ca0e312e1c986c45310f37effe031f60009fbcab
ethevenot
parents:
diff changeset
149 ## Ending
ef64d3752050 planemo upload for repository https://github.com/workflow4metabolomics/univariate.git commit ca0e312e1c986c45310f37effe031f60009fbcab
ethevenot
parents:
diff changeset
150 ##------------------------------
ef64d3752050 planemo upload for repository https://github.com/workflow4metabolomics/univariate.git commit ca0e312e1c986c45310f37effe031f60009fbcab
ethevenot
parents:
diff changeset
151
ef64d3752050 planemo upload for repository https://github.com/workflow4metabolomics/univariate.git commit ca0e312e1c986c45310f37effe031f60009fbcab
ethevenot
parents:
diff changeset
152
ef64d3752050 planemo upload for repository https://github.com/workflow4metabolomics/univariate.git commit ca0e312e1c986c45310f37effe031f60009fbcab
ethevenot
parents:
diff changeset
153 ## saving
ef64d3752050 planemo upload for repository https://github.com/workflow4metabolomics/univariate.git commit ca0e312e1c986c45310f37effe031f60009fbcab
ethevenot
parents:
diff changeset
154 ##--------
ef64d3752050 planemo upload for repository https://github.com/workflow4metabolomics/univariate.git commit ca0e312e1c986c45310f37effe031f60009fbcab
ethevenot
parents:
diff changeset
155
ef64d3752050 planemo upload for repository https://github.com/workflow4metabolomics/univariate.git commit ca0e312e1c986c45310f37effe031f60009fbcab
ethevenot
parents:
diff changeset
156 varDF <- cbind.data.frame(variableMetadata = rownames(varDF),
ef64d3752050 planemo upload for repository https://github.com/workflow4metabolomics/univariate.git commit ca0e312e1c986c45310f37effe031f60009fbcab
ethevenot
parents:
diff changeset
157 varDF)
2
09799fc16bc6 planemo upload for repository https://github.com/workflow4metabolomics/univariate.git commit 2c0d4d97c208edca1ada2035a7b7af9c4eb31afe
ethevenot
parents: 0
diff changeset
158
0
ef64d3752050 planemo upload for repository https://github.com/workflow4metabolomics/univariate.git commit ca0e312e1c986c45310f37effe031f60009fbcab
ethevenot
parents:
diff changeset
159 write.table(varDF,
ef64d3752050 planemo upload for repository https://github.com/workflow4metabolomics/univariate.git commit ca0e312e1c986c45310f37effe031f60009fbcab
ethevenot
parents:
diff changeset
160 file = argVc["variableMetadata_out"],
ef64d3752050 planemo upload for repository https://github.com/workflow4metabolomics/univariate.git commit ca0e312e1c986c45310f37effe031f60009fbcab
ethevenot
parents:
diff changeset
161 quote = FALSE,
ef64d3752050 planemo upload for repository https://github.com/workflow4metabolomics/univariate.git commit ca0e312e1c986c45310f37effe031f60009fbcab
ethevenot
parents:
diff changeset
162 row.names = FALSE,
ef64d3752050 planemo upload for repository https://github.com/workflow4metabolomics/univariate.git commit ca0e312e1c986c45310f37effe031f60009fbcab
ethevenot
parents:
diff changeset
163 sep = "\t")
ef64d3752050 planemo upload for repository https://github.com/workflow4metabolomics/univariate.git commit ca0e312e1c986c45310f37effe031f60009fbcab
ethevenot
parents:
diff changeset
164
ef64d3752050 planemo upload for repository https://github.com/workflow4metabolomics/univariate.git commit ca0e312e1c986c45310f37effe031f60009fbcab
ethevenot
parents:
diff changeset
165 ## closing
ef64d3752050 planemo upload for repository https://github.com/workflow4metabolomics/univariate.git commit ca0e312e1c986c45310f37effe031f60009fbcab
ethevenot
parents:
diff changeset
166 ##--------
ef64d3752050 planemo upload for repository https://github.com/workflow4metabolomics/univariate.git commit ca0e312e1c986c45310f37effe031f60009fbcab
ethevenot
parents:
diff changeset
167
ef64d3752050 planemo upload for repository https://github.com/workflow4metabolomics/univariate.git commit ca0e312e1c986c45310f37effe031f60009fbcab
ethevenot
parents:
diff changeset
168 cat("\nEnd of '", modNamC, "' Galaxy module call: ",
ef64d3752050 planemo upload for repository https://github.com/workflow4metabolomics/univariate.git commit ca0e312e1c986c45310f37effe031f60009fbcab
ethevenot
parents:
diff changeset
169 as.character(Sys.time()), "\n", sep = "")
ef64d3752050 planemo upload for repository https://github.com/workflow4metabolomics/univariate.git commit ca0e312e1c986c45310f37effe031f60009fbcab
ethevenot
parents:
diff changeset
170
4
3017385625f6 planemo upload for repository https://github.com/workflow4metabolomics/univariate.git commit a81d4cc1df719dcc66def660927abda74972afaa
ethevenot
parents: 3
diff changeset
171 cat("\n\n\n============================================================================")
3017385625f6 planemo upload for repository https://github.com/workflow4metabolomics/univariate.git commit a81d4cc1df719dcc66def660927abda74972afaa
ethevenot
parents: 3
diff changeset
172 cat("\nAdditional information about the call:\n")
3017385625f6 planemo upload for repository https://github.com/workflow4metabolomics/univariate.git commit a81d4cc1df719dcc66def660927abda74972afaa
ethevenot
parents: 3
diff changeset
173 cat("\n1) Parameters:\n")
3017385625f6 planemo upload for repository https://github.com/workflow4metabolomics/univariate.git commit a81d4cc1df719dcc66def660927abda74972afaa
ethevenot
parents: 3
diff changeset
174 print(cbind(value = argVc))
3017385625f6 planemo upload for repository https://github.com/workflow4metabolomics/univariate.git commit a81d4cc1df719dcc66def660927abda74972afaa
ethevenot
parents: 3
diff changeset
175
3017385625f6 planemo upload for repository https://github.com/workflow4metabolomics/univariate.git commit a81d4cc1df719dcc66def660927abda74972afaa
ethevenot
parents: 3
diff changeset
176 cat("\n2) Session Info:\n")
3017385625f6 planemo upload for repository https://github.com/workflow4metabolomics/univariate.git commit a81d4cc1df719dcc66def660927abda74972afaa
ethevenot
parents: 3
diff changeset
177 sessioninfo <- sessionInfo()
3017385625f6 planemo upload for repository https://github.com/workflow4metabolomics/univariate.git commit a81d4cc1df719dcc66def660927abda74972afaa
ethevenot
parents: 3
diff changeset
178 cat(sessioninfo$R.version$version.string,"\n")
3017385625f6 planemo upload for repository https://github.com/workflow4metabolomics/univariate.git commit a81d4cc1df719dcc66def660927abda74972afaa
ethevenot
parents: 3
diff changeset
179 cat("Main packages:\n")
3017385625f6 planemo upload for repository https://github.com/workflow4metabolomics/univariate.git commit a81d4cc1df719dcc66def660927abda74972afaa
ethevenot
parents: 3
diff changeset
180 for (pkg in names(sessioninfo$otherPkgs)) { cat(paste(pkg,packageVersion(pkg)),"\t") }; cat("\n")
3017385625f6 planemo upload for repository https://github.com/workflow4metabolomics/univariate.git commit a81d4cc1df719dcc66def660927abda74972afaa
ethevenot
parents: 3
diff changeset
181 cat("Other loaded packages:\n")
3017385625f6 planemo upload for repository https://github.com/workflow4metabolomics/univariate.git commit a81d4cc1df719dcc66def660927abda74972afaa
ethevenot
parents: 3
diff changeset
182 for (pkg in names(sessioninfo$loadedOnly)) { cat(paste(pkg,packageVersion(pkg)),"\t") }; cat("\n")
3017385625f6 planemo upload for repository https://github.com/workflow4metabolomics/univariate.git commit a81d4cc1df719dcc66def660927abda74972afaa
ethevenot
parents: 3
diff changeset
183
3017385625f6 planemo upload for repository https://github.com/workflow4metabolomics/univariate.git commit a81d4cc1df719dcc66def660927abda74972afaa
ethevenot
parents: 3
diff changeset
184 cat("============================================================================\n")
3017385625f6 planemo upload for repository https://github.com/workflow4metabolomics/univariate.git commit a81d4cc1df719dcc66def660927abda74972afaa
ethevenot
parents: 3
diff changeset
185
0
ef64d3752050 planemo upload for repository https://github.com/workflow4metabolomics/univariate.git commit ca0e312e1c986c45310f37effe031f60009fbcab
ethevenot
parents:
diff changeset
186 sink()
ef64d3752050 planemo upload for repository https://github.com/workflow4metabolomics/univariate.git commit ca0e312e1c986c45310f37effe031f60009fbcab
ethevenot
parents:
diff changeset
187
ef64d3752050 planemo upload for repository https://github.com/workflow4metabolomics/univariate.git commit ca0e312e1c986c45310f37effe031f60009fbcab
ethevenot
parents:
diff changeset
188 options(stringsAsFactors = strAsFacL)
ef64d3752050 planemo upload for repository https://github.com/workflow4metabolomics/univariate.git commit ca0e312e1c986c45310f37effe031f60009fbcab
ethevenot
parents:
diff changeset
189
ef64d3752050 planemo upload for repository https://github.com/workflow4metabolomics/univariate.git commit ca0e312e1c986c45310f37effe031f60009fbcab
ethevenot
parents:
diff changeset
190 rm(list = ls())