Mercurial > repos > ethevenot > multivariate
annotate multivariate_wrapper.R @ 0:fafba524dca6 draft
planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
author | ethevenot |
---|---|
date | Wed, 27 Jul 2016 11:22:56 -0400 |
parents | |
children | da272496b32d |
rev | line source |
---|---|
0
fafba524dca6
planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff
changeset
|
1 #!/usr/bin/env Rscript |
fafba524dca6
planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff
changeset
|
2 |
fafba524dca6
planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff
changeset
|
3 library(batch) ## parseCommandArgs |
fafba524dca6
planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff
changeset
|
4 |
fafba524dca6
planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff
changeset
|
5 ######## |
fafba524dca6
planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff
changeset
|
6 # MAIN # |
fafba524dca6
planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff
changeset
|
7 ######## |
fafba524dca6
planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff
changeset
|
8 |
fafba524dca6
planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff
changeset
|
9 argVc <- unlist(parseCommandArgs(evaluate=FALSE)) |
fafba524dca6
planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff
changeset
|
10 |
fafba524dca6
planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff
changeset
|
11 |
fafba524dca6
planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff
changeset
|
12 #### Start_of_tested_code <- function() {} |
fafba524dca6
planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff
changeset
|
13 |
fafba524dca6
planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff
changeset
|
14 |
fafba524dca6
planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff
changeset
|
15 ##------------------------------ |
fafba524dca6
planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff
changeset
|
16 ## Initializing |
fafba524dca6
planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff
changeset
|
17 ##------------------------------ |
fafba524dca6
planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff
changeset
|
18 |
fafba524dca6
planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff
changeset
|
19 ## options |
fafba524dca6
planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff
changeset
|
20 ##-------- |
fafba524dca6
planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff
changeset
|
21 |
fafba524dca6
planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff
changeset
|
22 strAsFacL <- options()$stringsAsFactors |
fafba524dca6
planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff
changeset
|
23 options(stringsAsFactors = FALSE) |
fafba524dca6
planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff
changeset
|
24 |
fafba524dca6
planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff
changeset
|
25 ## libraries |
fafba524dca6
planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff
changeset
|
26 ##---------- |
fafba524dca6
planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff
changeset
|
27 |
fafba524dca6
planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff
changeset
|
28 suppressMessages(library(ropls)) |
fafba524dca6
planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff
changeset
|
29 |
fafba524dca6
planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff
changeset
|
30 if(packageVersion("ropls") < "1.4.0") |
fafba524dca6
planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff
changeset
|
31 cat("\nWarning: new version of the 'ropls' package is available\n", sep="") |
fafba524dca6
planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff
changeset
|
32 |
fafba524dca6
planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff
changeset
|
33 ## constants |
fafba524dca6
planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff
changeset
|
34 ##---------- |
fafba524dca6
planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff
changeset
|
35 |
fafba524dca6
planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff
changeset
|
36 modNamC <- "Multivariate" ## module name |
fafba524dca6
planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff
changeset
|
37 |
fafba524dca6
planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff
changeset
|
38 topEnvC <- environment() |
fafba524dca6
planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff
changeset
|
39 flgC <- "\n" |
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 ## functions |
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 flgF <- function(tesC, |
fafba524dca6
planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff
changeset
|
45 envC = topEnvC, |
fafba524dca6
planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff
changeset
|
46 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
|
47 |
fafba524dca6
planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff
changeset
|
48 tesL <- eval(parse(text = tesC), envir = envC) |
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 if(!tesL) { |
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 sink(NULL) |
fafba524dca6
planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff
changeset
|
53 stpTxtC <- ifelse(is.na(txtC), |
fafba524dca6
planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff
changeset
|
54 paste0(tesC, " is FALSE"), |
fafba524dca6
planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff
changeset
|
55 txtC) |
fafba524dca6
planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff
changeset
|
56 |
fafba524dca6
planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff
changeset
|
57 stop(stpTxtC, |
fafba524dca6
planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff
changeset
|
58 call. = FALSE) |
fafba524dca6
planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff
changeset
|
59 |
fafba524dca6
planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff
changeset
|
60 } |
fafba524dca6
planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff
changeset
|
61 |
fafba524dca6
planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff
changeset
|
62 } ## flgF |
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 |
fafba524dca6
planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff
changeset
|
65 ## log file |
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 |
fafba524dca6
planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff
changeset
|
68 sink(argVc["information"]) |
fafba524dca6
planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff
changeset
|
69 |
fafba524dca6
planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff
changeset
|
70 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
|
71 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
|
72 |
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 ## arguments |
fafba524dca6
planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff
changeset
|
75 ##---------- |
fafba524dca6
planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff
changeset
|
76 |
fafba524dca6
planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff
changeset
|
77 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
|
78 check.names = FALSE, |
fafba524dca6
planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff
changeset
|
79 header = TRUE, |
fafba524dca6
planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff
changeset
|
80 row.names = 1, |
fafba524dca6
planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff
changeset
|
81 sep = "\t"))) |
fafba524dca6
planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff
changeset
|
82 |
fafba524dca6
planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff
changeset
|
83 samDF <- read.table(argVc["sampleMetadata_in"], |
fafba524dca6
planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff
changeset
|
84 check.names = FALSE, |
fafba524dca6
planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff
changeset
|
85 header = TRUE, |
fafba524dca6
planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff
changeset
|
86 row.names = 1, |
fafba524dca6
planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff
changeset
|
87 sep = "\t") |
fafba524dca6
planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff
changeset
|
88 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
|
89 |
fafba524dca6
planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff
changeset
|
90 varDF <- read.table(argVc["variableMetadata_in"], |
fafba524dca6
planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff
changeset
|
91 check.names = FALSE, |
fafba524dca6
planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff
changeset
|
92 header = TRUE, |
fafba524dca6
planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff
changeset
|
93 row.names = 1, |
fafba524dca6
planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff
changeset
|
94 sep = "\t") |
fafba524dca6
planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff
changeset
|
95 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
|
96 |
fafba524dca6
planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff
changeset
|
97 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
|
98 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
|
99 if(argVc["respC"] != "none") { |
fafba524dca6
planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff
changeset
|
100 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
|
101 } else |
fafba524dca6
planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff
changeset
|
102 yMCN <- NULL |
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 if(argVc["testL"] == "TRUE") { |
fafba524dca6
planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff
changeset
|
105 flgF("!is.null(yMCN)", |
fafba524dca6
planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff
changeset
|
106 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
|
107 flgF("'test.' %in% colnames(samDF)", |
fafba524dca6
planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff
changeset
|
108 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
|
109 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
|
110 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
|
111 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
|
112 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
|
113 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
|
114 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
|
115 tesVl <- samDF[, "test."] == "yes" |
fafba524dca6
planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff
changeset
|
116 xTesMN <- xMN[tesVl, , drop = FALSE] |
fafba524dca6
planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff
changeset
|
117 xMN <- xMN[!tesVl, , drop = FALSE] |
fafba524dca6
planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff
changeset
|
118 yMCN <- yMCN[!tesVl, , drop = FALSE] |
fafba524dca6
planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff
changeset
|
119 } else |
fafba524dca6
planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff
changeset
|
120 tesVl <- NULL |
fafba524dca6
planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff
changeset
|
121 |
fafba524dca6
planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff
changeset
|
122 if(!('parAsColC' %in% names(argVc))) |
fafba524dca6
planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff
changeset
|
123 argVc["parAsColC"] <- "none" |
fafba524dca6
planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff
changeset
|
124 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
|
125 if(argVc["parAsColC"] != "none") { |
fafba524dca6
planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff
changeset
|
126 parAsColFcVn <- samDF[, argVc['parAsColC']] |
fafba524dca6
planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff
changeset
|
127 if(is.character(parAsColFcVn)) |
fafba524dca6
planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff
changeset
|
128 parAsColFcVn <- factor(parAsColFcVn) |
fafba524dca6
planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff
changeset
|
129 } else |
fafba524dca6
planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff
changeset
|
130 parAsColFcVn <- NA |
fafba524dca6
planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff
changeset
|
131 |
fafba524dca6
planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff
changeset
|
132 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
|
133 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
|
134 argVc["parMahalC"] <- 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 argVc["parMahalC"] <- "none" |
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 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
|
139 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
|
140 if(argVc["parMahalC"] == "none") { |
fafba524dca6
planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff
changeset
|
141 parEllipsesL <- FALSE |
fafba524dca6
planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff
changeset
|
142 } else { |
fafba524dca6
planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff
changeset
|
143 if(is.null(yMCN)) { ## PCA case |
fafba524dca6
planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff
changeset
|
144 flgF("mode(samDF[, argVc['parMahalC']]) == 'character'", |
fafba524dca6
planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff
changeset
|
145 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
|
146 parAsColFcVn <- factor(samDF[, argVc["parMahalC"]]) |
fafba524dca6
planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff
changeset
|
147 parEllipsesL <- TRUE |
fafba524dca6
planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff
changeset
|
148 } else { ## (O)PLS-DA case |
fafba524dca6
planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff
changeset
|
149 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
|
150 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
|
151 parEllipsesL <- TRUE |
fafba524dca6
planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff
changeset
|
152 } |
fafba524dca6
planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff
changeset
|
153 } |
fafba524dca6
planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff
changeset
|
154 |
fafba524dca6
planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff
changeset
|
155 if(!('parLabVc' %in% names(argVc))) |
fafba524dca6
planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff
changeset
|
156 argVc["parLabVc"] <- "none" |
fafba524dca6
planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff
changeset
|
157 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
|
158 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
|
159 if('parLabVc' %in% names(argVc)) |
fafba524dca6
planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff
changeset
|
160 if(argVc["parLabVc"] != "none") { |
fafba524dca6
planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff
changeset
|
161 flgF("mode(samDF[, argVc['parLabVc']]) == 'character'", |
fafba524dca6
planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff
changeset
|
162 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
|
163 parLabVc <- samDF[, argVc['parLabVc']] |
fafba524dca6
planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff
changeset
|
164 } else |
fafba524dca6
planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff
changeset
|
165 parLabVc <- NA |
fafba524dca6
planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff
changeset
|
166 |
fafba524dca6
planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff
changeset
|
167 if('parPc1I' %in% names(argVc)) { |
fafba524dca6
planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff
changeset
|
168 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
|
169 } else |
fafba524dca6
planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff
changeset
|
170 parCompVi <- c(1, 2) |
fafba524dca6
planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff
changeset
|
171 |
fafba524dca6
planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff
changeset
|
172 |
fafba524dca6
planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff
changeset
|
173 ## checking |
fafba524dca6
planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff
changeset
|
174 ##--------- |
fafba524dca6
planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff
changeset
|
175 |
fafba524dca6
planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff
changeset
|
176 |
fafba524dca6
planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff
changeset
|
177 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
|
178 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
|
179 |
fafba524dca6
planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff
changeset
|
180 |
fafba524dca6
planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff
changeset
|
181 if(argVc["orthoI"] == "NA" || argVc["orthoI"] != "0") |
fafba524dca6
planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff
changeset
|
182 if(argVc["predI"] == "NA" || argVc["predI"] != "0") { |
fafba524dca6
planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff
changeset
|
183 argVc["predI"] <- "1" |
fafba524dca6
planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff
changeset
|
184 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
|
185 } |
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 if(argVc["predI"] != "NA") |
fafba524dca6
planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff
changeset
|
188 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
|
189 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
|
190 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
|
191 } |
fafba524dca6
planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff
changeset
|
192 |
fafba524dca6
planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff
changeset
|
193 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
|
194 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
|
195 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
|
196 } |
fafba524dca6
planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff
changeset
|
197 |
fafba524dca6
planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff
changeset
|
198 |
fafba524dca6
planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff
changeset
|
199 ##------------------------------ |
fafba524dca6
planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff
changeset
|
200 ## Computation and plot |
fafba524dca6
planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff
changeset
|
201 ##------------------------------ |
fafba524dca6
planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff
changeset
|
202 |
fafba524dca6
planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff
changeset
|
203 |
fafba524dca6
planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff
changeset
|
204 sink() |
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 optWrnN <- options()$warn |
fafba524dca6
planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff
changeset
|
207 options(warn = -1) |
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 ropLs <- opls(x = xMN, |
fafba524dca6
planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff
changeset
|
210 y = yMCN, |
fafba524dca6
planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff
changeset
|
211 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
|
212 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
|
213 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
|
214 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
|
215 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
|
216 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
|
217 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
|
218 subset = NULL, |
fafba524dca6
planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff
changeset
|
219 printL = FALSE, |
fafba524dca6
planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff
changeset
|
220 plotL = FALSE, |
fafba524dca6
planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff
changeset
|
221 .sinkC = argVc['information']) |
fafba524dca6
planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff
changeset
|
222 |
fafba524dca6
planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff
changeset
|
223 modC <- ropLs@typeC |
fafba524dca6
planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff
changeset
|
224 sumDF <- getSummaryDF(ropLs) |
fafba524dca6
planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff
changeset
|
225 desMC <- ropLs@descriptionMC |
fafba524dca6
planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff
changeset
|
226 scoreMN <- getScoreMN(ropLs) |
fafba524dca6
planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff
changeset
|
227 loadingMN <- getLoadingMN(ropLs) |
fafba524dca6
planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff
changeset
|
228 |
fafba524dca6
planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff
changeset
|
229 vipVn <- coeMN <- orthoScoreMN <- orthoLoadingMN <- orthoVipVn <- NULL |
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 if(grepl("PLS", modC)) { |
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 vipVn <- getVipVn(ropLs) |
fafba524dca6
planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff
changeset
|
234 coeMN <- coef(ropLs) |
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 if(grepl("OPLS", modC)) { |
fafba524dca6
planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff
changeset
|
237 orthoScoreMN <- getScoreMN(ropLs, orthoL = TRUE) |
fafba524dca6
planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff
changeset
|
238 orthoLoadingMN <- getLoadingMN(ropLs, orthoL = TRUE) |
fafba524dca6
planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff
changeset
|
239 orthoVipVn <- getVipVn(ropLs, orthoL = TRUE) |
fafba524dca6
planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff
changeset
|
240 } |
fafba524dca6
planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff
changeset
|
241 |
fafba524dca6
planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff
changeset
|
242 } |
fafba524dca6
planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff
changeset
|
243 |
fafba524dca6
planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff
changeset
|
244 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
|
245 |
fafba524dca6
planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff
changeset
|
246 if(sumDF[, "pre"] + sumDF[, "ort"] < 2) { |
fafba524dca6
planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff
changeset
|
247 if(!(ploC %in% c("permutation", "overview"))) { |
fafba524dca6
planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff
changeset
|
248 ploC <- "summary" |
fafba524dca6
planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff
changeset
|
249 plotWarnL <- TRUE |
fafba524dca6
planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff
changeset
|
250 } |
fafba524dca6
planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff
changeset
|
251 } else |
fafba524dca6
planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff
changeset
|
252 plotWarnL <- FALSE |
fafba524dca6
planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff
changeset
|
253 |
fafba524dca6
planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff
changeset
|
254 plot(ropLs, |
fafba524dca6
planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff
changeset
|
255 typeVc = ploC, |
fafba524dca6
planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff
changeset
|
256 parAsColFcVn = parAsColFcVn, |
fafba524dca6
planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff
changeset
|
257 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
|
258 parCompVi = parCompVi, |
fafba524dca6
planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff
changeset
|
259 parEllipsesL = parEllipsesL, |
fafba524dca6
planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff
changeset
|
260 parLabVc = parLabVc, |
fafba524dca6
planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff
changeset
|
261 file.pdfC = argVc['figure'], |
fafba524dca6
planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff
changeset
|
262 .sinkC = argVc['information']) |
fafba524dca6
planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff
changeset
|
263 |
fafba524dca6
planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff
changeset
|
264 options(warn = optWrnN) |
fafba524dca6
planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff
changeset
|
265 |
fafba524dca6
planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff
changeset
|
266 |
fafba524dca6
planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff
changeset
|
267 ##------------------------------ |
fafba524dca6
planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff
changeset
|
268 ## Print |
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 |
fafba524dca6
planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff
changeset
|
271 |
fafba524dca6
planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff
changeset
|
272 sink(argVc["information"], append = TRUE) |
fafba524dca6
planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff
changeset
|
273 |
fafba524dca6
planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff
changeset
|
274 if(plotWarnL) |
fafba524dca6
planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff
changeset
|
275 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
|
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 cat("\n", modC, "\n", sep = "") |
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 cat("\n", desMC["samples", ], |
fafba524dca6
planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff
changeset
|
281 " samples x ", |
fafba524dca6
planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff
changeset
|
282 desMC["X_variables", ], |
fafba524dca6
planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff
changeset
|
283 " variables", |
fafba524dca6
planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff
changeset
|
284 ifelse(modC != "PCA", |
fafba524dca6
planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff
changeset
|
285 " and 1 response", |
fafba524dca6
planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff
changeset
|
286 ""), |
fafba524dca6
planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff
changeset
|
287 "\n", sep = "") |
fafba524dca6
planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff
changeset
|
288 |
fafba524dca6
planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff
changeset
|
289 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
|
290 ifelse(modC == "PCA", |
fafba524dca6
planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff
changeset
|
291 "", |
fafba524dca6
planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff
changeset
|
292 paste0(" and ", |
fafba524dca6
planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff
changeset
|
293 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
|
294 "standard scaling of ", |
fafba524dca6
planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff
changeset
|
295 ""), |
fafba524dca6
planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff
changeset
|
296 "response\n")), sep = "") |
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 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
|
299 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
|
300 |
fafba524dca6
planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff
changeset
|
301 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
|
302 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
|
303 " 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
|
304 |
fafba524dca6
planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff
changeset
|
305 cat("\n") |
fafba524dca6
planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff
changeset
|
306 |
fafba524dca6
planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff
changeset
|
307 optDigN <- options()[["digits"]] |
fafba524dca6
planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff
changeset
|
308 options(digits = 3) |
fafba524dca6
planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff
changeset
|
309 print(ropLs@modelDF) |
fafba524dca6
planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff
changeset
|
310 options(digits = optDigN) |
fafba524dca6
planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff
changeset
|
311 |
fafba524dca6
planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff
changeset
|
312 |
fafba524dca6
planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff
changeset
|
313 ##------------------------------ |
fafba524dca6
planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff
changeset
|
314 ## Ending |
fafba524dca6
planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff
changeset
|
315 ##------------------------------ |
fafba524dca6
planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff
changeset
|
316 |
fafba524dca6
planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff
changeset
|
317 |
fafba524dca6
planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff
changeset
|
318 ## Saving |
fafba524dca6
planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff
changeset
|
319 ##------- |
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 |
fafba524dca6
planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff
changeset
|
322 rspModC <- gsub("-", "", modC) |
fafba524dca6
planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff
changeset
|
323 if(rspModC != "PCA") |
fafba524dca6
planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff
changeset
|
324 rspModC <- paste0(make.names(argVc['respC']), "_", rspModC) |
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 if(sumDF[, "pre"] + sumDF[, "ort"] < 2) { |
fafba524dca6
planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff
changeset
|
327 |
fafba524dca6
planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff
changeset
|
328 tCompMN <- scoreMN |
fafba524dca6
planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff
changeset
|
329 pCompMN <- loadingMN |
fafba524dca6
planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff
changeset
|
330 |
fafba524dca6
planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff
changeset
|
331 } else { |
fafba524dca6
planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff
changeset
|
332 |
fafba524dca6
planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff
changeset
|
333 if(sumDF[, "ort"] > 0) { |
fafba524dca6
planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff
changeset
|
334 if(parCompVi[2] > sumDF[, "ort"] + 1) |
fafba524dca6
planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff
changeset
|
335 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
|
336 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
|
337 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
|
338 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
|
339 } else { |
fafba524dca6
planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff
changeset
|
340 if(max(parCompVi) > sumDF[, "pre"]) |
fafba524dca6
planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff
changeset
|
341 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
|
342 tCompMN <- scoreMN[, parCompVi, drop = FALSE] |
fafba524dca6
planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff
changeset
|
343 pCompMN <- loadingMN[, parCompVi, drop = FALSE] |
fafba524dca6
planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff
changeset
|
344 } |
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 ## x-scores and prediction |
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 colnames(tCompMN) <- paste0(rspModC, "_XSCOR-", colnames(tCompMN)) |
fafba524dca6
planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff
changeset
|
351 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
|
352 |
fafba524dca6
planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff
changeset
|
353 if(modC != "PCA") { |
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 if(!is.null(tesVl)) { |
fafba524dca6
planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff
changeset
|
356 tCompFulMN <- matrix(NA, |
fafba524dca6
planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff
changeset
|
357 nrow = nrow(samDF), |
fafba524dca6
planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff
changeset
|
358 ncol = ncol(tCompMN), |
fafba524dca6
planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff
changeset
|
359 dimnames = list(rownames(samDF), colnames(tCompMN))) |
fafba524dca6
planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff
changeset
|
360 mode(tCompFulMN) <- "numeric" |
fafba524dca6
planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff
changeset
|
361 tCompFulMN[rownames(tCompMN), ] <- tCompMN |
fafba524dca6
planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff
changeset
|
362 tCompMN <- tCompFulMN |
fafba524dca6
planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff
changeset
|
363 |
fafba524dca6
planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff
changeset
|
364 fitMCN <- fitted(ropLs) |
fafba524dca6
planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff
changeset
|
365 fitFulMCN <- matrix(NA, |
fafba524dca6
planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff
changeset
|
366 nrow = nrow(samDF), |
fafba524dca6
planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff
changeset
|
367 ncol = 1, |
fafba524dca6
planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff
changeset
|
368 dimnames = list(rownames(samDF), NULL)) |
fafba524dca6
planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff
changeset
|
369 mode(fitFulMCN) <- mode(fitMCN) |
fafba524dca6
planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff
changeset
|
370 fitFulMCN[rownames(fitMCN), ] <- fitMCN |
fafba524dca6
planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff
changeset
|
371 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
|
372 fitFulMCN[rownames(yPreMCN), ] <- yPreMCN |
fafba524dca6
planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff
changeset
|
373 fitMCN <- fitFulMCN |
fafba524dca6
planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff
changeset
|
374 |
fafba524dca6
planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff
changeset
|
375 } else |
fafba524dca6
planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff
changeset
|
376 fitMCN <- fitted(ropLs) |
fafba524dca6
planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff
changeset
|
377 |
fafba524dca6
planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff
changeset
|
378 colnames(fitMCN) <- paste0(rspModC, |
fafba524dca6
planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff
changeset
|
379 "_predictions") |
fafba524dca6
planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff
changeset
|
380 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
|
381 |
fafba524dca6
planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff
changeset
|
382 tCompDF <- cbind.data.frame(tCompDF, fitDF) |
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 |
fafba524dca6
planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff
changeset
|
385 samDF <- cbind.data.frame(samDF, tCompDF) |
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 ## x-loadings and VIP |
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 colnames(pCompMN) <- paste0(rspModC, "_XLOAD-", colnames(pCompMN)) |
fafba524dca6
planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff
changeset
|
390 if(!is.null(vipVn)) { |
fafba524dca6
planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff
changeset
|
391 pCompMN <- cbind(pCompMN, vipVn) |
fafba524dca6
planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff
changeset
|
392 colnames(pCompMN)[ncol(pCompMN)] <- paste0(rspModC, |
fafba524dca6
planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff
changeset
|
393 "_VIP", |
fafba524dca6
planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff
changeset
|
394 ifelse(!is.null(orthoVipVn), |
fafba524dca6
planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff
changeset
|
395 "_pred", |
fafba524dca6
planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff
changeset
|
396 "")) |
fafba524dca6
planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff
changeset
|
397 if(!is.null(orthoVipVn)) { |
fafba524dca6
planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff
changeset
|
398 pCompMN <- cbind(pCompMN, orthoVipVn) |
fafba524dca6
planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff
changeset
|
399 colnames(pCompMN)[ncol(pCompMN)] <- paste0(rspModC, |
fafba524dca6
planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff
changeset
|
400 "_VIP_ortho") |
fafba524dca6
planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff
changeset
|
401 } |
fafba524dca6
planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff
changeset
|
402 } |
fafba524dca6
planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff
changeset
|
403 if(!is.null(coeMN)) { |
fafba524dca6
planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff
changeset
|
404 pCompMN <- cbind(pCompMN, coeMN) |
fafba524dca6
planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff
changeset
|
405 colnames(pCompMN)[ncol(pCompMN)] <- paste0(rspModC, "_COEFF") |
fafba524dca6
planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff
changeset
|
406 } |
fafba524dca6
planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff
changeset
|
407 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
|
408 varDF <- cbind.data.frame(varDF, pCompDF) |
fafba524dca6
planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff
changeset
|
409 |
fafba524dca6
planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff
changeset
|
410 ## sampleMetadata |
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 samDF <- cbind.data.frame(sampleMetadata = rownames(samDF), |
fafba524dca6
planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff
changeset
|
413 samDF) |
fafba524dca6
planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff
changeset
|
414 write.table(samDF, |
fafba524dca6
planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff
changeset
|
415 file = argVc["sampleMetadata_out"], |
fafba524dca6
planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff
changeset
|
416 quote = FALSE, |
fafba524dca6
planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff
changeset
|
417 row.names = FALSE, |
fafba524dca6
planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff
changeset
|
418 sep = "\t") |
fafba524dca6
planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff
changeset
|
419 |
fafba524dca6
planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff
changeset
|
420 ## variableMetadata |
fafba524dca6
planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff
changeset
|
421 |
fafba524dca6
planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff
changeset
|
422 varDF <- cbind.data.frame(variableMetadata = rownames(varDF), |
fafba524dca6
planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff
changeset
|
423 varDF) |
fafba524dca6
planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff
changeset
|
424 write.table(varDF, |
fafba524dca6
planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff
changeset
|
425 file = argVc["variableMetadata_out"], |
fafba524dca6
planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff
changeset
|
426 quote = FALSE, |
fafba524dca6
planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff
changeset
|
427 row.names = FALSE, |
fafba524dca6
planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff
changeset
|
428 sep = "\t") |
fafba524dca6
planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff
changeset
|
429 |
fafba524dca6
planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff
changeset
|
430 # Output ropLs |
fafba524dca6
planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff
changeset
|
431 if ( ! is.null(argVc['ropls_out'])) |
fafba524dca6
planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff
changeset
|
432 save(ropLs, file = argVc['ropls_out']) |
fafba524dca6
planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff
changeset
|
433 |
fafba524dca6
planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff
changeset
|
434 ## Closing |
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 cat("\nEnd of '", modNamC, "' Galaxy module call: ", |
fafba524dca6
planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff
changeset
|
438 as.character(Sys.time()), "\n", sep = "") |
fafba524dca6
planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff
changeset
|
439 |
fafba524dca6
planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff
changeset
|
440 sink() |
fafba524dca6
planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff
changeset
|
441 |
fafba524dca6
planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff
changeset
|
442 options(stringsAsFactors = strAsFacL) |
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 |
fafba524dca6
planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff
changeset
|
445 #### End_of_tested_code <- function() {} |
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 |
fafba524dca6
planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff
changeset
|
448 rm(list = ls()) |