annotate tests/univariate_tests.R @ 0:ef64d3752050 draft

planemo upload for repository https://github.com/workflow4metabolomics/univariate.git commit ca0e312e1c986c45310f37effe031f60009fbcab
author ethevenot
date Wed, 27 Jul 2016 11:44:34 -0400
parents
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 library(RUnit)
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 wrapperF <- function(argVc) {
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
ef64d3752050 planemo upload for repository https://github.com/workflow4metabolomics/univariate.git commit ca0e312e1c986c45310f37effe031f60009fbcab
ethevenot
parents:
diff changeset
6 source("../univariate_script.R")
ef64d3752050 planemo upload for repository https://github.com/workflow4metabolomics/univariate.git commit ca0e312e1c986c45310f37effe031f60009fbcab
ethevenot
parents:
diff changeset
7
ef64d3752050 planemo upload for repository https://github.com/workflow4metabolomics/univariate.git commit ca0e312e1c986c45310f37effe031f60009fbcab
ethevenot
parents:
diff changeset
8
ef64d3752050 planemo upload for repository https://github.com/workflow4metabolomics/univariate.git commit ca0e312e1c986c45310f37effe031f60009fbcab
ethevenot
parents:
diff changeset
9 #### Start_of_testing_code <- function() {}
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
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 ## Initializing
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 ## options
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 strAsFacL <- options()$stringsAsFactors
ef64d3752050 planemo upload for repository https://github.com/workflow4metabolomics/univariate.git commit ca0e312e1c986c45310f37effe031f60009fbcab
ethevenot
parents:
diff changeset
20 options(stringsAsFactors = FALSE)
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 ## packages
ef64d3752050 planemo upload for repository https://github.com/workflow4metabolomics/univariate.git commit ca0e312e1c986c45310f37effe031f60009fbcab
ethevenot
parents:
diff changeset
23 ##---------
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 library(PMCMR)
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 ## constants
ef64d3752050 planemo upload for repository https://github.com/workflow4metabolomics/univariate.git commit ca0e312e1c986c45310f37effe031f60009fbcab
ethevenot
parents:
diff changeset
28 ##----------
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 modNamC <- "Univariate" ## module name
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 topEnvC <- environment()
ef64d3752050 planemo upload for repository https://github.com/workflow4metabolomics/univariate.git commit ca0e312e1c986c45310f37effe031f60009fbcab
ethevenot
parents:
diff changeset
33 flagC <- "\n"
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 ## functions
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 flgF <- function(tesC,
ef64d3752050 planemo upload for repository https://github.com/workflow4metabolomics/univariate.git commit ca0e312e1c986c45310f37effe031f60009fbcab
ethevenot
parents:
diff changeset
39 envC = topEnvC,
ef64d3752050 planemo upload for repository https://github.com/workflow4metabolomics/univariate.git commit ca0e312e1c986c45310f37effe031f60009fbcab
ethevenot
parents:
diff changeset
40 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
41
ef64d3752050 planemo upload for repository https://github.com/workflow4metabolomics/univariate.git commit ca0e312e1c986c45310f37effe031f60009fbcab
ethevenot
parents:
diff changeset
42 tesL <- eval(parse(text = tesC), envir = envC)
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 if(!tesL) {
ef64d3752050 planemo upload for repository https://github.com/workflow4metabolomics/univariate.git commit ca0e312e1c986c45310f37effe031f60009fbcab
ethevenot
parents:
diff changeset
45
ef64d3752050 planemo upload for repository https://github.com/workflow4metabolomics/univariate.git commit ca0e312e1c986c45310f37effe031f60009fbcab
ethevenot
parents:
diff changeset
46 sink(NULL)
ef64d3752050 planemo upload for repository https://github.com/workflow4metabolomics/univariate.git commit ca0e312e1c986c45310f37effe031f60009fbcab
ethevenot
parents:
diff changeset
47 stpTxtC <- ifelse(is.na(txtC),
ef64d3752050 planemo upload for repository https://github.com/workflow4metabolomics/univariate.git commit ca0e312e1c986c45310f37effe031f60009fbcab
ethevenot
parents:
diff changeset
48 paste0(tesC, " is FALSE"),
ef64d3752050 planemo upload for repository https://github.com/workflow4metabolomics/univariate.git commit ca0e312e1c986c45310f37effe031f60009fbcab
ethevenot
parents:
diff changeset
49 txtC)
ef64d3752050 planemo upload for repository https://github.com/workflow4metabolomics/univariate.git commit ca0e312e1c986c45310f37effe031f60009fbcab
ethevenot
parents:
diff changeset
50
ef64d3752050 planemo upload for repository https://github.com/workflow4metabolomics/univariate.git commit ca0e312e1c986c45310f37effe031f60009fbcab
ethevenot
parents:
diff changeset
51 stop(stpTxtC,
ef64d3752050 planemo upload for repository https://github.com/workflow4metabolomics/univariate.git commit ca0e312e1c986c45310f37effe031f60009fbcab
ethevenot
parents:
diff changeset
52 call. = FALSE)
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
ef64d3752050 planemo upload for repository https://github.com/workflow4metabolomics/univariate.git commit ca0e312e1c986c45310f37effe031f60009fbcab
ethevenot
parents:
diff changeset
56 } ## flgF
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 ## log file
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
ef64d3752050 planemo upload for repository https://github.com/workflow4metabolomics/univariate.git commit ca0e312e1c986c45310f37effe031f60009fbcab
ethevenot
parents:
diff changeset
61 sink(argVc["information"])
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 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
64 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
65
ef64d3752050 planemo upload for repository https://github.com/workflow4metabolomics/univariate.git commit ca0e312e1c986c45310f37effe031f60009fbcab
ethevenot
parents:
diff changeset
66 ## loading
ef64d3752050 planemo upload for repository https://github.com/workflow4metabolomics/univariate.git commit ca0e312e1c986c45310f37effe031f60009fbcab
ethevenot
parents:
diff changeset
67 ##--------
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 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
70 check.names = FALSE,
ef64d3752050 planemo upload for repository https://github.com/workflow4metabolomics/univariate.git commit ca0e312e1c986c45310f37effe031f60009fbcab
ethevenot
parents:
diff changeset
71 header = TRUE,
ef64d3752050 planemo upload for repository https://github.com/workflow4metabolomics/univariate.git commit ca0e312e1c986c45310f37effe031f60009fbcab
ethevenot
parents:
diff changeset
72 row.names = 1,
ef64d3752050 planemo upload for repository https://github.com/workflow4metabolomics/univariate.git commit ca0e312e1c986c45310f37effe031f60009fbcab
ethevenot
parents:
diff changeset
73 sep = "\t")))
ef64d3752050 planemo upload for repository https://github.com/workflow4metabolomics/univariate.git commit ca0e312e1c986c45310f37effe031f60009fbcab
ethevenot
parents:
diff changeset
74
ef64d3752050 planemo upload for repository https://github.com/workflow4metabolomics/univariate.git commit ca0e312e1c986c45310f37effe031f60009fbcab
ethevenot
parents:
diff changeset
75 samDF <- read.table(argVc["sampleMetadata_in"],
ef64d3752050 planemo upload for repository https://github.com/workflow4metabolomics/univariate.git commit ca0e312e1c986c45310f37effe031f60009fbcab
ethevenot
parents:
diff changeset
76 check.names = FALSE,
ef64d3752050 planemo upload for repository https://github.com/workflow4metabolomics/univariate.git commit ca0e312e1c986c45310f37effe031f60009fbcab
ethevenot
parents:
diff changeset
77 header = TRUE,
ef64d3752050 planemo upload for repository https://github.com/workflow4metabolomics/univariate.git commit ca0e312e1c986c45310f37effe031f60009fbcab
ethevenot
parents:
diff changeset
78 row.names = 1,
ef64d3752050 planemo upload for repository https://github.com/workflow4metabolomics/univariate.git commit ca0e312e1c986c45310f37effe031f60009fbcab
ethevenot
parents:
diff changeset
79 sep = "\t")
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 varDF <- read.table(argVc["variableMetadata_in"],
ef64d3752050 planemo upload for repository https://github.com/workflow4metabolomics/univariate.git commit ca0e312e1c986c45310f37effe031f60009fbcab
ethevenot
parents:
diff changeset
82 check.names = FALSE,
ef64d3752050 planemo upload for repository https://github.com/workflow4metabolomics/univariate.git commit ca0e312e1c986c45310f37effe031f60009fbcab
ethevenot
parents:
diff changeset
83 header = TRUE,
ef64d3752050 planemo upload for repository https://github.com/workflow4metabolomics/univariate.git commit ca0e312e1c986c45310f37effe031f60009fbcab
ethevenot
parents:
diff changeset
84 row.names = 1,
ef64d3752050 planemo upload for repository https://github.com/workflow4metabolomics/univariate.git commit ca0e312e1c986c45310f37effe031f60009fbcab
ethevenot
parents:
diff changeset
85 sep = "\t")
ef64d3752050 planemo upload for repository https://github.com/workflow4metabolomics/univariate.git commit ca0e312e1c986c45310f37effe031f60009fbcab
ethevenot
parents:
diff changeset
86
ef64d3752050 planemo upload for repository https://github.com/workflow4metabolomics/univariate.git commit ca0e312e1c986c45310f37effe031f60009fbcab
ethevenot
parents:
diff changeset
87 tesC <- argVc["tesC"]
ef64d3752050 planemo upload for repository https://github.com/workflow4metabolomics/univariate.git commit ca0e312e1c986c45310f37effe031f60009fbcab
ethevenot
parents:
diff changeset
88
ef64d3752050 planemo upload for repository https://github.com/workflow4metabolomics/univariate.git commit ca0e312e1c986c45310f37effe031f60009fbcab
ethevenot
parents:
diff changeset
89 ## checking
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
ef64d3752050 planemo upload for repository https://github.com/workflow4metabolomics/univariate.git commit ca0e312e1c986c45310f37effe031f60009fbcab
ethevenot
parents:
diff changeset
92 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
93 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
94
ef64d3752050 planemo upload for repository https://github.com/workflow4metabolomics/univariate.git commit ca0e312e1c986c45310f37effe031f60009fbcab
ethevenot
parents:
diff changeset
95 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
96 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
97
ef64d3752050 planemo upload for repository https://github.com/workflow4metabolomics/univariate.git commit ca0e312e1c986c45310f37effe031f60009fbcab
ethevenot
parents:
diff changeset
98 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
99 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
100 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
101
ef64d3752050 planemo upload for repository https://github.com/workflow4metabolomics/univariate.git commit ca0e312e1c986c45310f37effe031f60009fbcab
ethevenot
parents:
diff changeset
102 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
103
ef64d3752050 planemo upload for repository https://github.com/workflow4metabolomics/univariate.git commit ca0e312e1c986c45310f37effe031f60009fbcab
ethevenot
parents:
diff changeset
104 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
105 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
106
ef64d3752050 planemo upload for repository https://github.com/workflow4metabolomics/univariate.git commit ca0e312e1c986c45310f37effe031f60009fbcab
ethevenot
parents:
diff changeset
107
ef64d3752050 planemo upload for repository https://github.com/workflow4metabolomics/univariate.git commit ca0e312e1c986c45310f37effe031f60009fbcab
ethevenot
parents:
diff changeset
108 ##------------------------------
ef64d3752050 planemo upload for repository https://github.com/workflow4metabolomics/univariate.git commit ca0e312e1c986c45310f37effe031f60009fbcab
ethevenot
parents:
diff changeset
109 ## Computation
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
ef64d3752050 planemo upload for repository https://github.com/workflow4metabolomics/univariate.git commit ca0e312e1c986c45310f37effe031f60009fbcab
ethevenot
parents:
diff changeset
113 varDF <- univariateF(datMN = datMN,
ef64d3752050 planemo upload for repository https://github.com/workflow4metabolomics/univariate.git commit ca0e312e1c986c45310f37effe031f60009fbcab
ethevenot
parents:
diff changeset
114 samDF = samDF,
ef64d3752050 planemo upload for repository https://github.com/workflow4metabolomics/univariate.git commit ca0e312e1c986c45310f37effe031f60009fbcab
ethevenot
parents:
diff changeset
115 varDF = varDF,
ef64d3752050 planemo upload for repository https://github.com/workflow4metabolomics/univariate.git commit ca0e312e1c986c45310f37effe031f60009fbcab
ethevenot
parents:
diff changeset
116 facC = argVc["facC"],
ef64d3752050 planemo upload for repository https://github.com/workflow4metabolomics/univariate.git commit ca0e312e1c986c45310f37effe031f60009fbcab
ethevenot
parents:
diff changeset
117 tesC = tesC,
ef64d3752050 planemo upload for repository https://github.com/workflow4metabolomics/univariate.git commit ca0e312e1c986c45310f37effe031f60009fbcab
ethevenot
parents:
diff changeset
118 adjC = argVc["adjC"],
ef64d3752050 planemo upload for repository https://github.com/workflow4metabolomics/univariate.git commit ca0e312e1c986c45310f37effe031f60009fbcab
ethevenot
parents:
diff changeset
119 thrN = as.numeric(argVc["thrN"]))
ef64d3752050 planemo upload for repository https://github.com/workflow4metabolomics/univariate.git commit ca0e312e1c986c45310f37effe031f60009fbcab
ethevenot
parents:
diff changeset
120
ef64d3752050 planemo upload for repository https://github.com/workflow4metabolomics/univariate.git commit ca0e312e1c986c45310f37effe031f60009fbcab
ethevenot
parents:
diff changeset
121
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 ## Ending
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 ## saving
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 varDF <- cbind.data.frame(variableMetadata = rownames(varDF),
ef64d3752050 planemo upload for repository https://github.com/workflow4metabolomics/univariate.git commit ca0e312e1c986c45310f37effe031f60009fbcab
ethevenot
parents:
diff changeset
131 varDF)
ef64d3752050 planemo upload for repository https://github.com/workflow4metabolomics/univariate.git commit ca0e312e1c986c45310f37effe031f60009fbcab
ethevenot
parents:
diff changeset
132 write.table(varDF,
ef64d3752050 planemo upload for repository https://github.com/workflow4metabolomics/univariate.git commit ca0e312e1c986c45310f37effe031f60009fbcab
ethevenot
parents:
diff changeset
133 file = argVc["variableMetadata_out"],
ef64d3752050 planemo upload for repository https://github.com/workflow4metabolomics/univariate.git commit ca0e312e1c986c45310f37effe031f60009fbcab
ethevenot
parents:
diff changeset
134 quote = FALSE,
ef64d3752050 planemo upload for repository https://github.com/workflow4metabolomics/univariate.git commit ca0e312e1c986c45310f37effe031f60009fbcab
ethevenot
parents:
diff changeset
135 row.names = FALSE,
ef64d3752050 planemo upload for repository https://github.com/workflow4metabolomics/univariate.git commit ca0e312e1c986c45310f37effe031f60009fbcab
ethevenot
parents:
diff changeset
136 sep = "\t")
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 ## closing
ef64d3752050 planemo upload for repository https://github.com/workflow4metabolomics/univariate.git commit ca0e312e1c986c45310f37effe031f60009fbcab
ethevenot
parents:
diff changeset
139 ##--------
ef64d3752050 planemo upload for repository https://github.com/workflow4metabolomics/univariate.git commit ca0e312e1c986c45310f37effe031f60009fbcab
ethevenot
parents:
diff changeset
140
ef64d3752050 planemo upload for repository https://github.com/workflow4metabolomics/univariate.git commit ca0e312e1c986c45310f37effe031f60009fbcab
ethevenot
parents:
diff changeset
141 cat("\nEnd of '", modNamC, "' Galaxy module call: ",
ef64d3752050 planemo upload for repository https://github.com/workflow4metabolomics/univariate.git commit ca0e312e1c986c45310f37effe031f60009fbcab
ethevenot
parents:
diff changeset
142 as.character(Sys.time()), "\n", sep = "")
ef64d3752050 planemo upload for repository https://github.com/workflow4metabolomics/univariate.git commit ca0e312e1c986c45310f37effe031f60009fbcab
ethevenot
parents:
diff changeset
143
ef64d3752050 planemo upload for repository https://github.com/workflow4metabolomics/univariate.git commit ca0e312e1c986c45310f37effe031f60009fbcab
ethevenot
parents:
diff changeset
144 sink()
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 options(stringsAsFactors = strAsFacL)
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
ef64d3752050 planemo upload for repository https://github.com/workflow4metabolomics/univariate.git commit ca0e312e1c986c45310f37effe031f60009fbcab
ethevenot
parents:
diff changeset
150 #### End_of_testing_code <- function() {}
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 return(list(varDF = varDF))
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 rm(list = ls())
ef64d3752050 planemo upload for repository https://github.com/workflow4metabolomics/univariate.git commit ca0e312e1c986c45310f37effe031f60009fbcab
ethevenot
parents:
diff changeset
156
ef64d3752050 planemo upload for repository https://github.com/workflow4metabolomics/univariate.git commit ca0e312e1c986c45310f37effe031f60009fbcab
ethevenot
parents:
diff changeset
157 }
ef64d3752050 planemo upload for repository https://github.com/workflow4metabolomics/univariate.git commit ca0e312e1c986c45310f37effe031f60009fbcab
ethevenot
parents:
diff changeset
158
ef64d3752050 planemo upload for repository https://github.com/workflow4metabolomics/univariate.git commit ca0e312e1c986c45310f37effe031f60009fbcab
ethevenot
parents:
diff changeset
159 exaDirOutC <- "output"
ef64d3752050 planemo upload for repository https://github.com/workflow4metabolomics/univariate.git commit ca0e312e1c986c45310f37effe031f60009fbcab
ethevenot
parents:
diff changeset
160 if(!file.exists(exaDirOutC))
ef64d3752050 planemo upload for repository https://github.com/workflow4metabolomics/univariate.git commit ca0e312e1c986c45310f37effe031f60009fbcab
ethevenot
parents:
diff changeset
161 stop("Please create an 'output' subfolder into the (current) 'tests' folder")
ef64d3752050 planemo upload for repository https://github.com/workflow4metabolomics/univariate.git commit ca0e312e1c986c45310f37effe031f60009fbcab
ethevenot
parents:
diff changeset
162
ef64d3752050 planemo upload for repository https://github.com/workflow4metabolomics/univariate.git commit ca0e312e1c986c45310f37effe031f60009fbcab
ethevenot
parents:
diff changeset
163 tesArgLs <- list(input_kruskal = c(facC = "ageGroup",
ef64d3752050 planemo upload for repository https://github.com/workflow4metabolomics/univariate.git commit ca0e312e1c986c45310f37effe031f60009fbcab
ethevenot
parents:
diff changeset
164 tesC = "kruskal",
ef64d3752050 planemo upload for repository https://github.com/workflow4metabolomics/univariate.git commit ca0e312e1c986c45310f37effe031f60009fbcab
ethevenot
parents:
diff changeset
165 adjC = "fdr",
ef64d3752050 planemo upload for repository https://github.com/workflow4metabolomics/univariate.git commit ca0e312e1c986c45310f37effe031f60009fbcab
ethevenot
parents:
diff changeset
166 thrN = "0.05",
ef64d3752050 planemo upload for repository https://github.com/workflow4metabolomics/univariate.git commit ca0e312e1c986c45310f37effe031f60009fbcab
ethevenot
parents:
diff changeset
167 .chkC = "checkEqualsNumeric(outLs[['varDF']]['HMDB01032', 'ageGroup_kruskal_senior-experienced_pva'], 0.1231246, tolerance = 1e-6)"),
ef64d3752050 planemo upload for repository https://github.com/workflow4metabolomics/univariate.git commit ca0e312e1c986c45310f37effe031f60009fbcab
ethevenot
parents:
diff changeset
168 example1_wilcoxDif = c(facC = "jour",
ef64d3752050 planemo upload for repository https://github.com/workflow4metabolomics/univariate.git commit ca0e312e1c986c45310f37effe031f60009fbcab
ethevenot
parents:
diff changeset
169 tesC = "wilcoxon",
ef64d3752050 planemo upload for repository https://github.com/workflow4metabolomics/univariate.git commit ca0e312e1c986c45310f37effe031f60009fbcab
ethevenot
parents:
diff changeset
170 adjC = "fdr",
ef64d3752050 planemo upload for repository https://github.com/workflow4metabolomics/univariate.git commit ca0e312e1c986c45310f37effe031f60009fbcab
ethevenot
parents:
diff changeset
171 thrN = "0.05",
ef64d3752050 planemo upload for repository https://github.com/workflow4metabolomics/univariate.git commit ca0e312e1c986c45310f37effe031f60009fbcab
ethevenot
parents:
diff changeset
172 .chkC = "checkEqualsNumeric(outLs[['varDF']]['MT3', 'jour_wilcoxon_J3-J10_dif'], 0.216480042, tolerance = 1e-8)"),
ef64d3752050 planemo upload for repository https://github.com/workflow4metabolomics/univariate.git commit ca0e312e1c986c45310f37effe031f60009fbcab
ethevenot
parents:
diff changeset
173 example1_ttestFdr = c(facC = "jour",
ef64d3752050 planemo upload for repository https://github.com/workflow4metabolomics/univariate.git commit ca0e312e1c986c45310f37effe031f60009fbcab
ethevenot
parents:
diff changeset
174 tesC = "ttest",
ef64d3752050 planemo upload for repository https://github.com/workflow4metabolomics/univariate.git commit ca0e312e1c986c45310f37effe031f60009fbcab
ethevenot
parents:
diff changeset
175 adjC = "fdr",
ef64d3752050 planemo upload for repository https://github.com/workflow4metabolomics/univariate.git commit ca0e312e1c986c45310f37effe031f60009fbcab
ethevenot
parents:
diff changeset
176 thrN = "0.05",
ef64d3752050 planemo upload for repository https://github.com/workflow4metabolomics/univariate.git commit ca0e312e1c986c45310f37effe031f60009fbcab
ethevenot
parents:
diff changeset
177 .chkC = "checkEqualsNumeric(outLs[['varDF']]['MT3', 'jour_ttest_J3-J10_fdr'], 0.7605966, tolerance = 1e-6)"))
ef64d3752050 planemo upload for repository https://github.com/workflow4metabolomics/univariate.git commit ca0e312e1c986c45310f37effe031f60009fbcab
ethevenot
parents:
diff changeset
178
ef64d3752050 planemo upload for repository https://github.com/workflow4metabolomics/univariate.git commit ca0e312e1c986c45310f37effe031f60009fbcab
ethevenot
parents:
diff changeset
179 for(tesC in names(tesArgLs))
ef64d3752050 planemo upload for repository https://github.com/workflow4metabolomics/univariate.git commit ca0e312e1c986c45310f37effe031f60009fbcab
ethevenot
parents:
diff changeset
180 tesArgLs[[tesC]] <- c(tesArgLs[[tesC]],
ef64d3752050 planemo upload for repository https://github.com/workflow4metabolomics/univariate.git commit ca0e312e1c986c45310f37effe031f60009fbcab
ethevenot
parents:
diff changeset
181 dataMatrix_in = file.path(unlist(strsplit(tesC, "_"))[1], "dataMatrix.tsv"),
ef64d3752050 planemo upload for repository https://github.com/workflow4metabolomics/univariate.git commit ca0e312e1c986c45310f37effe031f60009fbcab
ethevenot
parents:
diff changeset
182 sampleMetadata_in = file.path(unlist(strsplit(tesC, "_"))[1], "sampleMetadata.tsv"),
ef64d3752050 planemo upload for repository https://github.com/workflow4metabolomics/univariate.git commit ca0e312e1c986c45310f37effe031f60009fbcab
ethevenot
parents:
diff changeset
183 variableMetadata_in = file.path(unlist(strsplit(tesC, "_"))[1], "variableMetadata.tsv"),
ef64d3752050 planemo upload for repository https://github.com/workflow4metabolomics/univariate.git commit ca0e312e1c986c45310f37effe031f60009fbcab
ethevenot
parents:
diff changeset
184 variableMetadata_out = file.path(exaDirOutC, "variableMetadata.tsv"),
ef64d3752050 planemo upload for repository https://github.com/workflow4metabolomics/univariate.git commit ca0e312e1c986c45310f37effe031f60009fbcab
ethevenot
parents:
diff changeset
185 information = file.path(exaDirOutC, "information.txt"))
ef64d3752050 planemo upload for repository https://github.com/workflow4metabolomics/univariate.git commit ca0e312e1c986c45310f37effe031f60009fbcab
ethevenot
parents:
diff changeset
186
ef64d3752050 planemo upload for repository https://github.com/workflow4metabolomics/univariate.git commit ca0e312e1c986c45310f37effe031f60009fbcab
ethevenot
parents:
diff changeset
187 for(tesC in names(tesArgLs)) {
ef64d3752050 planemo upload for repository https://github.com/workflow4metabolomics/univariate.git commit ca0e312e1c986c45310f37effe031f60009fbcab
ethevenot
parents:
diff changeset
188 print(tesC)
ef64d3752050 planemo upload for repository https://github.com/workflow4metabolomics/univariate.git commit ca0e312e1c986c45310f37effe031f60009fbcab
ethevenot
parents:
diff changeset
189 outLs <- wrapperF(tesArgLs[[tesC]])
ef64d3752050 planemo upload for repository https://github.com/workflow4metabolomics/univariate.git commit ca0e312e1c986c45310f37effe031f60009fbcab
ethevenot
parents:
diff changeset
190 if(".chkC" %in% names(tesArgLs[[tesC]]))
ef64d3752050 planemo upload for repository https://github.com/workflow4metabolomics/univariate.git commit ca0e312e1c986c45310f37effe031f60009fbcab
ethevenot
parents:
diff changeset
191 stopifnot(eval(parse(text = tesArgLs[[tesC]][[".chkC"]])))
ef64d3752050 planemo upload for repository https://github.com/workflow4metabolomics/univariate.git commit ca0e312e1c986c45310f37effe031f60009fbcab
ethevenot
parents:
diff changeset
192 }
ef64d3752050 planemo upload for repository https://github.com/workflow4metabolomics/univariate.git commit ca0e312e1c986c45310f37effe031f60009fbcab
ethevenot
parents:
diff changeset
193
ef64d3752050 planemo upload for repository https://github.com/workflow4metabolomics/univariate.git commit ca0e312e1c986c45310f37effe031f60009fbcab
ethevenot
parents:
diff changeset
194 message("Checks successfully completed")