annotate mixmodel_wrapper.R @ 0:1422de181204 draft

planemo upload for repository https://github.com/workflow4metabolomics/mixmodel4repeated_measures commit 6ea32b3182383c19e5333201d2385a61d8da3d50
author jfrancoismartin
date Wed, 10 Oct 2018 05:18:42 -0400
parents
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
1422de181204 planemo upload for repository https://github.com/workflow4metabolomics/mixmodel4repeated_measures commit 6ea32b3182383c19e5333201d2385a61d8da3d50
jfrancoismartin
parents:
diff changeset
1 #!/usr/bin/env Rscript
1422de181204 planemo upload for repository https://github.com/workflow4metabolomics/mixmodel4repeated_measures commit 6ea32b3182383c19e5333201d2385a61d8da3d50
jfrancoismartin
parents:
diff changeset
2
1422de181204 planemo upload for repository https://github.com/workflow4metabolomics/mixmodel4repeated_measures commit 6ea32b3182383c19e5333201d2385a61d8da3d50
jfrancoismartin
parents:
diff changeset
3 library(batch) ## parseCommandArgs
1422de181204 planemo upload for repository https://github.com/workflow4metabolomics/mixmodel4repeated_measures commit 6ea32b3182383c19e5333201d2385a61d8da3d50
jfrancoismartin
parents:
diff changeset
4
1422de181204 planemo upload for repository https://github.com/workflow4metabolomics/mixmodel4repeated_measures commit 6ea32b3182383c19e5333201d2385a61d8da3d50
jfrancoismartin
parents:
diff changeset
5 library(lme4) ## mixed model computing
1422de181204 planemo upload for repository https://github.com/workflow4metabolomics/mixmodel4repeated_measures commit 6ea32b3182383c19e5333201d2385a61d8da3d50
jfrancoismartin
parents:
diff changeset
6 library(Matrix)
1422de181204 planemo upload for repository https://github.com/workflow4metabolomics/mixmodel4repeated_measures commit 6ea32b3182383c19e5333201d2385a61d8da3d50
jfrancoismartin
parents:
diff changeset
7 library(lmerTest) ## computing pvalue and lsmeans from results of lme4 package
1422de181204 planemo upload for repository https://github.com/workflow4metabolomics/mixmodel4repeated_measures commit 6ea32b3182383c19e5333201d2385a61d8da3d50
jfrancoismartin
parents:
diff changeset
8 library(multtest) ## multiple testing
1422de181204 planemo upload for repository https://github.com/workflow4metabolomics/mixmodel4repeated_measures commit 6ea32b3182383c19e5333201d2385a61d8da3d50
jfrancoismartin
parents:
diff changeset
9
1422de181204 planemo upload for repository https://github.com/workflow4metabolomics/mixmodel4repeated_measures commit 6ea32b3182383c19e5333201d2385a61d8da3d50
jfrancoismartin
parents:
diff changeset
10
1422de181204 planemo upload for repository https://github.com/workflow4metabolomics/mixmodel4repeated_measures commit 6ea32b3182383c19e5333201d2385a61d8da3d50
jfrancoismartin
parents:
diff changeset
11 source_local <- function(fname){
1422de181204 planemo upload for repository https://github.com/workflow4metabolomics/mixmodel4repeated_measures commit 6ea32b3182383c19e5333201d2385a61d8da3d50
jfrancoismartin
parents:
diff changeset
12 argv <- commandArgs(trailingOnly = FALSE)
1422de181204 planemo upload for repository https://github.com/workflow4metabolomics/mixmodel4repeated_measures commit 6ea32b3182383c19e5333201d2385a61d8da3d50
jfrancoismartin
parents:
diff changeset
13 base_dir <- dirname(substring(argv[grep("--file=", argv)], 8))
1422de181204 planemo upload for repository https://github.com/workflow4metabolomics/mixmodel4repeated_measures commit 6ea32b3182383c19e5333201d2385a61d8da3d50
jfrancoismartin
parents:
diff changeset
14 source(paste(base_dir, fname, sep="/"))
1422de181204 planemo upload for repository https://github.com/workflow4metabolomics/mixmodel4repeated_measures commit 6ea32b3182383c19e5333201d2385a61d8da3d50
jfrancoismartin
parents:
diff changeset
15 }
1422de181204 planemo upload for repository https://github.com/workflow4metabolomics/mixmodel4repeated_measures commit 6ea32b3182383c19e5333201d2385a61d8da3d50
jfrancoismartin
parents:
diff changeset
16
1422de181204 planemo upload for repository https://github.com/workflow4metabolomics/mixmodel4repeated_measures commit 6ea32b3182383c19e5333201d2385a61d8da3d50
jfrancoismartin
parents:
diff changeset
17 #source_local("univariate_script.R")
1422de181204 planemo upload for repository https://github.com/workflow4metabolomics/mixmodel4repeated_measures commit 6ea32b3182383c19e5333201d2385a61d8da3d50
jfrancoismartin
parents:
diff changeset
18 source_local("mixmodel_script.R")
1422de181204 planemo upload for repository https://github.com/workflow4metabolomics/mixmodel4repeated_measures commit 6ea32b3182383c19e5333201d2385a61d8da3d50
jfrancoismartin
parents:
diff changeset
19 source_local("diagmfl.R")
1422de181204 planemo upload for repository https://github.com/workflow4metabolomics/mixmodel4repeated_measures commit 6ea32b3182383c19e5333201d2385a61d8da3d50
jfrancoismartin
parents:
diff changeset
20
1422de181204 planemo upload for repository https://github.com/workflow4metabolomics/mixmodel4repeated_measures commit 6ea32b3182383c19e5333201d2385a61d8da3d50
jfrancoismartin
parents:
diff changeset
21 argVc <- unlist(parseCommandArgs(evaluate=FALSE))
1422de181204 planemo upload for repository https://github.com/workflow4metabolomics/mixmodel4repeated_measures commit 6ea32b3182383c19e5333201d2385a61d8da3d50
jfrancoismartin
parents:
diff changeset
22
1422de181204 planemo upload for repository https://github.com/workflow4metabolomics/mixmodel4repeated_measures commit 6ea32b3182383c19e5333201d2385a61d8da3d50
jfrancoismartin
parents:
diff changeset
23 ##------------------------------
1422de181204 planemo upload for repository https://github.com/workflow4metabolomics/mixmodel4repeated_measures commit 6ea32b3182383c19e5333201d2385a61d8da3d50
jfrancoismartin
parents:
diff changeset
24 ## Initializing
1422de181204 planemo upload for repository https://github.com/workflow4metabolomics/mixmodel4repeated_measures commit 6ea32b3182383c19e5333201d2385a61d8da3d50
jfrancoismartin
parents:
diff changeset
25 ##------------------------------
1422de181204 planemo upload for repository https://github.com/workflow4metabolomics/mixmodel4repeated_measures commit 6ea32b3182383c19e5333201d2385a61d8da3d50
jfrancoismartin
parents:
diff changeset
26
1422de181204 planemo upload for repository https://github.com/workflow4metabolomics/mixmodel4repeated_measures commit 6ea32b3182383c19e5333201d2385a61d8da3d50
jfrancoismartin
parents:
diff changeset
27 ## options
1422de181204 planemo upload for repository https://github.com/workflow4metabolomics/mixmodel4repeated_measures commit 6ea32b3182383c19e5333201d2385a61d8da3d50
jfrancoismartin
parents:
diff changeset
28 ##--------
1422de181204 planemo upload for repository https://github.com/workflow4metabolomics/mixmodel4repeated_measures commit 6ea32b3182383c19e5333201d2385a61d8da3d50
jfrancoismartin
parents:
diff changeset
29
1422de181204 planemo upload for repository https://github.com/workflow4metabolomics/mixmodel4repeated_measures commit 6ea32b3182383c19e5333201d2385a61d8da3d50
jfrancoismartin
parents:
diff changeset
30 strAsFacL <- options()$stringsAsFactors
1422de181204 planemo upload for repository https://github.com/workflow4metabolomics/mixmodel4repeated_measures commit 6ea32b3182383c19e5333201d2385a61d8da3d50
jfrancoismartin
parents:
diff changeset
31 options(stringsAsFactors = FALSE)
1422de181204 planemo upload for repository https://github.com/workflow4metabolomics/mixmodel4repeated_measures commit 6ea32b3182383c19e5333201d2385a61d8da3d50
jfrancoismartin
parents:
diff changeset
32
1422de181204 planemo upload for repository https://github.com/workflow4metabolomics/mixmodel4repeated_measures commit 6ea32b3182383c19e5333201d2385a61d8da3d50
jfrancoismartin
parents:
diff changeset
33 ## constants
1422de181204 planemo upload for repository https://github.com/workflow4metabolomics/mixmodel4repeated_measures commit 6ea32b3182383c19e5333201d2385a61d8da3d50
jfrancoismartin
parents:
diff changeset
34 ##----------
1422de181204 planemo upload for repository https://github.com/workflow4metabolomics/mixmodel4repeated_measures commit 6ea32b3182383c19e5333201d2385a61d8da3d50
jfrancoismartin
parents:
diff changeset
35
1422de181204 planemo upload for repository https://github.com/workflow4metabolomics/mixmodel4repeated_measures commit 6ea32b3182383c19e5333201d2385a61d8da3d50
jfrancoismartin
parents:
diff changeset
36 modNamC <- "mixmodel" ## module name
1422de181204 planemo upload for repository https://github.com/workflow4metabolomics/mixmodel4repeated_measures commit 6ea32b3182383c19e5333201d2385a61d8da3d50
jfrancoismartin
parents:
diff changeset
37
1422de181204 planemo upload for repository https://github.com/workflow4metabolomics/mixmodel4repeated_measures commit 6ea32b3182383c19e5333201d2385a61d8da3d50
jfrancoismartin
parents:
diff changeset
38 topEnvC <- environment()
1422de181204 planemo upload for repository https://github.com/workflow4metabolomics/mixmodel4repeated_measures commit 6ea32b3182383c19e5333201d2385a61d8da3d50
jfrancoismartin
parents:
diff changeset
39 flagC <- "\n"
1422de181204 planemo upload for repository https://github.com/workflow4metabolomics/mixmodel4repeated_measures commit 6ea32b3182383c19e5333201d2385a61d8da3d50
jfrancoismartin
parents:
diff changeset
40
1422de181204 planemo upload for repository https://github.com/workflow4metabolomics/mixmodel4repeated_measures commit 6ea32b3182383c19e5333201d2385a61d8da3d50
jfrancoismartin
parents:
diff changeset
41 ## functions
1422de181204 planemo upload for repository https://github.com/workflow4metabolomics/mixmodel4repeated_measures commit 6ea32b3182383c19e5333201d2385a61d8da3d50
jfrancoismartin
parents:
diff changeset
42 ##----------
1422de181204 planemo upload for repository https://github.com/workflow4metabolomics/mixmodel4repeated_measures commit 6ea32b3182383c19e5333201d2385a61d8da3d50
jfrancoismartin
parents:
diff changeset
43
1422de181204 planemo upload for repository https://github.com/workflow4metabolomics/mixmodel4repeated_measures commit 6ea32b3182383c19e5333201d2385a61d8da3d50
jfrancoismartin
parents:
diff changeset
44 flgF <- function(tesC,
1422de181204 planemo upload for repository https://github.com/workflow4metabolomics/mixmodel4repeated_measures commit 6ea32b3182383c19e5333201d2385a61d8da3d50
jfrancoismartin
parents:
diff changeset
45 envC = topEnvC,
1422de181204 planemo upload for repository https://github.com/workflow4metabolomics/mixmodel4repeated_measures commit 6ea32b3182383c19e5333201d2385a61d8da3d50
jfrancoismartin
parents:
diff changeset
46 txtC = NA) { ## management of warning and error messages
1422de181204 planemo upload for repository https://github.com/workflow4metabolomics/mixmodel4repeated_measures commit 6ea32b3182383c19e5333201d2385a61d8da3d50
jfrancoismartin
parents:
diff changeset
47
1422de181204 planemo upload for repository https://github.com/workflow4metabolomics/mixmodel4repeated_measures commit 6ea32b3182383c19e5333201d2385a61d8da3d50
jfrancoismartin
parents:
diff changeset
48 tesL <- eval(parse(text = tesC), envir = envC)
1422de181204 planemo upload for repository https://github.com/workflow4metabolomics/mixmodel4repeated_measures commit 6ea32b3182383c19e5333201d2385a61d8da3d50
jfrancoismartin
parents:
diff changeset
49
1422de181204 planemo upload for repository https://github.com/workflow4metabolomics/mixmodel4repeated_measures commit 6ea32b3182383c19e5333201d2385a61d8da3d50
jfrancoismartin
parents:
diff changeset
50 if(!tesL) {
1422de181204 planemo upload for repository https://github.com/workflow4metabolomics/mixmodel4repeated_measures commit 6ea32b3182383c19e5333201d2385a61d8da3d50
jfrancoismartin
parents:
diff changeset
51
1422de181204 planemo upload for repository https://github.com/workflow4metabolomics/mixmodel4repeated_measures commit 6ea32b3182383c19e5333201d2385a61d8da3d50
jfrancoismartin
parents:
diff changeset
52 sink(NULL)
1422de181204 planemo upload for repository https://github.com/workflow4metabolomics/mixmodel4repeated_measures commit 6ea32b3182383c19e5333201d2385a61d8da3d50
jfrancoismartin
parents:
diff changeset
53 stpTxtC <- ifelse(is.na(txtC),
1422de181204 planemo upload for repository https://github.com/workflow4metabolomics/mixmodel4repeated_measures commit 6ea32b3182383c19e5333201d2385a61d8da3d50
jfrancoismartin
parents:
diff changeset
54 paste0(tesC, " is FALSE"),
1422de181204 planemo upload for repository https://github.com/workflow4metabolomics/mixmodel4repeated_measures commit 6ea32b3182383c19e5333201d2385a61d8da3d50
jfrancoismartin
parents:
diff changeset
55 txtC)
1422de181204 planemo upload for repository https://github.com/workflow4metabolomics/mixmodel4repeated_measures commit 6ea32b3182383c19e5333201d2385a61d8da3d50
jfrancoismartin
parents:
diff changeset
56
1422de181204 planemo upload for repository https://github.com/workflow4metabolomics/mixmodel4repeated_measures commit 6ea32b3182383c19e5333201d2385a61d8da3d50
jfrancoismartin
parents:
diff changeset
57 stop(stpTxtC,
1422de181204 planemo upload for repository https://github.com/workflow4metabolomics/mixmodel4repeated_measures commit 6ea32b3182383c19e5333201d2385a61d8da3d50
jfrancoismartin
parents:
diff changeset
58 call. = FALSE)
1422de181204 planemo upload for repository https://github.com/workflow4metabolomics/mixmodel4repeated_measures commit 6ea32b3182383c19e5333201d2385a61d8da3d50
jfrancoismartin
parents:
diff changeset
59
1422de181204 planemo upload for repository https://github.com/workflow4metabolomics/mixmodel4repeated_measures commit 6ea32b3182383c19e5333201d2385a61d8da3d50
jfrancoismartin
parents:
diff changeset
60 }
1422de181204 planemo upload for repository https://github.com/workflow4metabolomics/mixmodel4repeated_measures commit 6ea32b3182383c19e5333201d2385a61d8da3d50
jfrancoismartin
parents:
diff changeset
61
1422de181204 planemo upload for repository https://github.com/workflow4metabolomics/mixmodel4repeated_measures commit 6ea32b3182383c19e5333201d2385a61d8da3d50
jfrancoismartin
parents:
diff changeset
62 } ## flgF
1422de181204 planemo upload for repository https://github.com/workflow4metabolomics/mixmodel4repeated_measures commit 6ea32b3182383c19e5333201d2385a61d8da3d50
jfrancoismartin
parents:
diff changeset
63
1422de181204 planemo upload for repository https://github.com/workflow4metabolomics/mixmodel4repeated_measures commit 6ea32b3182383c19e5333201d2385a61d8da3d50
jfrancoismartin
parents:
diff changeset
64 ## log file
1422de181204 planemo upload for repository https://github.com/workflow4metabolomics/mixmodel4repeated_measures commit 6ea32b3182383c19e5333201d2385a61d8da3d50
jfrancoismartin
parents:
diff changeset
65 ##---------
1422de181204 planemo upload for repository https://github.com/workflow4metabolomics/mixmodel4repeated_measures commit 6ea32b3182383c19e5333201d2385a61d8da3d50
jfrancoismartin
parents:
diff changeset
66
1422de181204 planemo upload for repository https://github.com/workflow4metabolomics/mixmodel4repeated_measures commit 6ea32b3182383c19e5333201d2385a61d8da3d50
jfrancoismartin
parents:
diff changeset
67 sink(argVc["information"])
1422de181204 planemo upload for repository https://github.com/workflow4metabolomics/mixmodel4repeated_measures commit 6ea32b3182383c19e5333201d2385a61d8da3d50
jfrancoismartin
parents:
diff changeset
68
1422de181204 planemo upload for repository https://github.com/workflow4metabolomics/mixmodel4repeated_measures commit 6ea32b3182383c19e5333201d2385a61d8da3d50
jfrancoismartin
parents:
diff changeset
69 cat("\nStart of the '", modNamC, "' Galaxy module call: ", format(Sys.time(), "%a %d %b %Y %X"), "\n", sep="")
1422de181204 planemo upload for repository https://github.com/workflow4metabolomics/mixmodel4repeated_measures commit 6ea32b3182383c19e5333201d2385a61d8da3d50
jfrancoismartin
parents:
diff changeset
70
1422de181204 planemo upload for repository https://github.com/workflow4metabolomics/mixmodel4repeated_measures commit 6ea32b3182383c19e5333201d2385a61d8da3d50
jfrancoismartin
parents:
diff changeset
71 ## loading
1422de181204 planemo upload for repository https://github.com/workflow4metabolomics/mixmodel4repeated_measures commit 6ea32b3182383c19e5333201d2385a61d8da3d50
jfrancoismartin
parents:
diff changeset
72 ##--------
1422de181204 planemo upload for repository https://github.com/workflow4metabolomics/mixmodel4repeated_measures commit 6ea32b3182383c19e5333201d2385a61d8da3d50
jfrancoismartin
parents:
diff changeset
73
1422de181204 planemo upload for repository https://github.com/workflow4metabolomics/mixmodel4repeated_measures commit 6ea32b3182383c19e5333201d2385a61d8da3d50
jfrancoismartin
parents:
diff changeset
74 datMN <- t(as.matrix(read.table(argVc["dataMatrix_in"],
1422de181204 planemo upload for repository https://github.com/workflow4metabolomics/mixmodel4repeated_measures commit 6ea32b3182383c19e5333201d2385a61d8da3d50
jfrancoismartin
parents:
diff changeset
75 check.names = FALSE,
1422de181204 planemo upload for repository https://github.com/workflow4metabolomics/mixmodel4repeated_measures commit 6ea32b3182383c19e5333201d2385a61d8da3d50
jfrancoismartin
parents:
diff changeset
76 header = TRUE,
1422de181204 planemo upload for repository https://github.com/workflow4metabolomics/mixmodel4repeated_measures commit 6ea32b3182383c19e5333201d2385a61d8da3d50
jfrancoismartin
parents:
diff changeset
77 row.names = 1,
1422de181204 planemo upload for repository https://github.com/workflow4metabolomics/mixmodel4repeated_measures commit 6ea32b3182383c19e5333201d2385a61d8da3d50
jfrancoismartin
parents:
diff changeset
78 sep = "\t")))
1422de181204 planemo upload for repository https://github.com/workflow4metabolomics/mixmodel4repeated_measures commit 6ea32b3182383c19e5333201d2385a61d8da3d50
jfrancoismartin
parents:
diff changeset
79
1422de181204 planemo upload for repository https://github.com/workflow4metabolomics/mixmodel4repeated_measures commit 6ea32b3182383c19e5333201d2385a61d8da3d50
jfrancoismartin
parents:
diff changeset
80 samDF <- read.table(argVc["sampleMetadata_in"],
1422de181204 planemo upload for repository https://github.com/workflow4metabolomics/mixmodel4repeated_measures commit 6ea32b3182383c19e5333201d2385a61d8da3d50
jfrancoismartin
parents:
diff changeset
81 check.names = FALSE,
1422de181204 planemo upload for repository https://github.com/workflow4metabolomics/mixmodel4repeated_measures commit 6ea32b3182383c19e5333201d2385a61d8da3d50
jfrancoismartin
parents:
diff changeset
82 header = TRUE,
1422de181204 planemo upload for repository https://github.com/workflow4metabolomics/mixmodel4repeated_measures commit 6ea32b3182383c19e5333201d2385a61d8da3d50
jfrancoismartin
parents:
diff changeset
83 row.names = 1,
1422de181204 planemo upload for repository https://github.com/workflow4metabolomics/mixmodel4repeated_measures commit 6ea32b3182383c19e5333201d2385a61d8da3d50
jfrancoismartin
parents:
diff changeset
84 sep = "\t")
1422de181204 planemo upload for repository https://github.com/workflow4metabolomics/mixmodel4repeated_measures commit 6ea32b3182383c19e5333201d2385a61d8da3d50
jfrancoismartin
parents:
diff changeset
85
1422de181204 planemo upload for repository https://github.com/workflow4metabolomics/mixmodel4repeated_measures commit 6ea32b3182383c19e5333201d2385a61d8da3d50
jfrancoismartin
parents:
diff changeset
86 varDF <- read.table(argVc["variableMetadata_in"],
1422de181204 planemo upload for repository https://github.com/workflow4metabolomics/mixmodel4repeated_measures commit 6ea32b3182383c19e5333201d2385a61d8da3d50
jfrancoismartin
parents:
diff changeset
87 check.names = FALSE,
1422de181204 planemo upload for repository https://github.com/workflow4metabolomics/mixmodel4repeated_measures commit 6ea32b3182383c19e5333201d2385a61d8da3d50
jfrancoismartin
parents:
diff changeset
88 header = TRUE,
1422de181204 planemo upload for repository https://github.com/workflow4metabolomics/mixmodel4repeated_measures commit 6ea32b3182383c19e5333201d2385a61d8da3d50
jfrancoismartin
parents:
diff changeset
89 row.names = 1,
1422de181204 planemo upload for repository https://github.com/workflow4metabolomics/mixmodel4repeated_measures commit 6ea32b3182383c19e5333201d2385a61d8da3d50
jfrancoismartin
parents:
diff changeset
90 sep = "\t")
1422de181204 planemo upload for repository https://github.com/workflow4metabolomics/mixmodel4repeated_measures commit 6ea32b3182383c19e5333201d2385a61d8da3d50
jfrancoismartin
parents:
diff changeset
91
1422de181204 planemo upload for repository https://github.com/workflow4metabolomics/mixmodel4repeated_measures commit 6ea32b3182383c19e5333201d2385a61d8da3d50
jfrancoismartin
parents:
diff changeset
92
1422de181204 planemo upload for repository https://github.com/workflow4metabolomics/mixmodel4repeated_measures commit 6ea32b3182383c19e5333201d2385a61d8da3d50
jfrancoismartin
parents:
diff changeset
93 ## checking
1422de181204 planemo upload for repository https://github.com/workflow4metabolomics/mixmodel4repeated_measures commit 6ea32b3182383c19e5333201d2385a61d8da3d50
jfrancoismartin
parents:
diff changeset
94 ##---------
1422de181204 planemo upload for repository https://github.com/workflow4metabolomics/mixmodel4repeated_measures commit 6ea32b3182383c19e5333201d2385a61d8da3d50
jfrancoismartin
parents:
diff changeset
95
1422de181204 planemo upload for repository https://github.com/workflow4metabolomics/mixmodel4repeated_measures commit 6ea32b3182383c19e5333201d2385a61d8da3d50
jfrancoismartin
parents:
diff changeset
96 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")
1422de181204 planemo upload for repository https://github.com/workflow4metabolomics/mixmodel4repeated_measures commit 6ea32b3182383c19e5333201d2385a61d8da3d50
jfrancoismartin
parents:
diff changeset
97 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")
1422de181204 planemo upload for repository https://github.com/workflow4metabolomics/mixmodel4repeated_measures commit 6ea32b3182383c19e5333201d2385a61d8da3d50
jfrancoismartin
parents:
diff changeset
98
1422de181204 planemo upload for repository https://github.com/workflow4metabolomics/mixmodel4repeated_measures commit 6ea32b3182383c19e5333201d2385a61d8da3d50
jfrancoismartin
parents:
diff changeset
99 flgF("argVc['fixfact'] %in% colnames(samDF)", txtC = paste0("Required fixed factor '" , argVc['fixfact'], "' could not be found in the column names of the sampleMetadata"))
1422de181204 planemo upload for repository https://github.com/workflow4metabolomics/mixmodel4repeated_measures commit 6ea32b3182383c19e5333201d2385a61d8da3d50
jfrancoismartin
parents:
diff changeset
100 flgF("argVc['time'] %in% colnames(samDF)", txtC = paste0("Required time factor '" , argVc['time'] , "' could not be found in the column names of the sampleMetadata"))
1422de181204 planemo upload for repository https://github.com/workflow4metabolomics/mixmodel4repeated_measures commit 6ea32b3182383c19e5333201d2385a61d8da3d50
jfrancoismartin
parents:
diff changeset
101 flgF("argVc['subject'] %in% colnames(samDF)", txtC = paste0("Required subject factor '", argVc['subject'], "' could not be found in the column names of the sampleMetadata"))
1422de181204 planemo upload for repository https://github.com/workflow4metabolomics/mixmodel4repeated_measures commit 6ea32b3182383c19e5333201d2385a61d8da3d50
jfrancoismartin
parents:
diff changeset
102
1422de181204 planemo upload for repository https://github.com/workflow4metabolomics/mixmodel4repeated_measures commit 6ea32b3182383c19e5333201d2385a61d8da3d50
jfrancoismartin
parents:
diff changeset
103 flgF("mode(samDF[, argVc['fixfact']]) %in% c('character', 'numeric')", txtC = paste0("The '", argVc['fixfact'], "' column of the sampleMetadata should contain either number only, or character only"))
1422de181204 planemo upload for repository https://github.com/workflow4metabolomics/mixmodel4repeated_measures commit 6ea32b3182383c19e5333201d2385a61d8da3d50
jfrancoismartin
parents:
diff changeset
104 flgF("mode(samDF[, argVc['time']]) %in% c('character', 'numeric')", txtC = paste0("The '", argVc['time'] , "' column of the sampleMetadata should contain either number only, or character only"))
1422de181204 planemo upload for repository https://github.com/workflow4metabolomics/mixmodel4repeated_measures commit 6ea32b3182383c19e5333201d2385a61d8da3d50
jfrancoismartin
parents:
diff changeset
105 flgF("mode(samDF[, argVc['subject']]) %in% c('character', 'numeric')", txtC = paste0("The '", argVc['subject'], "' column of the sampleMetadata should contain either number only, or character only"))
1422de181204 planemo upload for repository https://github.com/workflow4metabolomics/mixmodel4repeated_measures commit 6ea32b3182383c19e5333201d2385a61d8da3d50
jfrancoismartin
parents:
diff changeset
106
1422de181204 planemo upload for repository https://github.com/workflow4metabolomics/mixmodel4repeated_measures commit 6ea32b3182383c19e5333201d2385a61d8da3d50
jfrancoismartin
parents:
diff changeset
107 flgF("argVc['adjC'] %in% c('holm', 'hochberg', 'hommel', 'bonferroni', 'BH', 'BY', 'fdr', 'none')")
1422de181204 planemo upload for repository https://github.com/workflow4metabolomics/mixmodel4repeated_measures commit 6ea32b3182383c19e5333201d2385a61d8da3d50
jfrancoismartin
parents:
diff changeset
108 flgF("argVc['trf'] %in% c('none', 'log10', 'log2')")
1422de181204 planemo upload for repository https://github.com/workflow4metabolomics/mixmodel4repeated_measures commit 6ea32b3182383c19e5333201d2385a61d8da3d50
jfrancoismartin
parents:
diff changeset
109
1422de181204 planemo upload for repository https://github.com/workflow4metabolomics/mixmodel4repeated_measures commit 6ea32b3182383c19e5333201d2385a61d8da3d50
jfrancoismartin
parents:
diff changeset
110 flgF("0 <= as.numeric(argVc['thrN']) && as.numeric(argVc['thrN']) <= 1", txtC = "(corrected) p-value threshold must be between 0 and 1")
1422de181204 planemo upload for repository https://github.com/workflow4metabolomics/mixmodel4repeated_measures commit 6ea32b3182383c19e5333201d2385a61d8da3d50
jfrancoismartin
parents:
diff changeset
111 flgF("argVc['diaR'] %in% c('no', 'yes')")
1422de181204 planemo upload for repository https://github.com/workflow4metabolomics/mixmodel4repeated_measures commit 6ea32b3182383c19e5333201d2385a61d8da3d50
jfrancoismartin
parents:
diff changeset
112
1422de181204 planemo upload for repository https://github.com/workflow4metabolomics/mixmodel4repeated_measures commit 6ea32b3182383c19e5333201d2385a61d8da3d50
jfrancoismartin
parents:
diff changeset
113
1422de181204 planemo upload for repository https://github.com/workflow4metabolomics/mixmodel4repeated_measures commit 6ea32b3182383c19e5333201d2385a61d8da3d50
jfrancoismartin
parents:
diff changeset
114 ##------------------------------
1422de181204 planemo upload for repository https://github.com/workflow4metabolomics/mixmodel4repeated_measures commit 6ea32b3182383c19e5333201d2385a61d8da3d50
jfrancoismartin
parents:
diff changeset
115 ## Computation
1422de181204 planemo upload for repository https://github.com/workflow4metabolomics/mixmodel4repeated_measures commit 6ea32b3182383c19e5333201d2385a61d8da3d50
jfrancoismartin
parents:
diff changeset
116 ##------------------------------
1422de181204 planemo upload for repository https://github.com/workflow4metabolomics/mixmodel4repeated_measures commit 6ea32b3182383c19e5333201d2385a61d8da3d50
jfrancoismartin
parents:
diff changeset
117
1422de181204 planemo upload for repository https://github.com/workflow4metabolomics/mixmodel4repeated_measures commit 6ea32b3182383c19e5333201d2385a61d8da3d50
jfrancoismartin
parents:
diff changeset
118
1422de181204 planemo upload for repository https://github.com/workflow4metabolomics/mixmodel4repeated_measures commit 6ea32b3182383c19e5333201d2385a61d8da3d50
jfrancoismartin
parents:
diff changeset
119 varDF <- lmixedm(datMN = datMN,
1422de181204 planemo upload for repository https://github.com/workflow4metabolomics/mixmodel4repeated_measures commit 6ea32b3182383c19e5333201d2385a61d8da3d50
jfrancoismartin
parents:
diff changeset
120 samDF = samDF,
1422de181204 planemo upload for repository https://github.com/workflow4metabolomics/mixmodel4repeated_measures commit 6ea32b3182383c19e5333201d2385a61d8da3d50
jfrancoismartin
parents:
diff changeset
121 varDF = varDF,
1422de181204 planemo upload for repository https://github.com/workflow4metabolomics/mixmodel4repeated_measures commit 6ea32b3182383c19e5333201d2385a61d8da3d50
jfrancoismartin
parents:
diff changeset
122 fixfact = argVc["fixfact"],
1422de181204 planemo upload for repository https://github.com/workflow4metabolomics/mixmodel4repeated_measures commit 6ea32b3182383c19e5333201d2385a61d8da3d50
jfrancoismartin
parents:
diff changeset
123 time = argVc["time"],
1422de181204 planemo upload for repository https://github.com/workflow4metabolomics/mixmodel4repeated_measures commit 6ea32b3182383c19e5333201d2385a61d8da3d50
jfrancoismartin
parents:
diff changeset
124 subject = argVc["subject"],
1422de181204 planemo upload for repository https://github.com/workflow4metabolomics/mixmodel4repeated_measures commit 6ea32b3182383c19e5333201d2385a61d8da3d50
jfrancoismartin
parents:
diff changeset
125 logtr = argVc['trf'],
1422de181204 planemo upload for repository https://github.com/workflow4metabolomics/mixmodel4repeated_measures commit 6ea32b3182383c19e5333201d2385a61d8da3d50
jfrancoismartin
parents:
diff changeset
126 pvalCutof = argVc['thrN'],
1422de181204 planemo upload for repository https://github.com/workflow4metabolomics/mixmodel4repeated_measures commit 6ea32b3182383c19e5333201d2385a61d8da3d50
jfrancoismartin
parents:
diff changeset
127 pvalcorMeth= argVc["adjC"],
1422de181204 planemo upload for repository https://github.com/workflow4metabolomics/mixmodel4repeated_measures commit 6ea32b3182383c19e5333201d2385a61d8da3d50
jfrancoismartin
parents:
diff changeset
128 dffOption = "Satterthwaite",
1422de181204 planemo upload for repository https://github.com/workflow4metabolomics/mixmodel4repeated_measures commit 6ea32b3182383c19e5333201d2385a61d8da3d50
jfrancoismartin
parents:
diff changeset
129 visu = argVc["diaR"],
1422de181204 planemo upload for repository https://github.com/workflow4metabolomics/mixmodel4repeated_measures commit 6ea32b3182383c19e5333201d2385a61d8da3d50
jfrancoismartin
parents:
diff changeset
130 least.confounded = FALSE,
1422de181204 planemo upload for repository https://github.com/workflow4metabolomics/mixmodel4repeated_measures commit 6ea32b3182383c19e5333201d2385a61d8da3d50
jfrancoismartin
parents:
diff changeset
131 outlier.limit = 3,
1422de181204 planemo upload for repository https://github.com/workflow4metabolomics/mixmodel4repeated_measures commit 6ea32b3182383c19e5333201d2385a61d8da3d50
jfrancoismartin
parents:
diff changeset
132 pdfC = argVc["out_graph_pdf"],
1422de181204 planemo upload for repository https://github.com/workflow4metabolomics/mixmodel4repeated_measures commit 6ea32b3182383c19e5333201d2385a61d8da3d50
jfrancoismartin
parents:
diff changeset
133 pdfE = argVc["out_estim_pdf"]
1422de181204 planemo upload for repository https://github.com/workflow4metabolomics/mixmodel4repeated_measures commit 6ea32b3182383c19e5333201d2385a61d8da3d50
jfrancoismartin
parents:
diff changeset
134 )
1422de181204 planemo upload for repository https://github.com/workflow4metabolomics/mixmodel4repeated_measures commit 6ea32b3182383c19e5333201d2385a61d8da3d50
jfrancoismartin
parents:
diff changeset
135
1422de181204 planemo upload for repository https://github.com/workflow4metabolomics/mixmodel4repeated_measures commit 6ea32b3182383c19e5333201d2385a61d8da3d50
jfrancoismartin
parents:
diff changeset
136
1422de181204 planemo upload for repository https://github.com/workflow4metabolomics/mixmodel4repeated_measures commit 6ea32b3182383c19e5333201d2385a61d8da3d50
jfrancoismartin
parents:
diff changeset
137 ##------------------------------
1422de181204 planemo upload for repository https://github.com/workflow4metabolomics/mixmodel4repeated_measures commit 6ea32b3182383c19e5333201d2385a61d8da3d50
jfrancoismartin
parents:
diff changeset
138 ## Ending
1422de181204 planemo upload for repository https://github.com/workflow4metabolomics/mixmodel4repeated_measures commit 6ea32b3182383c19e5333201d2385a61d8da3d50
jfrancoismartin
parents:
diff changeset
139 ##------------------------------
1422de181204 planemo upload for repository https://github.com/workflow4metabolomics/mixmodel4repeated_measures commit 6ea32b3182383c19e5333201d2385a61d8da3d50
jfrancoismartin
parents:
diff changeset
140
1422de181204 planemo upload for repository https://github.com/workflow4metabolomics/mixmodel4repeated_measures commit 6ea32b3182383c19e5333201d2385a61d8da3d50
jfrancoismartin
parents:
diff changeset
141
1422de181204 planemo upload for repository https://github.com/workflow4metabolomics/mixmodel4repeated_measures commit 6ea32b3182383c19e5333201d2385a61d8da3d50
jfrancoismartin
parents:
diff changeset
142 ## saving
1422de181204 planemo upload for repository https://github.com/workflow4metabolomics/mixmodel4repeated_measures commit 6ea32b3182383c19e5333201d2385a61d8da3d50
jfrancoismartin
parents:
diff changeset
143 ##--------
1422de181204 planemo upload for repository https://github.com/workflow4metabolomics/mixmodel4repeated_measures commit 6ea32b3182383c19e5333201d2385a61d8da3d50
jfrancoismartin
parents:
diff changeset
144
1422de181204 planemo upload for repository https://github.com/workflow4metabolomics/mixmodel4repeated_measures commit 6ea32b3182383c19e5333201d2385a61d8da3d50
jfrancoismartin
parents:
diff changeset
145 varDF <- cbind.data.frame(variableMetadata = rownames(varDF),
1422de181204 planemo upload for repository https://github.com/workflow4metabolomics/mixmodel4repeated_measures commit 6ea32b3182383c19e5333201d2385a61d8da3d50
jfrancoismartin
parents:
diff changeset
146 varDF)
1422de181204 planemo upload for repository https://github.com/workflow4metabolomics/mixmodel4repeated_measures commit 6ea32b3182383c19e5333201d2385a61d8da3d50
jfrancoismartin
parents:
diff changeset
147
1422de181204 planemo upload for repository https://github.com/workflow4metabolomics/mixmodel4repeated_measures commit 6ea32b3182383c19e5333201d2385a61d8da3d50
jfrancoismartin
parents:
diff changeset
148 write.table(varDF,
1422de181204 planemo upload for repository https://github.com/workflow4metabolomics/mixmodel4repeated_measures commit 6ea32b3182383c19e5333201d2385a61d8da3d50
jfrancoismartin
parents:
diff changeset
149 file = argVc["variableMetadata_out"],
1422de181204 planemo upload for repository https://github.com/workflow4metabolomics/mixmodel4repeated_measures commit 6ea32b3182383c19e5333201d2385a61d8da3d50
jfrancoismartin
parents:
diff changeset
150 quote = FALSE,
1422de181204 planemo upload for repository https://github.com/workflow4metabolomics/mixmodel4repeated_measures commit 6ea32b3182383c19e5333201d2385a61d8da3d50
jfrancoismartin
parents:
diff changeset
151 row.names = FALSE,
1422de181204 planemo upload for repository https://github.com/workflow4metabolomics/mixmodel4repeated_measures commit 6ea32b3182383c19e5333201d2385a61d8da3d50
jfrancoismartin
parents:
diff changeset
152 sep = "\t")
1422de181204 planemo upload for repository https://github.com/workflow4metabolomics/mixmodel4repeated_measures commit 6ea32b3182383c19e5333201d2385a61d8da3d50
jfrancoismartin
parents:
diff changeset
153
1422de181204 planemo upload for repository https://github.com/workflow4metabolomics/mixmodel4repeated_measures commit 6ea32b3182383c19e5333201d2385a61d8da3d50
jfrancoismartin
parents:
diff changeset
154 ## closing
1422de181204 planemo upload for repository https://github.com/workflow4metabolomics/mixmodel4repeated_measures commit 6ea32b3182383c19e5333201d2385a61d8da3d50
jfrancoismartin
parents:
diff changeset
155 ##--------
1422de181204 planemo upload for repository https://github.com/workflow4metabolomics/mixmodel4repeated_measures commit 6ea32b3182383c19e5333201d2385a61d8da3d50
jfrancoismartin
parents:
diff changeset
156
1422de181204 planemo upload for repository https://github.com/workflow4metabolomics/mixmodel4repeated_measures commit 6ea32b3182383c19e5333201d2385a61d8da3d50
jfrancoismartin
parents:
diff changeset
157 cat("\nEnd of '", modNamC, "' Galaxy module call: ",
1422de181204 planemo upload for repository https://github.com/workflow4metabolomics/mixmodel4repeated_measures commit 6ea32b3182383c19e5333201d2385a61d8da3d50
jfrancoismartin
parents:
diff changeset
158 as.character(Sys.time()), "\n", sep = "")
1422de181204 planemo upload for repository https://github.com/workflow4metabolomics/mixmodel4repeated_measures commit 6ea32b3182383c19e5333201d2385a61d8da3d50
jfrancoismartin
parents:
diff changeset
159
1422de181204 planemo upload for repository https://github.com/workflow4metabolomics/mixmodel4repeated_measures commit 6ea32b3182383c19e5333201d2385a61d8da3d50
jfrancoismartin
parents:
diff changeset
160 sink()
1422de181204 planemo upload for repository https://github.com/workflow4metabolomics/mixmodel4repeated_measures commit 6ea32b3182383c19e5333201d2385a61d8da3d50
jfrancoismartin
parents:
diff changeset
161
1422de181204 planemo upload for repository https://github.com/workflow4metabolomics/mixmodel4repeated_measures commit 6ea32b3182383c19e5333201d2385a61d8da3d50
jfrancoismartin
parents:
diff changeset
162 options(stringsAsFactors = strAsFacL)
1422de181204 planemo upload for repository https://github.com/workflow4metabolomics/mixmodel4repeated_measures commit 6ea32b3182383c19e5333201d2385a61d8da3d50
jfrancoismartin
parents:
diff changeset
163
1422de181204 planemo upload for repository https://github.com/workflow4metabolomics/mixmodel4repeated_measures commit 6ea32b3182383c19e5333201d2385a61d8da3d50
jfrancoismartin
parents:
diff changeset
164 rm(list = ls())