annotate tests/multivariate_tests.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
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
1 #!/usr/bin/env Rscript
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
2
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
3 args <- commandArgs(trailingOnly = F)
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
4 script.path <- sub("--file=","",args[grep("--file=",args)])
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
5 library(RUnit)
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
6 library(ropls)
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 # CONSTANTS #
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 exaDirOutC <- file.path(dirname(script.path), 'output')
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 # LOAD DATA FRAME #
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
16 ###################
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
17
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
18 load.df <- function(file) {
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
19 file.exists(file) || stop(paste0("No output file \"", file ,"\"."))
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
20 return(read.table(file = file, header = TRUE, sep = "\t", stringsAsFactors = FALSE))
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
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
23 #############################
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
24 # CALL MULTIVARIATE WRAPPER #
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
25 #############################
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
26
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
27 call.multivariate.wrapper <- function(params) {
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
28
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
29 # Set program path
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
30 prog <- file.path(dirname(script.path), '..', 'multivariate_wrapper.R')
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
31
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
32 # Set arguments
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
33 args <- NULL
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
34 for (a in names(params))
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
35 args <- c(args, a, params[[a]])
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
36
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
37 # Call
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
38 call <- paste(c(prog, args), collapse = ' ')
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
39 retcode <- system(call)
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
40 if (retcode != 0)
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
41 stop("Error when running multivariate_wrapper.R.")
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 # Get output
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
44 out <- list()
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
45 if ('ropls_out' %in% names(params)) {
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
46 load(file = params[['ropls_out']])
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
47 out[['ropLs']] <- ropLs
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
48 }
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
49 if ('sampleMetadata_out' %in% names(params))
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
50 out[['samDF']] <- load.df(params[['sampleMetadata_out']])
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
51 if ('variableMetadata_out' %in% names(params))
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
52 out[['varDF']] <- load.df(params[['variableMetadata_out']])
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
53
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
54 return(out)
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
55 }
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
56
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
57 ########
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
58 # MAIN #
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 ## Create output folder
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
62 ##---------------------
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
63 file.exists(exaDirOutC) || dir.create(exaDirOutC)
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 # Define data sets
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
66 tesArgLs <- list(input_pca = c(respC = "none",
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
67 predI = "NA",
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
68 orthoI = "0",
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
69 testL = "FALSE"),
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
70 input_pcaGender = c(respC = "none",
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
71 predI = "NA",
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
72 orthoI = "0",
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
73 testL = "FALSE",
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
74 parMahalC = "gender"),
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
75 input_plsdaGender = c(respC = "gender",
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
76 predI = "NA",
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
77 orthoI = "0",
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
78 testL = "FALSE"),
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
79 input_oplsAge = c(respC = "age",
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
80 predI = "1",
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
81 orthoI = "1",
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
82 testL = "FALSE"),
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
83 input_oplsdaGender = c(respC = "gender",
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
84 predI = "1",
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
85 orthoI = "1",
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
86 testL = "FALSE"),
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
87 sacurine_pca = c(respC = "none",
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
88 predI = "NA",
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
89 orthoI = "0",
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
90 testL = "FALSE"),
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
91 sacurine_pcaGender = c(respC = "none",
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
92 predI = "NA",
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
93 orthoI = "0",
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
94 testL = "FALSE",
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
95 parMahalC = "gender"),
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
96 sacurine_plsAge = c(respC = "age",
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
97 predI = "NA",
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
98 orthoI = "0",
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
99 testL = "FALSE"),
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
100 sacurine_plsdaGender = c(respC = "gender",
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
101 predI = "NA",
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
102 orthoI = "0",
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
103 testL = "FALSE",
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
104 .chkC = "checkEqualsNumeric(getSummaryDF(outLs[['ropLs']])[, 'Q2(cum)'], 0.584, tolerance = 1e-3)"),
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
105 sacurineTest_pls = c(respC = "age",
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
106 predI = "2",
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
107 orthoI = "0",
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
108 testL = "TRUE",
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
109 .chkC = "checkEqualsNumeric(outLs[['samDF']][181, 'age_PLS_predictions'], 40.82252, tolerance = 1e-5)"),
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
110 sacurineTest_opls = c(respC = "age",
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
111 predI = "1",
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
112 orthoI = "2",
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
113 testL = "TRUE",
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
114 .chkC = "checkEqualsNumeric(outLs[['samDF']][181, 'age_OPLS_predictions'], 40.28963, tolerance = 1e-5)"),
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
115 sacurineTest_plsda = c(respC = "gender",
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
116 predI = "2",
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
117 orthoI = "0",
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
118 testL = "TRUE",
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
119 .chkC = "checkEquals(outLs[['samDF']][181, 'gender_PLSDA_predictions'], 'F')"),
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
120 sacurineTest_oplsda = c(respC = "gender",
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
121 predI = "1",
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
122 orthoI = "1",
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
123 testL = "TRUE",
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
124 .chkC = "checkEquals(outLs[['samDF']][181, 'gender_OPLSDA_predictions'], 'F')"),
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
125 sacurine_oplsAge = c(respC = "age",
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
126 predI = "1",
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
127 orthoI = "1",
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
128 testL = "FALSE",
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
129 .chkC = "checkEqualsNumeric(outLs[['varDF']][1, 'age_OPLS_VIP_ortho'], 0.3514378, tolerance = 1e-7)"),
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
130 sacurine_oplsdaGender = c(respC = "gender",
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
131 predI = "1",
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
132 orthoI = "1",
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
133 testL = "FALSE"),
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
134 example1_plsda = c(respC = "traitment",
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
135 predI = "3",
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
136 orthoI = "0",
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
137 testL = "FALSE",
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
138 .chkC = "checkEqualsNumeric(nrow(outLs[['ropLs']]@modelDF), 3, tolerance = 0.5)"),
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
139 example2_pca = c(respC = "none",
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
140 predI = "NA",
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
141 orthoI = "0",
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
142 testL = "FALSE"))
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
143
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
144 # Add file information for each dataset
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
145 for(tesC in names(tesArgLs))
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
146 tesArgLs[[tesC]] <- c(tesArgLs[[tesC]],
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
147 dataMatrix_in = file.path(unlist(strsplit(tesC, "_"))[1], "dataMatrix.tsv"),
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
148 sampleMetadata_in = file.path(unlist(strsplit(tesC, "_"))[1], "sampleMetadata.tsv"),
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
149 variableMetadata_in = file.path(unlist(strsplit(tesC, "_"))[1], "variableMetadata.tsv"),
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
150 sampleMetadata_out = file.path(exaDirOutC, "sampleMetadata.tsv"),
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
151 variableMetadata_out = file.path(exaDirOutC, "variableMetadata.tsv"),
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
152 ropls_out = file.path(exaDirOutC, "ropls.bin"),
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
153 figure = file.path(exaDirOutC, "figure.pdf"),
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
154 information = file.path(exaDirOutC, "information.txt"))
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
155
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
156 # Run tests on each dataset
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
157 for(tesC in names(tesArgLs)) {
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
158 print(tesC)
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
159 args <- as.list(tesArgLs[[tesC]])
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
160 args[['.chkC']] <- NULL
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
161 outLs <- call.multivariate.wrapper(args)
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
162 if(".chkC" %in% names(tesArgLs[[tesC]]))
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
163 stopifnot(eval(parse(text = tesArgLs[[tesC]][[".chkC"]])))
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
164 }
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
165
fafba524dca6 planemo upload for repository https://github.com/workflow4metabolomics/multivariate.git commit 6596dbd39d20ee1962d9ebdd87eec04821239760
ethevenot
parents:
diff changeset
166 message("Checks successfully completed")