annotate multivariate_wrapper.R @ 4:5526f8258e8a draft default tip

planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 0f382a5296aae9bfc77df06b0a5ad493eb3c01f3
author ethevenot
date Wed, 28 Feb 2018 09:59:25 -0500
parents e91de3b04320
children
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
4
5526f8258e8a planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 0f382a5296aae9bfc77df06b0a5ad493eb3c01f3
ethevenot
parents: 3
diff changeset
5 # Constants
5526f8258e8a planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 0f382a5296aae9bfc77df06b0a5ad493eb3c01f3
ethevenot
parents: 3
diff changeset
6 argv <- commandArgs(trailingOnly = FALSE)
5526f8258e8a planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 0f382a5296aae9bfc77df06b0a5ad493eb3c01f3
ethevenot
parents: 3
diff changeset
7 script.path <- sub("--file=","",argv[grep("--file=",argv)])
5526f8258e8a planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 0f382a5296aae9bfc77df06b0a5ad493eb3c01f3
ethevenot
parents: 3
diff changeset
8 prog.name <- basename(script.path)
5526f8258e8a planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 0f382a5296aae9bfc77df06b0a5ad493eb3c01f3
ethevenot
parents: 3
diff changeset
9
5526f8258e8a planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 0f382a5296aae9bfc77df06b0a5ad493eb3c01f3
ethevenot
parents: 3
diff changeset
10 # Print help
5526f8258e8a planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 0f382a5296aae9bfc77df06b0a5ad493eb3c01f3
ethevenot
parents: 3
diff changeset
11 if (length(grep('-h', argv)) >0) {
5526f8258e8a planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 0f382a5296aae9bfc77df06b0a5ad493eb3c01f3
ethevenot
parents: 3
diff changeset
12 cat("Usage:", prog.name,
5526f8258e8a planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 0f382a5296aae9bfc77df06b0a5ad493eb3c01f3
ethevenot
parents: 3
diff changeset
13 "dataMatrix_in myDataMatrix.tsv",
5526f8258e8a planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 0f382a5296aae9bfc77df06b0a5ad493eb3c01f3
ethevenot
parents: 3
diff changeset
14 "sampleMetadata_in mySampleData.tsv",
5526f8258e8a planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 0f382a5296aae9bfc77df06b0a5ad493eb3c01f3
ethevenot
parents: 3
diff changeset
15 "variableMetadata_in myVariableMetadata.tsv",
5526f8258e8a planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 0f382a5296aae9bfc77df06b0a5ad493eb3c01f3
ethevenot
parents: 3
diff changeset
16 "respC ...",
5526f8258e8a planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 0f382a5296aae9bfc77df06b0a5ad493eb3c01f3
ethevenot
parents: 3
diff changeset
17 "predI ...",
5526f8258e8a planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 0f382a5296aae9bfc77df06b0a5ad493eb3c01f3
ethevenot
parents: 3
diff changeset
18 "orthoI ...",
5526f8258e8a planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 0f382a5296aae9bfc77df06b0a5ad493eb3c01f3
ethevenot
parents: 3
diff changeset
19 "testL ...",
5526f8258e8a planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 0f382a5296aae9bfc77df06b0a5ad493eb3c01f3
ethevenot
parents: 3
diff changeset
20 "typeC ...",
5526f8258e8a planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 0f382a5296aae9bfc77df06b0a5ad493eb3c01f3
ethevenot
parents: 3
diff changeset
21 "parAsColC ...",
5526f8258e8a planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 0f382a5296aae9bfc77df06b0a5ad493eb3c01f3
ethevenot
parents: 3
diff changeset
22 "parCexN ...",
5526f8258e8a planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 0f382a5296aae9bfc77df06b0a5ad493eb3c01f3
ethevenot
parents: 3
diff changeset
23 "parPc1I ...",
5526f8258e8a planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 0f382a5296aae9bfc77df06b0a5ad493eb3c01f3
ethevenot
parents: 3
diff changeset
24 "parPc2I ...",
5526f8258e8a planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 0f382a5296aae9bfc77df06b0a5ad493eb3c01f3
ethevenot
parents: 3
diff changeset
25 "parMahalC ...",
5526f8258e8a planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 0f382a5296aae9bfc77df06b0a5ad493eb3c01f3
ethevenot
parents: 3
diff changeset
26 "parLabVc ...",
5526f8258e8a planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 0f382a5296aae9bfc77df06b0a5ad493eb3c01f3
ethevenot
parents: 3
diff changeset
27 "algoC ...",
5526f8258e8a planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 0f382a5296aae9bfc77df06b0a5ad493eb3c01f3
ethevenot
parents: 3
diff changeset
28 "crossvalI ...",
5526f8258e8a planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 0f382a5296aae9bfc77df06b0a5ad493eb3c01f3
ethevenot
parents: 3
diff changeset
29 "log10L ...",
5526f8258e8a planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 0f382a5296aae9bfc77df06b0a5ad493eb3c01f3
ethevenot
parents: 3
diff changeset
30 "permI ...",
5526f8258e8a planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 0f382a5296aae9bfc77df06b0a5ad493eb3c01f3
ethevenot
parents: 3
diff changeset
31 "scaleC ...",
5526f8258e8a planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 0f382a5296aae9bfc77df06b0a5ad493eb3c01f3
ethevenot
parents: 3
diff changeset
32 "sampleMetadata_out mySampleMetadata_out.tsv",
5526f8258e8a planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 0f382a5296aae9bfc77df06b0a5ad493eb3c01f3
ethevenot
parents: 3
diff changeset
33 "variableMetadata_out myVariableMetadata_out.tsv",
5526f8258e8a planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 0f382a5296aae9bfc77df06b0a5ad493eb3c01f3
ethevenot
parents: 3
diff changeset
34 "figure figure.pdf",
5526f8258e8a planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 0f382a5296aae9bfc77df06b0a5ad493eb3c01f3
ethevenot
parents: 3
diff changeset
35 "information information.txt",
5526f8258e8a planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 0f382a5296aae9bfc77df06b0a5ad493eb3c01f3
ethevenot
parents: 3
diff changeset
36 "\n")
5526f8258e8a planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 0f382a5296aae9bfc77df06b0a5ad493eb3c01f3
ethevenot
parents: 3
diff changeset
37 quit(status = 0)
5526f8258e8a planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 0f382a5296aae9bfc77df06b0a5ad493eb3c01f3
ethevenot
parents: 3
diff changeset
38 }
5526f8258e8a planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 0f382a5296aae9bfc77df06b0a5ad493eb3c01f3
ethevenot
parents: 3
diff changeset
39
0
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
40 ########
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
41 # MAIN #
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
42 ########
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 argVc <- unlist(parseCommandArgs(evaluate=FALSE))
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 ##------------------------------
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
47 ## Initializing
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
48 ##------------------------------
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
49
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
50 ## options
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
51 ##--------
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 strAsFacL <- options()$stringsAsFactors
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
54 options(stringsAsFactors = 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 ## libraries
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
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
59 suppressMessages(library(ropls))
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 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
62 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
63
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
64 ## constants
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
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
67 modNamC <- "Multivariate" ## module name
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 topEnvC <- environment()
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
70 flgC <- "\n"
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 ## functions
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
73 ##----------
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
74
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
75 flgF <- function(tesC,
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
76 envC = topEnvC,
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
77 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
78
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
79 tesL <- eval(parse(text = tesC), envir = envC)
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
80
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
81 if(!tesL) {
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
82
4
5526f8258e8a planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 0f382a5296aae9bfc77df06b0a5ad493eb3c01f3
ethevenot
parents: 3
diff changeset
83 sink()
0
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
84 stpTxtC <- ifelse(is.na(txtC),
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
85 paste0(tesC, " is FALSE"),
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
86 txtC)
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
87
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
88 stop(stpTxtC,
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
89 call. = FALSE)
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
90
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
91 }
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
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
94
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
95
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
96 ## log file
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
97 ##---------
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
98
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
99 sink(argVc["information"])
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
100
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
101 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
102 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
103
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
104
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
105 ## arguments
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
106 ##----------
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
107
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
108 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
109 check.names = FALSE,
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
110 header = TRUE,
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
111 row.names = 1,
4
5526f8258e8a planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 0f382a5296aae9bfc77df06b0a5ad493eb3c01f3
ethevenot
parents: 3
diff changeset
112 sep = "\t",
5526f8258e8a planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 0f382a5296aae9bfc77df06b0a5ad493eb3c01f3
ethevenot
parents: 3
diff changeset
113 comment.char = "")))
0
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
114
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
115 samDF <- read.table(argVc["sampleMetadata_in"],
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
116 check.names = FALSE,
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
117 header = TRUE,
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
118 row.names = 1,
4
5526f8258e8a planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 0f382a5296aae9bfc77df06b0a5ad493eb3c01f3
ethevenot
parents: 3
diff changeset
119 sep = "\t",
5526f8258e8a planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 0f382a5296aae9bfc77df06b0a5ad493eb3c01f3
ethevenot
parents: 3
diff changeset
120 comment.char = "")
0
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
121 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
122
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
123 varDF <- read.table(argVc["variableMetadata_in"],
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
124 check.names = FALSE,
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
125 header = TRUE,
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
126 row.names = 1,
4
5526f8258e8a planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 0f382a5296aae9bfc77df06b0a5ad493eb3c01f3
ethevenot
parents: 3
diff changeset
127 sep = "\t",
5526f8258e8a planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 0f382a5296aae9bfc77df06b0a5ad493eb3c01f3
ethevenot
parents: 3
diff changeset
128 comment.char = "")
0
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
129 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
130
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
131 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
132 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
133 if(argVc["respC"] != "none") {
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
134 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
135 } else
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
136 yMCN <- NULL
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
137
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
138 if(argVc["testL"] == "TRUE") {
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
139 flgF("!is.null(yMCN)",
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
140 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
141 flgF("'test.' %in% colnames(samDF)",
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
142 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
143 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
144 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
145 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
146 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
147 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
148 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
149 tesVl <- samDF[, "test."] == "yes"
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
150 xTesMN <- xMN[tesVl, , drop = FALSE]
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
151 xMN <- xMN[!tesVl, , drop = FALSE]
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
152 yMCN <- yMCN[!tesVl, , drop = FALSE]
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
153 } else
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
154 tesVl <- NULL
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
155
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
156 if(!('parAsColC' %in% names(argVc)))
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
157 argVc["parAsColC"] <- "none"
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
158 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
159 if(argVc["parAsColC"] != "none") {
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
160 parAsColFcVn <- samDF[, argVc['parAsColC']]
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
161 if(is.character(parAsColFcVn))
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
162 parAsColFcVn <- factor(parAsColFcVn)
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
163 } else
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
164 parAsColFcVn <- NA
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
165
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
166 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
167 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
168 argVc["parMahalC"] <- argVc["respC"]
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
169 else
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
170 argVc["parMahalC"] <- "none"
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 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
173 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
174 if(argVc["parMahalC"] == "none") {
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
175 parEllipsesL <- FALSE
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
176 } else {
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
177 if(is.null(yMCN)) { ## PCA case
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
178 flgF("mode(samDF[, argVc['parMahalC']]) == 'character'",
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
179 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
180 parAsColFcVn <- factor(samDF[, argVc["parMahalC"]])
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
181 parEllipsesL <- TRUE
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
182 } else { ## (O)PLS-DA case
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
183 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
184 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
185 parEllipsesL <- TRUE
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
186 }
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(!('parLabVc' %in% names(argVc)))
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
190 argVc["parLabVc"] <- "none"
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
191 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
192 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
193 if('parLabVc' %in% names(argVc))
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
194 if(argVc["parLabVc"] != "none") {
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
195 flgF("mode(samDF[, argVc['parLabVc']]) == 'character'",
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
196 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
197 parLabVc <- samDF[, argVc['parLabVc']]
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
198 } else
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
199 parLabVc <- NA
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
200
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
201 if('parPc1I' %in% names(argVc)) {
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
202 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
203 } else
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
204 parCompVi <- c(1, 2)
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
205
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
206
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
207 ## checking
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
208 ##---------
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
209
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
210
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
211 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
212 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
213
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
214
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
215 if(argVc["orthoI"] == "NA" || argVc["orthoI"] != "0")
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
216 if(argVc["predI"] == "NA" || argVc["predI"] != "0") {
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
217 argVc["predI"] <- "1"
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
218 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
219 }
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
220
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
221 if(argVc["predI"] != "NA")
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
222 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
223 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
224 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
225 }
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("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
228 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
229 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
230 }
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
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
233 ##------------------------------
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
234 ## Computation and plot
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
235 ##------------------------------
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 sink()
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 optWrnN <- options()$warn
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
241 options(warn = -1)
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
242
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
243 ropLs <- opls(x = xMN,
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
244 y = yMCN,
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
245 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
246 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
247 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
248 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
249 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
250 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
251 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
252 subset = NULL,
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
253 printL = FALSE,
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
254 plotL = FALSE,
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
255 .sinkC = argVc['information'])
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
256
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
257 modC <- ropLs@typeC
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
258 sumDF <- getSummaryDF(ropLs)
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
259 desMC <- ropLs@descriptionMC
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
260 scoreMN <- getScoreMN(ropLs)
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
261 loadingMN <- getLoadingMN(ropLs)
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 vipVn <- coeMN <- orthoScoreMN <- orthoLoadingMN <- orthoVipVn <- NULL
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
264
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
265 if(grepl("PLS", modC)) {
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 vipVn <- getVipVn(ropLs)
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
268 coeMN <- coef(ropLs)
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(grepl("OPLS", modC)) {
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
271 orthoScoreMN <- getScoreMN(ropLs, orthoL = TRUE)
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
272 orthoLoadingMN <- getLoadingMN(ropLs, orthoL = TRUE)
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
273 orthoVipVn <- getVipVn(ropLs, orthoL = TRUE)
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
274 }
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 }
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
277
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
278 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
279
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
280 if(sumDF[, "pre"] + sumDF[, "ort"] < 2) {
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
281 if(!(ploC %in% c("permutation", "overview"))) {
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
282 ploC <- "summary"
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
283 plotWarnL <- TRUE
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 } else
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
286 plotWarnL <- FALSE
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 plot(ropLs,
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
289 typeVc = ploC,
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
290 parAsColFcVn = parAsColFcVn,
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
291 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
292 parCompVi = parCompVi,
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
293 parEllipsesL = parEllipsesL,
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
294 parLabVc = parLabVc,
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
295 file.pdfC = argVc['figure'],
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
296 .sinkC = argVc['information'])
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
297
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
298 options(warn = optWrnN)
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
299
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 ##------------------------------
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
302 ## Print
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
303 ##------------------------------
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
304
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
305
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
306 sink(argVc["information"], append = TRUE)
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 if(plotWarnL)
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
309 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
310
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 cat("\n", modC, "\n", sep = "")
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 cat("\n", desMC["samples", ],
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
315 " samples x ",
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
316 desMC["X_variables", ],
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
317 " variables",
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
318 ifelse(modC != "PCA",
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
319 " and 1 response",
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
320 ""),
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
321 "\n", sep = "")
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
322
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
323 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
324 ifelse(modC == "PCA",
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
325 "",
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
326 paste0(" and ",
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
327 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
328 "standard scaling of ",
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
329 ""),
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
330 "response\n")), sep = "")
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
331
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
332 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
333 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
334
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
335 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
336 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
337 " 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
338
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
339 cat("\n")
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 optDigN <- options()[["digits"]]
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
342 options(digits = 3)
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
343 print(ropLs@modelDF)
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
344 options(digits = optDigN)
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
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
347 ##------------------------------
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
348 ## Ending
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
349 ##------------------------------
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
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
352 ## Saving
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
353 ##-------
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
354
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
355
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
356 rspModC <- gsub("-", "", modC)
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
357 if(rspModC != "PCA")
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
358 rspModC <- paste0(make.names(argVc['respC']), "_", rspModC)
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 if(sumDF[, "pre"] + sumDF[, "ort"] < 2) {
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
361
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
362 tCompMN <- scoreMN
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
363 pCompMN <- loadingMN
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
364
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
365 } else {
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
366
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
367 if(sumDF[, "ort"] > 0) {
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
368 if(parCompVi[2] > sumDF[, "ort"] + 1)
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
369 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
370 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
371 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
372 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
373 } else {
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
374 if(max(parCompVi) > sumDF[, "pre"])
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
375 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
376 tCompMN <- scoreMN[, parCompVi, drop = FALSE]
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
377 pCompMN <- loadingMN[, parCompVi, drop = FALSE]
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
378 }
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
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
382 ## x-scores and prediction
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
383
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
384 colnames(tCompMN) <- paste0(rspModC, "_XSCOR-", colnames(tCompMN))
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
385 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
386
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
387 if(modC != "PCA") {
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
388
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
389 if(!is.null(tesVl)) {
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
390 tCompFulMN <- matrix(NA,
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
391 nrow = nrow(samDF),
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
392 ncol = ncol(tCompMN),
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
393 dimnames = list(rownames(samDF), colnames(tCompMN)))
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
394 mode(tCompFulMN) <- "numeric"
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
395 tCompFulMN[rownames(tCompMN), ] <- tCompMN
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
396 tCompMN <- tCompFulMN
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 fitMCN <- fitted(ropLs)
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
399 fitFulMCN <- matrix(NA,
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
400 nrow = nrow(samDF),
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
401 ncol = 1,
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
402 dimnames = list(rownames(samDF), NULL))
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
403 mode(fitFulMCN) <- mode(fitMCN)
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
404 fitFulMCN[rownames(fitMCN), ] <- fitMCN
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
405 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
406 fitFulMCN[rownames(yPreMCN), ] <- yPreMCN
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
407 fitMCN <- fitFulMCN
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
408
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
409 } else
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
410 fitMCN <- fitted(ropLs)
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
411
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
412 colnames(fitMCN) <- paste0(rspModC,
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
413 "_predictions")
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
414 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
415
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
416 tCompDF <- cbind.data.frame(tCompDF, fitDF)
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
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
419 samDF <- cbind.data.frame(samDF, tCompDF)
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
420
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
421 ## x-loadings and VIP
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
422
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
423 colnames(pCompMN) <- paste0(rspModC, "_XLOAD-", colnames(pCompMN))
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
424 if(!is.null(vipVn)) {
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
425 pCompMN <- cbind(pCompMN, vipVn)
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
426 colnames(pCompMN)[ncol(pCompMN)] <- paste0(rspModC,
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
427 "_VIP",
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
428 ifelse(!is.null(orthoVipVn),
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
429 "_pred",
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
430 ""))
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
431 if(!is.null(orthoVipVn)) {
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
432 pCompMN <- cbind(pCompMN, orthoVipVn)
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
433 colnames(pCompMN)[ncol(pCompMN)] <- paste0(rspModC,
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
434 "_VIP_ortho")
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 }
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
437 if(!is.null(coeMN)) {
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
438 pCompMN <- cbind(pCompMN, coeMN)
3
e91de3b04320 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit bb92582ec396fd845b49454c4cadd86fbfc73fab
ethevenot
parents: 2
diff changeset
439 if(ncol(coeMN) == 1)
e91de3b04320 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit bb92582ec396fd845b49454c4cadd86fbfc73fab
ethevenot
parents: 2
diff changeset
440 colnames(pCompMN)[ncol(pCompMN)] <- paste0(rspModC, "_COEFF")
e91de3b04320 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit bb92582ec396fd845b49454c4cadd86fbfc73fab
ethevenot
parents: 2
diff changeset
441 else
e91de3b04320 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit bb92582ec396fd845b49454c4cadd86fbfc73fab
ethevenot
parents: 2
diff changeset
442 colnames(pCompMN)[(ncol(pCompMN) - ncol(coeMN) + 1):ncol(pCompMN)] <- paste0(rspModC, "_", colnames(coeMN), "-COEFF")
0
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
443 }
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
444 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
445 varDF <- cbind.data.frame(varDF, pCompDF)
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
446
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
447 ## sampleMetadata
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
448
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
449 samDF <- cbind.data.frame(sampleMetadata = rownames(samDF),
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
450 samDF)
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
451 write.table(samDF,
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
452 file = argVc["sampleMetadata_out"],
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
453 quote = FALSE,
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
454 row.names = FALSE,
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
455 sep = "\t")
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
456
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
457 ## variableMetadata
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
458
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
459 varDF <- cbind.data.frame(variableMetadata = rownames(varDF),
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
460 varDF)
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
461 write.table(varDF,
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
462 file = argVc["variableMetadata_out"],
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
463 quote = FALSE,
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
464 row.names = FALSE,
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
465 sep = "\t")
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
466
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
467 # Output ropLs
4
5526f8258e8a planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 0f382a5296aae9bfc77df06b0a5ad493eb3c01f3
ethevenot
parents: 3
diff changeset
468 if (!is.null(argVc['ropls_out']) && !is.na(argVc['ropls_out']))
5526f8258e8a planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 0f382a5296aae9bfc77df06b0a5ad493eb3c01f3
ethevenot
parents: 3
diff changeset
469 save(ropLs, file = argVc['ropls_out'])
0
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
470
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
471 ## Closing
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
472 ##--------
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
473
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
474 cat("\nEnd of '", modNamC, "' Galaxy module call: ",
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
475 as.character(Sys.time()), "\n", sep = "")
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
476
4
5526f8258e8a planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 0f382a5296aae9bfc77df06b0a5ad493eb3c01f3
ethevenot
parents: 3
diff changeset
477 cat("\n\n\n============================================================================")
5526f8258e8a planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 0f382a5296aae9bfc77df06b0a5ad493eb3c01f3
ethevenot
parents: 3
diff changeset
478 cat("\nAdditional information about the call:\n")
5526f8258e8a planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 0f382a5296aae9bfc77df06b0a5ad493eb3c01f3
ethevenot
parents: 3
diff changeset
479 cat("\n1) Parameters:\n")
5526f8258e8a planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 0f382a5296aae9bfc77df06b0a5ad493eb3c01f3
ethevenot
parents: 3
diff changeset
480 print(cbind(value = argVc))
5526f8258e8a planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 0f382a5296aae9bfc77df06b0a5ad493eb3c01f3
ethevenot
parents: 3
diff changeset
481
5526f8258e8a planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 0f382a5296aae9bfc77df06b0a5ad493eb3c01f3
ethevenot
parents: 3
diff changeset
482 cat("\n2) Session Info:\n")
5526f8258e8a planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 0f382a5296aae9bfc77df06b0a5ad493eb3c01f3
ethevenot
parents: 3
diff changeset
483 sessioninfo <- sessionInfo()
5526f8258e8a planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 0f382a5296aae9bfc77df06b0a5ad493eb3c01f3
ethevenot
parents: 3
diff changeset
484 cat(sessioninfo$R.version$version.string,"\n")
5526f8258e8a planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 0f382a5296aae9bfc77df06b0a5ad493eb3c01f3
ethevenot
parents: 3
diff changeset
485 cat("Main packages:\n")
5526f8258e8a planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 0f382a5296aae9bfc77df06b0a5ad493eb3c01f3
ethevenot
parents: 3
diff changeset
486 for (pkg in names(sessioninfo$otherPkgs)) { cat(paste(pkg,packageVersion(pkg)),"\t") }; cat("\n")
5526f8258e8a planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 0f382a5296aae9bfc77df06b0a5ad493eb3c01f3
ethevenot
parents: 3
diff changeset
487 cat("Other loaded packages:\n")
5526f8258e8a planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 0f382a5296aae9bfc77df06b0a5ad493eb3c01f3
ethevenot
parents: 3
diff changeset
488 for (pkg in names(sessioninfo$loadedOnly)) { cat(paste(pkg,packageVersion(pkg)),"\t") }; cat("\n")
5526f8258e8a planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 0f382a5296aae9bfc77df06b0a5ad493eb3c01f3
ethevenot
parents: 3
diff changeset
489
5526f8258e8a planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 0f382a5296aae9bfc77df06b0a5ad493eb3c01f3
ethevenot
parents: 3
diff changeset
490 cat("============================================================================\n")
5526f8258e8a planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 0f382a5296aae9bfc77df06b0a5ad493eb3c01f3
ethevenot
parents: 3
diff changeset
491
0
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
492 sink()
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
493
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
494 options(stringsAsFactors = strAsFacL)
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
495
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
496 rm(list = ls())