annotate univariate_wrapper.R @ 3:eb27e0fe9ea3 draft default tip

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