annotate multivariate_wrapper.R @ 2:fa173e12e185 draft

planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 9f4dfcdc64aa9ac2a2f6d613cc33961c02fec254-dirty
author ethevenot
date Sat, 06 Aug 2016 12:07:13 -0400
parents da272496b32d
children e91de3b04320
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
1 #!/usr/bin/env Rscript
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
2
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
3 library(batch) ## parseCommandArgs
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
4
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
5 ########
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
6 # MAIN #
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
7 ########
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
8
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
9 argVc <- unlist(parseCommandArgs(evaluate=FALSE))
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
10
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
11 ##------------------------------
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
12 ## Initializing
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
13 ##------------------------------
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
14
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
15 ## options
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
16 ##--------
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
17
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
18 strAsFacL <- options()$stringsAsFactors
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
19 options(stringsAsFactors = FALSE)
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
20
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
21 ## libraries
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
22 ##----------
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
23
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
24 suppressMessages(library(ropls))
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
25
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
26 if(packageVersion("ropls") < "1.4.0")
1
da272496b32d planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit dbdc8c3e17ea6ef7139e77cbb6130de949ea2a05
ethevenot
parents: 0
diff changeset
27 stop("Please use 'ropls' versions of 1.4.0 and above")
0
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
28
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
29 ## constants
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
30 ##----------
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
31
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
32 modNamC <- "Multivariate" ## module name
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
33
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
34 topEnvC <- environment()
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
35 flgC <- "\n"
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
36
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
37 ## functions
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
38 ##----------
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
39
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
40 flgF <- function(tesC,
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
41 envC = topEnvC,
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
42 txtC = NA) { ## management of warning and error messages
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
43
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
44 tesL <- eval(parse(text = tesC), envir = envC)
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
45
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
46 if(!tesL) {
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
47
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
48 sink(NULL)
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
49 stpTxtC <- ifelse(is.na(txtC),
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
50 paste0(tesC, " is FALSE"),
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
51 txtC)
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
52
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
53 stop(stpTxtC,
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
54 call. = FALSE)
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
55
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
56 }
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
57
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
58 } ## flgF
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
59
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
60
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
61 ## log file
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
62 ##---------
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
63
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
64 sink(argVc["information"])
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
65
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
66 cat("\nStart of the '", modNamC, "' Galaxy module call: ",
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
67 format(Sys.time(), "%a %d %b %Y %X"), "\n", sep="")
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
68
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
69
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
70 ## arguments
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
71 ##----------
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
72
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
73 xMN <- t(as.matrix(read.table(argVc["dataMatrix_in"],
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
74 check.names = FALSE,
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
75 header = TRUE,
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
76 row.names = 1,
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
77 sep = "\t")))
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
78
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
79 samDF <- read.table(argVc["sampleMetadata_in"],
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
80 check.names = FALSE,
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
81 header = TRUE,
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
82 row.names = 1,
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
83 sep = "\t")
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
84 flgF("identical(rownames(xMN), rownames(samDF))", txtC = "Sample names (or number) in the data matrix (first row) and sample metadata (first column) are not identical; use the 'Check Format' module in the 'Quality Control' section")
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
85
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
86 varDF <- read.table(argVc["variableMetadata_in"],
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
87 check.names = FALSE,
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
88 header = TRUE,
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
89 row.names = 1,
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
90 sep = "\t")
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
91 flgF("identical(colnames(xMN), rownames(varDF))", txtC = "Variable names (or number) in the data matrix (first column) and sample metadata (first column) are not identical; use the 'Check Format' module in the 'Quality Control' section")
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
92
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
93 flgF("argVc['respC'] == 'none' || (argVc['respC'] %in% colnames(samDF))",
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
94 txtC = paste0("Y Response argument (", argVc['respC'], ") must be either none or one of the column names (first row) of your sample metadata"))
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
95 if(argVc["respC"] != "none") {
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
96 yMCN <- matrix(samDF[, argVc['respC']], ncol = 1, dimnames = list(rownames(xMN), argVc['respC']))
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
97 } else
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
98 yMCN <- NULL
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
99
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
100 if(argVc["testL"] == "TRUE") {
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
101 flgF("!is.null(yMCN)",
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
102 txtC = "Predictions cannot be peformed with PCA models")
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
103 flgF("'test.' %in% colnames(samDF)",
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
104 txtC = "No 'test.' column found in the sample metadata")
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
105 flgF("identical(sort(unique(samDF[, 'test.'])), c('no', 'yes'))",
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
106 txtC = "'test.' column of sample metadata must contain both 'yes' (tested samples) and 'no' (samples to be used for model training) values, and nothing else")
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
107 flgF("identical(sort(unique(samDF[, 'test.'])), c('no', 'yes'))",
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
108 txtC = "'test.' column of sample metadata must contain both 'yes' (tested samples) and 'no' (samples to be used for model training) values, and nothing else")
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
109 flgF("!any(is.na(yMCN[samDF[, 'test.'] == 'no', ]))",
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
110 txtC = "samples for model training (i.e. 'no' value in the 'test.' column) should not contain NA in the response")
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
111 tesVl <- samDF[, "test."] == "yes"
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
112 xTesMN <- xMN[tesVl, , drop = FALSE]
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
113 xMN <- xMN[!tesVl, , drop = FALSE]
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
114 yMCN <- yMCN[!tesVl, , drop = FALSE]
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
115 } else
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
116 tesVl <- NULL
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
117
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
118 if(!('parAsColC' %in% names(argVc)))
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
119 argVc["parAsColC"] <- "none"
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
120 flgF("argVc['parAsColC'] == 'none' || argVc['parAsColC'] %in% colnames(samDF)", txtC = paste0("Sample color argument (", argVc['parAsColC'], ") must be either none or one of the column names (first row) of your sample metadata"))
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
121 if(argVc["parAsColC"] != "none") {
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
122 parAsColFcVn <- samDF[, argVc['parAsColC']]
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
123 if(is.character(parAsColFcVn))
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
124 parAsColFcVn <- factor(parAsColFcVn)
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
125 } else
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
126 parAsColFcVn <- NA
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
127
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
128 if(!('parMahalC' %in% names(argVc)) || argVc["parMahalC"] == "NA") {
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
129 if(!is.null(yMCN) && ncol(yMCN) == 1 && mode(yMCN) == "character")
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
130 argVc["parMahalC"] <- argVc["respC"]
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
131 else
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
132 argVc["parMahalC"] <- "none"
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
133 }
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
134 flgF("argVc['parMahalC'] == 'none' || (argVc['parMahalC'] %in% colnames(samDF))",
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
135 txtC = paste0("Mahalanobis argument (", argVc['parMahalC'], ") must be either 'NA', 'none' or one of the column names (first row) of your sample metadata"))
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
136 if(argVc["parMahalC"] == "none") {
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
137 parEllipsesL <- FALSE
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
138 } else {
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
139 if(is.null(yMCN)) { ## PCA case
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
140 flgF("mode(samDF[, argVc['parMahalC']]) == 'character'",
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
141 txtC = paste0("Mahalanobis argument (", argVc['parMahalC'], ") must correspond to a column of characters in your sampleMetadata"))
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
142 parAsColFcVn <- factor(samDF[, argVc["parMahalC"]])
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
143 parEllipsesL <- TRUE
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
144 } else { ## (O)PLS-DA case
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
145 flgF("identical(as.character(argVc['respC']), as.character(argVc['parMahalC']))",
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
146 txtC = paste0("The Mahalanobis argument (", argVc['parMahalC'], ") must be identical to the Y response argument (", argVc['respC'], ")"))
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
147 parEllipsesL <- TRUE
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
148 }
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
149 }
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
150
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
151 if(!('parLabVc' %in% names(argVc)))
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
152 argVc["parLabVc"] <- "none"
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
153 flgF("argVc['parLabVc'] == 'none' || (argVc['parLabVc'] %in% colnames(samDF))",
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
154 txtC = paste0("Sample labels argument (", argVc['parLabVc'], ") must be either none or one of the column names (first row) of your sample metadata"))
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
155 if('parLabVc' %in% names(argVc))
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
156 if(argVc["parLabVc"] != "none") {
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
157 flgF("mode(samDF[, argVc['parLabVc']]) == 'character'",
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
158 txtC = paste0("The sample label argument (", argVc['parLabVc'], ") must correspond to a sample metadata column of characters (not numerics)"))
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
159 parLabVc <- samDF[, argVc['parLabVc']]
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
160 } else
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
161 parLabVc <- NA
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
162
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
163 if('parPc1I' %in% names(argVc)) {
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
164 parCompVi <- as.numeric(c(argVc["parPc1I"], argVc["parPc2I"]))
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
165 } else
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
166 parCompVi <- c(1, 2)
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
167
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
168
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
169 ## checking
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
170 ##---------
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
171
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
172
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
173 flgF("argVc['predI'] == 'NA' || argVc['orthoI'] == 'NA' || as.numeric(argVc['orthoI']) > 0 || parCompVi[2] <= as.numeric(argVc['predI'])",
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
174 txtC = paste0("The highest component to display (", parCompVi[2], ") must not exceed the number of predictive components of the model (", argVc['predI'], ")"))
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
175
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
176
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
177 if(argVc["orthoI"] == "NA" || argVc["orthoI"] != "0")
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
178 if(argVc["predI"] == "NA" || argVc["predI"] != "0") {
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
179 argVc["predI"] <- "1"
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
180 cat("\nWarning: OPLS: number of predictive components ('predI' argument) set to 1\n", sep = "")
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
181 }
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
182
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
183 if(argVc["predI"] != "NA")
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
184 if(as.numeric(argVc["predI"]) > min(nrow(xMN), ncol(xMN))) {
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
185 argVc["predI"] <- as.character(min(nrow(xMN), ncol(xMN)))
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
186 cat("\nWarning: 'predI' set to the minimum of the dataMatrix dimensions: ", as.numeric(argVc["predI"]), "\n", sep = "")
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
187 }
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
188
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
189 if("algoC" %in% names(argVc) && argVc["algoC"] == "svd" && length(which(is.na(c(xMN)))) > 0) {
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
190 minN <- min(c(xMN[!is.na(xMN)])) / 2
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
191 cat("\nWarning: Missing values set to ", round(minN, 1), " (half minimum value) for 'svd' algorithm to be used\n", sep = "")
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
192 }
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
193
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
194
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
195 ##------------------------------
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
196 ## Computation and plot
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
197 ##------------------------------
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
198
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
199
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
200 sink()
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
201
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
202 optWrnN <- options()$warn
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
203 options(warn = -1)
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
204
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
205 ropLs <- opls(x = xMN,
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
206 y = yMCN,
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
207 predI = ifelse(argVc["predI"] == "NA", NA, as.numeric(argVc["predI"])),
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
208 orthoI = ifelse(argVc["orthoI"] == "NA", NA, as.numeric(argVc["orthoI"])),
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
209 algoC = ifelse('algoC' %in% names(argVc), argVc["algoC"], "default"),
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
210 crossvalI = ifelse('crossvalI' %in% names(argVc), as.numeric(argVc["crossvalI"]), 7),
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
211 log10L = ifelse('log10L' %in% names(argVc), as.logical(argVc["log10L"]), FALSE),
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
212 permI = ifelse('permI' %in% names(argVc), as.numeric(argVc["permI"]), 20),
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
213 scaleC = ifelse('scaleC' %in% names(argVc), argVc["scaleC"], "standard"),
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
214 subset = NULL,
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
215 printL = FALSE,
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
216 plotL = FALSE,
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
217 .sinkC = argVc['information'])
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
218
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
219 modC <- ropLs@typeC
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
220 sumDF <- getSummaryDF(ropLs)
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
221 desMC <- ropLs@descriptionMC
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
222 scoreMN <- getScoreMN(ropLs)
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
223 loadingMN <- getLoadingMN(ropLs)
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
224
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
225 vipVn <- coeMN <- orthoScoreMN <- orthoLoadingMN <- orthoVipVn <- NULL
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
226
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
227 if(grepl("PLS", modC)) {
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
228
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
229 vipVn <- getVipVn(ropLs)
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
230 coeMN <- coef(ropLs)
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
231
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
232 if(grepl("OPLS", modC)) {
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
233 orthoScoreMN <- getScoreMN(ropLs, orthoL = TRUE)
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
234 orthoLoadingMN <- getLoadingMN(ropLs, orthoL = TRUE)
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
235 orthoVipVn <- getVipVn(ropLs, orthoL = TRUE)
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
236 }
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
237
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
238 }
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
239
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
240 ploC <- ifelse('typeC' %in% names(argVc), argVc["typeC"], "summary")
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
241
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
242 if(sumDF[, "pre"] + sumDF[, "ort"] < 2) {
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
243 if(!(ploC %in% c("permutation", "overview"))) {
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
244 ploC <- "summary"
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
245 plotWarnL <- TRUE
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
246 }
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
247 } else
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
248 plotWarnL <- FALSE
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
249
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
250 plot(ropLs,
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
251 typeVc = ploC,
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
252 parAsColFcVn = parAsColFcVn,
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
253 parCexN = ifelse('parCexN' %in% names(argVc), as.numeric(argVc["parCexN"]), 0.8),
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
254 parCompVi = parCompVi,
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
255 parEllipsesL = parEllipsesL,
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
256 parLabVc = parLabVc,
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
257 file.pdfC = argVc['figure'],
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
258 .sinkC = argVc['information'])
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
259
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
260 options(warn = optWrnN)
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
261
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
262
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
263 ##------------------------------
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
264 ## Print
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
265 ##------------------------------
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
266
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
267
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
268 sink(argVc["information"], append = TRUE)
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
269
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
270 if(plotWarnL)
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
271 cat("\nWarning: For single component models, only 'overview' (and 'permutation' in case of single response (O)PLS(-DA)) plot(s) are available\n", sep = "")
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
272
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
273
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
274 cat("\n", modC, "\n", sep = "")
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
275
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
276 cat("\n", desMC["samples", ],
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
277 " samples x ",
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
278 desMC["X_variables", ],
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
279 " variables",
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
280 ifelse(modC != "PCA",
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
281 " and 1 response",
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
282 ""),
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
283 "\n", sep = "")
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
284
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
285 cat("\n", ropLs@suppLs[["scaleC"]], " scaling of dataMatrix",
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
286 ifelse(modC == "PCA",
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
287 "",
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
288 paste0(" and ",
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
289 ifelse(mode(ropLs@suppLs[["yMCN"]]) == "character" && ropLs@suppLs[["scaleC"]] != "standard",
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
290 "standard scaling of ",
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
291 ""),
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
292 "response\n")), sep = "")
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
293
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
294 if(substr(desMC["missing_values", ], 1, 1) != "0")
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
295 cat("\n", desMC["missing_values", ], " NAs\n", sep = "")
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
296
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
297 if(substr(desMC["near_zero_excluded_X_variables", ], 1, 1) != "0")
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
298 cat("\n", desMC["near_zero_excluded_X_variables", ],
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
299 " excluded variables during model building (because of near zero variance)\n", sep = "")
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
300
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
301 cat("\n")
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
302
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
303 optDigN <- options()[["digits"]]
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
304 options(digits = 3)
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
305 print(ropLs@modelDF)
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
306 options(digits = optDigN)
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
307
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
308
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
309 ##------------------------------
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
310 ## Ending
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
311 ##------------------------------
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
312
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
313
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
314 ## Saving
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
315 ##-------
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
316
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
317
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
318 rspModC <- gsub("-", "", modC)
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
319 if(rspModC != "PCA")
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
320 rspModC <- paste0(make.names(argVc['respC']), "_", rspModC)
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
321
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
322 if(sumDF[, "pre"] + sumDF[, "ort"] < 2) {
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
323
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
324 tCompMN <- scoreMN
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
325 pCompMN <- loadingMN
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
326
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
327 } else {
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
328
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
329 if(sumDF[, "ort"] > 0) {
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
330 if(parCompVi[2] > sumDF[, "ort"] + 1)
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
331 stop("Selected orthogonal component for plotting (ordinate) exceeds the total number of orthogonal components of the model", call. = FALSE)
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
332 tCompMN <- cbind(scoreMN[, 1], orthoScoreMN[, parCompVi[2] - 1])
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
333 pCompMN <- cbind(loadingMN[, 1], orthoLoadingMN[, parCompVi[2] - 1])
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
334 colnames(pCompMN) <- colnames(tCompMN) <- c("h1", paste("o", parCompVi[2] - 1, sep = ""))
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
335 } else {
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
336 if(max(parCompVi) > sumDF[, "pre"])
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
337 stop("Selected component for plotting as ordinate exceeds the total number of predictive components of the model", call. = FALSE)
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
338 tCompMN <- scoreMN[, parCompVi, drop = FALSE]
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
339 pCompMN <- loadingMN[, parCompVi, drop = FALSE]
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
340 }
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
341
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
342 }
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
343
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
344 ## x-scores and prediction
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
345
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
346 colnames(tCompMN) <- paste0(rspModC, "_XSCOR-", colnames(tCompMN))
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
347 tCompDF <- as.data.frame(tCompMN)[rownames(samDF), , drop = FALSE]
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
348
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
349 if(modC != "PCA") {
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
350
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
351 if(!is.null(tesVl)) {
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
352 tCompFulMN <- matrix(NA,
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
353 nrow = nrow(samDF),
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
354 ncol = ncol(tCompMN),
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
355 dimnames = list(rownames(samDF), colnames(tCompMN)))
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
356 mode(tCompFulMN) <- "numeric"
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
357 tCompFulMN[rownames(tCompMN), ] <- tCompMN
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
358 tCompMN <- tCompFulMN
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
359
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
360 fitMCN <- fitted(ropLs)
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
361 fitFulMCN <- matrix(NA,
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
362 nrow = nrow(samDF),
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
363 ncol = 1,
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
364 dimnames = list(rownames(samDF), NULL))
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
365 mode(fitFulMCN) <- mode(fitMCN)
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
366 fitFulMCN[rownames(fitMCN), ] <- fitMCN
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
367 yPreMCN <- predict(ropLs, newdata = as.data.frame(xTesMN))
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
368 fitFulMCN[rownames(yPreMCN), ] <- yPreMCN
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
369 fitMCN <- fitFulMCN
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
370
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
371 } else
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
372 fitMCN <- fitted(ropLs)
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
373
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
374 colnames(fitMCN) <- paste0(rspModC,
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
375 "_predictions")
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
376 fitDF <- as.data.frame(fitMCN)[rownames(samDF), , drop = FALSE]
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
377
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
378 tCompDF <- cbind.data.frame(tCompDF, fitDF)
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
379 }
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
380
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
381 samDF <- cbind.data.frame(samDF, tCompDF)
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
382
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
383 ## x-loadings and VIP
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
384
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
385 colnames(pCompMN) <- paste0(rspModC, "_XLOAD-", colnames(pCompMN))
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
386 if(!is.null(vipVn)) {
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
387 pCompMN <- cbind(pCompMN, vipVn)
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
388 colnames(pCompMN)[ncol(pCompMN)] <- paste0(rspModC,
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
389 "_VIP",
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
390 ifelse(!is.null(orthoVipVn),
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
391 "_pred",
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
392 ""))
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
393 if(!is.null(orthoVipVn)) {
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
394 pCompMN <- cbind(pCompMN, orthoVipVn)
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
395 colnames(pCompMN)[ncol(pCompMN)] <- paste0(rspModC,
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
396 "_VIP_ortho")
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
397 }
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
398 }
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
399 if(!is.null(coeMN)) {
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
400 pCompMN <- cbind(pCompMN, coeMN)
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
401 colnames(pCompMN)[ncol(pCompMN)] <- paste0(rspModC, "_COEFF")
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
402 }
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
403 pCompDF <- as.data.frame(pCompMN)[rownames(varDF), , drop = FALSE]
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
404 varDF <- cbind.data.frame(varDF, pCompDF)
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
405
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
406 ## sampleMetadata
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
407
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
408 samDF <- cbind.data.frame(sampleMetadata = rownames(samDF),
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
409 samDF)
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
410 write.table(samDF,
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
411 file = argVc["sampleMetadata_out"],
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
412 quote = FALSE,
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
413 row.names = FALSE,
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
414 sep = "\t")
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
415
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
416 ## variableMetadata
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
417
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
418 varDF <- cbind.data.frame(variableMetadata = rownames(varDF),
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
419 varDF)
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
420 write.table(varDF,
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
421 file = argVc["variableMetadata_out"],
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
422 quote = FALSE,
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
423 row.names = FALSE,
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
424 sep = "\t")
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
425
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
426 # Output ropLs
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
427 if ( ! is.null(argVc['ropls_out']))
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
428 save(ropLs, file = argVc['ropls_out'])
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
429
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
430 ## Closing
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
431 ##--------
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
432
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
433 cat("\nEnd of '", modNamC, "' Galaxy module call: ",
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
434 as.character(Sys.time()), "\n", sep = "")
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
435
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
436 sink()
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
437
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
438 options(stringsAsFactors = strAsFacL)
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
439
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
440 rm(list = ls())