Mercurial > repos > ethevenot > univariate
annotate univariate_wrapper.R @ 3:140290de7986 draft
planemo upload for repository https://github.com/workflow4metabolomics/univariate.git commit 27bc6157f43574f038b3fb1be1f46ce4786e24b1
author | ethevenot |
---|---|
date | Sun, 30 Oct 2016 14:17:09 -0400 |
parents | 09799fc16bc6 |
children | 3017385625f6 |
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 |
ef64d3752050
planemo upload for repository https://github.com/workflow4metabolomics/univariate.git commit ca0e312e1c986c45310f37effe031f60009fbcab
ethevenot
parents:
diff
changeset
|
5 source_local <- function(fname){ |
ef64d3752050
planemo upload for repository https://github.com/workflow4metabolomics/univariate.git commit ca0e312e1c986c45310f37effe031f60009fbcab
ethevenot
parents:
diff
changeset
|
6 argv <- commandArgs(trailingOnly = FALSE) |
ef64d3752050
planemo upload for repository https://github.com/workflow4metabolomics/univariate.git commit ca0e312e1c986c45310f37effe031f60009fbcab
ethevenot
parents:
diff
changeset
|
7 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
|
8 source(paste(base_dir, fname, sep="/")) |
ef64d3752050
planemo upload for repository https://github.com/workflow4metabolomics/univariate.git commit ca0e312e1c986c45310f37effe031f60009fbcab
ethevenot
parents:
diff
changeset
|
9 } |
ef64d3752050
planemo upload for repository https://github.com/workflow4metabolomics/univariate.git commit ca0e312e1c986c45310f37effe031f60009fbcab
ethevenot
parents:
diff
changeset
|
10 |
ef64d3752050
planemo upload for repository https://github.com/workflow4metabolomics/univariate.git commit ca0e312e1c986c45310f37effe031f60009fbcab
ethevenot
parents:
diff
changeset
|
11 source_local("univariate_script.R") |
ef64d3752050
planemo upload for repository https://github.com/workflow4metabolomics/univariate.git commit ca0e312e1c986c45310f37effe031f60009fbcab
ethevenot
parents:
diff
changeset
|
12 |
ef64d3752050
planemo upload for repository https://github.com/workflow4metabolomics/univariate.git commit ca0e312e1c986c45310f37effe031f60009fbcab
ethevenot
parents:
diff
changeset
|
13 argVc <- unlist(parseCommandArgs(evaluate=FALSE)) |
ef64d3752050
planemo upload for repository https://github.com/workflow4metabolomics/univariate.git commit ca0e312e1c986c45310f37effe031f60009fbcab
ethevenot
parents:
diff
changeset
|
14 |
ef64d3752050
planemo upload for repository https://github.com/workflow4metabolomics/univariate.git commit ca0e312e1c986c45310f37effe031f60009fbcab
ethevenot
parents:
diff
changeset
|
15 ##------------------------------ |
ef64d3752050
planemo upload for repository https://github.com/workflow4metabolomics/univariate.git commit ca0e312e1c986c45310f37effe031f60009fbcab
ethevenot
parents:
diff
changeset
|
16 ## Initializing |
ef64d3752050
planemo upload for repository https://github.com/workflow4metabolomics/univariate.git commit ca0e312e1c986c45310f37effe031f60009fbcab
ethevenot
parents:
diff
changeset
|
17 ##------------------------------ |
ef64d3752050
planemo upload for repository https://github.com/workflow4metabolomics/univariate.git commit ca0e312e1c986c45310f37effe031f60009fbcab
ethevenot
parents:
diff
changeset
|
18 |
ef64d3752050
planemo upload for repository https://github.com/workflow4metabolomics/univariate.git commit ca0e312e1c986c45310f37effe031f60009fbcab
ethevenot
parents:
diff
changeset
|
19 ## options |
ef64d3752050
planemo upload for repository https://github.com/workflow4metabolomics/univariate.git commit ca0e312e1c986c45310f37effe031f60009fbcab
ethevenot
parents:
diff
changeset
|
20 ##-------- |
ef64d3752050
planemo upload for repository https://github.com/workflow4metabolomics/univariate.git commit ca0e312e1c986c45310f37effe031f60009fbcab
ethevenot
parents:
diff
changeset
|
21 |
ef64d3752050
planemo upload for repository https://github.com/workflow4metabolomics/univariate.git commit ca0e312e1c986c45310f37effe031f60009fbcab
ethevenot
parents:
diff
changeset
|
22 strAsFacL <- options()$stringsAsFactors |
ef64d3752050
planemo upload for repository https://github.com/workflow4metabolomics/univariate.git commit ca0e312e1c986c45310f37effe031f60009fbcab
ethevenot
parents:
diff
changeset
|
23 options(stringsAsFactors = FALSE) |
ef64d3752050
planemo upload for repository https://github.com/workflow4metabolomics/univariate.git commit ca0e312e1c986c45310f37effe031f60009fbcab
ethevenot
parents:
diff
changeset
|
24 |
ef64d3752050
planemo upload for repository https://github.com/workflow4metabolomics/univariate.git commit ca0e312e1c986c45310f37effe031f60009fbcab
ethevenot
parents:
diff
changeset
|
25 ## packages |
ef64d3752050
planemo upload for repository https://github.com/workflow4metabolomics/univariate.git commit ca0e312e1c986c45310f37effe031f60009fbcab
ethevenot
parents:
diff
changeset
|
26 ##--------- |
ef64d3752050
planemo upload for repository https://github.com/workflow4metabolomics/univariate.git commit ca0e312e1c986c45310f37effe031f60009fbcab
ethevenot
parents:
diff
changeset
|
27 |
ef64d3752050
planemo upload for repository https://github.com/workflow4metabolomics/univariate.git commit ca0e312e1c986c45310f37effe031f60009fbcab
ethevenot
parents:
diff
changeset
|
28 library(PMCMR) |
ef64d3752050
planemo upload for repository https://github.com/workflow4metabolomics/univariate.git commit ca0e312e1c986c45310f37effe031f60009fbcab
ethevenot
parents:
diff
changeset
|
29 |
ef64d3752050
planemo upload for repository https://github.com/workflow4metabolomics/univariate.git commit ca0e312e1c986c45310f37effe031f60009fbcab
ethevenot
parents:
diff
changeset
|
30 ## constants |
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 modNamC <- "Univariate" ## module name |
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 topEnvC <- environment() |
ef64d3752050
planemo upload for repository https://github.com/workflow4metabolomics/univariate.git commit ca0e312e1c986c45310f37effe031f60009fbcab
ethevenot
parents:
diff
changeset
|
36 flagC <- "\n" |
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 ## functions |
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 flgF <- function(tesC, |
ef64d3752050
planemo upload for repository https://github.com/workflow4metabolomics/univariate.git commit ca0e312e1c986c45310f37effe031f60009fbcab
ethevenot
parents:
diff
changeset
|
42 envC = topEnvC, |
ef64d3752050
planemo upload for repository https://github.com/workflow4metabolomics/univariate.git commit ca0e312e1c986c45310f37effe031f60009fbcab
ethevenot
parents:
diff
changeset
|
43 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
|
44 |
ef64d3752050
planemo upload for repository https://github.com/workflow4metabolomics/univariate.git commit ca0e312e1c986c45310f37effe031f60009fbcab
ethevenot
parents:
diff
changeset
|
45 tesL <- eval(parse(text = tesC), envir = envC) |
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 if(!tesL) { |
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 sink(NULL) |
ef64d3752050
planemo upload for repository https://github.com/workflow4metabolomics/univariate.git commit ca0e312e1c986c45310f37effe031f60009fbcab
ethevenot
parents:
diff
changeset
|
50 stpTxtC <- ifelse(is.na(txtC), |
ef64d3752050
planemo upload for repository https://github.com/workflow4metabolomics/univariate.git commit ca0e312e1c986c45310f37effe031f60009fbcab
ethevenot
parents:
diff
changeset
|
51 paste0(tesC, " is FALSE"), |
ef64d3752050
planemo upload for repository https://github.com/workflow4metabolomics/univariate.git commit ca0e312e1c986c45310f37effe031f60009fbcab
ethevenot
parents:
diff
changeset
|
52 txtC) |
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 stop(stpTxtC, |
ef64d3752050
planemo upload for repository https://github.com/workflow4metabolomics/univariate.git commit ca0e312e1c986c45310f37effe031f60009fbcab
ethevenot
parents:
diff
changeset
|
55 call. = FALSE) |
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 } |
ef64d3752050
planemo upload for repository https://github.com/workflow4metabolomics/univariate.git commit ca0e312e1c986c45310f37effe031f60009fbcab
ethevenot
parents:
diff
changeset
|
58 |
ef64d3752050
planemo upload for repository https://github.com/workflow4metabolomics/univariate.git commit ca0e312e1c986c45310f37effe031f60009fbcab
ethevenot
parents:
diff
changeset
|
59 } ## flgF |
ef64d3752050
planemo upload for repository https://github.com/workflow4metabolomics/univariate.git commit ca0e312e1c986c45310f37effe031f60009fbcab
ethevenot
parents:
diff
changeset
|
60 |
ef64d3752050
planemo upload for repository https://github.com/workflow4metabolomics/univariate.git commit ca0e312e1c986c45310f37effe031f60009fbcab
ethevenot
parents:
diff
changeset
|
61 ## log file |
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 |
ef64d3752050
planemo upload for repository https://github.com/workflow4metabolomics/univariate.git commit ca0e312e1c986c45310f37effe031f60009fbcab
ethevenot
parents:
diff
changeset
|
64 sink(argVc["information"]) |
ef64d3752050
planemo upload for repository https://github.com/workflow4metabolomics/univariate.git commit ca0e312e1c986c45310f37effe031f60009fbcab
ethevenot
parents:
diff
changeset
|
65 |
ef64d3752050
planemo upload for repository https://github.com/workflow4metabolomics/univariate.git commit ca0e312e1c986c45310f37effe031f60009fbcab
ethevenot
parents:
diff
changeset
|
66 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
|
67 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
|
68 |
ef64d3752050
planemo upload for repository https://github.com/workflow4metabolomics/univariate.git commit ca0e312e1c986c45310f37effe031f60009fbcab
ethevenot
parents:
diff
changeset
|
69 ## loading |
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 |
ef64d3752050
planemo upload for repository https://github.com/workflow4metabolomics/univariate.git commit ca0e312e1c986c45310f37effe031f60009fbcab
ethevenot
parents:
diff
changeset
|
72 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
|
73 check.names = FALSE, |
ef64d3752050
planemo upload for repository https://github.com/workflow4metabolomics/univariate.git commit ca0e312e1c986c45310f37effe031f60009fbcab
ethevenot
parents:
diff
changeset
|
74 header = TRUE, |
ef64d3752050
planemo upload for repository https://github.com/workflow4metabolomics/univariate.git commit ca0e312e1c986c45310f37effe031f60009fbcab
ethevenot
parents:
diff
changeset
|
75 row.names = 1, |
ef64d3752050
planemo upload for repository https://github.com/workflow4metabolomics/univariate.git commit ca0e312e1c986c45310f37effe031f60009fbcab
ethevenot
parents:
diff
changeset
|
76 sep = "\t"))) |
ef64d3752050
planemo upload for repository https://github.com/workflow4metabolomics/univariate.git commit ca0e312e1c986c45310f37effe031f60009fbcab
ethevenot
parents:
diff
changeset
|
77 |
ef64d3752050
planemo upload for repository https://github.com/workflow4metabolomics/univariate.git commit ca0e312e1c986c45310f37effe031f60009fbcab
ethevenot
parents:
diff
changeset
|
78 samDF <- read.table(argVc["sampleMetadata_in"], |
ef64d3752050
planemo upload for repository https://github.com/workflow4metabolomics/univariate.git commit ca0e312e1c986c45310f37effe031f60009fbcab
ethevenot
parents:
diff
changeset
|
79 check.names = FALSE, |
ef64d3752050
planemo upload for repository https://github.com/workflow4metabolomics/univariate.git commit ca0e312e1c986c45310f37effe031f60009fbcab
ethevenot
parents:
diff
changeset
|
80 header = TRUE, |
ef64d3752050
planemo upload for repository https://github.com/workflow4metabolomics/univariate.git commit ca0e312e1c986c45310f37effe031f60009fbcab
ethevenot
parents:
diff
changeset
|
81 row.names = 1, |
ef64d3752050
planemo upload for repository https://github.com/workflow4metabolomics/univariate.git commit ca0e312e1c986c45310f37effe031f60009fbcab
ethevenot
parents:
diff
changeset
|
82 sep = "\t") |
ef64d3752050
planemo upload for repository https://github.com/workflow4metabolomics/univariate.git commit ca0e312e1c986c45310f37effe031f60009fbcab
ethevenot
parents:
diff
changeset
|
83 |
ef64d3752050
planemo upload for repository https://github.com/workflow4metabolomics/univariate.git commit ca0e312e1c986c45310f37effe031f60009fbcab
ethevenot
parents:
diff
changeset
|
84 varDF <- read.table(argVc["variableMetadata_in"], |
ef64d3752050
planemo upload for repository https://github.com/workflow4metabolomics/univariate.git commit ca0e312e1c986c45310f37effe031f60009fbcab
ethevenot
parents:
diff
changeset
|
85 check.names = FALSE, |
ef64d3752050
planemo upload for repository https://github.com/workflow4metabolomics/univariate.git commit ca0e312e1c986c45310f37effe031f60009fbcab
ethevenot
parents:
diff
changeset
|
86 header = TRUE, |
ef64d3752050
planemo upload for repository https://github.com/workflow4metabolomics/univariate.git commit ca0e312e1c986c45310f37effe031f60009fbcab
ethevenot
parents:
diff
changeset
|
87 row.names = 1, |
ef64d3752050
planemo upload for repository https://github.com/workflow4metabolomics/univariate.git commit ca0e312e1c986c45310f37effe031f60009fbcab
ethevenot
parents:
diff
changeset
|
88 sep = "\t") |
ef64d3752050
planemo upload for repository https://github.com/workflow4metabolomics/univariate.git commit ca0e312e1c986c45310f37effe031f60009fbcab
ethevenot
parents:
diff
changeset
|
89 |
ef64d3752050
planemo upload for repository https://github.com/workflow4metabolomics/univariate.git commit ca0e312e1c986c45310f37effe031f60009fbcab
ethevenot
parents:
diff
changeset
|
90 tesC <- argVc["tesC"] |
ef64d3752050
planemo upload for repository https://github.com/workflow4metabolomics/univariate.git commit ca0e312e1c986c45310f37effe031f60009fbcab
ethevenot
parents:
diff
changeset
|
91 |
ef64d3752050
planemo upload for repository https://github.com/workflow4metabolomics/univariate.git commit ca0e312e1c986c45310f37effe031f60009fbcab
ethevenot
parents:
diff
changeset
|
92 ## checking |
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 |
ef64d3752050
planemo upload for repository https://github.com/workflow4metabolomics/univariate.git commit ca0e312e1c986c45310f37effe031f60009fbcab
ethevenot
parents:
diff
changeset
|
95 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
|
96 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
|
97 |
ef64d3752050
planemo upload for repository https://github.com/workflow4metabolomics/univariate.git commit ca0e312e1c986c45310f37effe031f60009fbcab
ethevenot
parents:
diff
changeset
|
98 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
|
99 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
|
100 |
ef64d3752050
planemo upload for repository https://github.com/workflow4metabolomics/univariate.git commit ca0e312e1c986c45310f37effe031f60009fbcab
ethevenot
parents:
diff
changeset
|
101 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
|
102 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
|
103 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
|
104 |
ef64d3752050
planemo upload for repository https://github.com/workflow4metabolomics/univariate.git commit ca0e312e1c986c45310f37effe031f60009fbcab
ethevenot
parents:
diff
changeset
|
105 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
|
106 |
ef64d3752050
planemo upload for repository https://github.com/workflow4metabolomics/univariate.git commit ca0e312e1c986c45310f37effe031f60009fbcab
ethevenot
parents:
diff
changeset
|
107 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
|
108 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
|
109 |
ef64d3752050
planemo upload for repository https://github.com/workflow4metabolomics/univariate.git commit ca0e312e1c986c45310f37effe031f60009fbcab
ethevenot
parents:
diff
changeset
|
110 |
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 ## Computation |
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 |
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 varDF <- univariateF(datMN = datMN, |
ef64d3752050
planemo upload for repository https://github.com/workflow4metabolomics/univariate.git commit ca0e312e1c986c45310f37effe031f60009fbcab
ethevenot
parents:
diff
changeset
|
117 samDF = samDF, |
ef64d3752050
planemo upload for repository https://github.com/workflow4metabolomics/univariate.git commit ca0e312e1c986c45310f37effe031f60009fbcab
ethevenot
parents:
diff
changeset
|
118 varDF = varDF, |
ef64d3752050
planemo upload for repository https://github.com/workflow4metabolomics/univariate.git commit ca0e312e1c986c45310f37effe031f60009fbcab
ethevenot
parents:
diff
changeset
|
119 facC = argVc["facC"], |
ef64d3752050
planemo upload for repository https://github.com/workflow4metabolomics/univariate.git commit ca0e312e1c986c45310f37effe031f60009fbcab
ethevenot
parents:
diff
changeset
|
120 tesC = tesC, |
ef64d3752050
planemo upload for repository https://github.com/workflow4metabolomics/univariate.git commit ca0e312e1c986c45310f37effe031f60009fbcab
ethevenot
parents:
diff
changeset
|
121 adjC = argVc["adjC"], |
3
140290de7986
planemo upload for repository https://github.com/workflow4metabolomics/univariate.git commit 27bc6157f43574f038b3fb1be1f46ce4786e24b1
ethevenot
parents:
2
diff
changeset
|
122 thrN = as.numeric(argVc["thrN"]), |
140290de7986
planemo upload for repository https://github.com/workflow4metabolomics/univariate.git commit 27bc6157f43574f038b3fb1be1f46ce4786e24b1
ethevenot
parents:
2
diff
changeset
|
123 pdfC = argVc["figure"]) |
0
ef64d3752050
planemo upload for repository https://github.com/workflow4metabolomics/univariate.git commit ca0e312e1c986c45310f37effe031f60009fbcab
ethevenot
parents:
diff
changeset
|
124 |
ef64d3752050
planemo upload for repository https://github.com/workflow4metabolomics/univariate.git commit ca0e312e1c986c45310f37effe031f60009fbcab
ethevenot
parents:
diff
changeset
|
125 |
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 ## Ending |
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 |
ef64d3752050
planemo upload for repository https://github.com/workflow4metabolomics/univariate.git commit ca0e312e1c986c45310f37effe031f60009fbcab
ethevenot
parents:
diff
changeset
|
130 |
ef64d3752050
planemo upload for repository https://github.com/workflow4metabolomics/univariate.git commit ca0e312e1c986c45310f37effe031f60009fbcab
ethevenot
parents:
diff
changeset
|
131 ## saving |
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 varDF <- cbind.data.frame(variableMetadata = rownames(varDF), |
ef64d3752050
planemo upload for repository https://github.com/workflow4metabolomics/univariate.git commit ca0e312e1c986c45310f37effe031f60009fbcab
ethevenot
parents:
diff
changeset
|
135 varDF) |
2
09799fc16bc6
planemo upload for repository https://github.com/workflow4metabolomics/univariate.git commit 2c0d4d97c208edca1ada2035a7b7af9c4eb31afe
ethevenot
parents:
0
diff
changeset
|
136 |
0
ef64d3752050
planemo upload for repository https://github.com/workflow4metabolomics/univariate.git commit ca0e312e1c986c45310f37effe031f60009fbcab
ethevenot
parents:
diff
changeset
|
137 write.table(varDF, |
ef64d3752050
planemo upload for repository https://github.com/workflow4metabolomics/univariate.git commit ca0e312e1c986c45310f37effe031f60009fbcab
ethevenot
parents:
diff
changeset
|
138 file = argVc["variableMetadata_out"], |
ef64d3752050
planemo upload for repository https://github.com/workflow4metabolomics/univariate.git commit ca0e312e1c986c45310f37effe031f60009fbcab
ethevenot
parents:
diff
changeset
|
139 quote = FALSE, |
ef64d3752050
planemo upload for repository https://github.com/workflow4metabolomics/univariate.git commit ca0e312e1c986c45310f37effe031f60009fbcab
ethevenot
parents:
diff
changeset
|
140 row.names = FALSE, |
ef64d3752050
planemo upload for repository https://github.com/workflow4metabolomics/univariate.git commit ca0e312e1c986c45310f37effe031f60009fbcab
ethevenot
parents:
diff
changeset
|
141 sep = "\t") |
ef64d3752050
planemo upload for repository https://github.com/workflow4metabolomics/univariate.git commit ca0e312e1c986c45310f37effe031f60009fbcab
ethevenot
parents:
diff
changeset
|
142 |
ef64d3752050
planemo upload for repository https://github.com/workflow4metabolomics/univariate.git commit ca0e312e1c986c45310f37effe031f60009fbcab
ethevenot
parents:
diff
changeset
|
143 ## closing |
ef64d3752050
planemo upload for repository https://github.com/workflow4metabolomics/univariate.git commit ca0e312e1c986c45310f37effe031f60009fbcab
ethevenot
parents:
diff
changeset
|
144 ##-------- |
ef64d3752050
planemo upload for repository https://github.com/workflow4metabolomics/univariate.git commit ca0e312e1c986c45310f37effe031f60009fbcab
ethevenot
parents:
diff
changeset
|
145 |
ef64d3752050
planemo upload for repository https://github.com/workflow4metabolomics/univariate.git commit ca0e312e1c986c45310f37effe031f60009fbcab
ethevenot
parents:
diff
changeset
|
146 cat("\nEnd of '", modNamC, "' Galaxy module call: ", |
ef64d3752050
planemo upload for repository https://github.com/workflow4metabolomics/univariate.git commit ca0e312e1c986c45310f37effe031f60009fbcab
ethevenot
parents:
diff
changeset
|
147 as.character(Sys.time()), "\n", sep = "") |
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 sink() |
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 options(stringsAsFactors = strAsFacL) |
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 rm(list = ls()) |