Mercurial > repos > ethevenot > batchcorrection
annotate runit/batchcorrection_runtests.R @ 0:b74d1d533dea draft default tip
planemo upload for repository https://github.com/workflow4metabolomics/batchcorrection.git commit 241fb99a843e13195c5054cd9731e1561f039bde
| author | ethevenot | 
|---|---|
| date | Thu, 04 Aug 2016 11:40:35 -0400 | 
| parents | |
| children | 
| rev | line source | 
|---|---|
| 
0
 
b74d1d533dea
planemo upload for repository https://github.com/workflow4metabolomics/batchcorrection.git commit 241fb99a843e13195c5054cd9731e1561f039bde
 
ethevenot 
parents:  
diff
changeset
 | 
1 #!/usr/bin/env Rscript | 
| 
 
b74d1d533dea
planemo upload for repository https://github.com/workflow4metabolomics/batchcorrection.git commit 241fb99a843e13195c5054cd9731e1561f039bde
 
ethevenot 
parents:  
diff
changeset
 | 
2 | 
| 
 
b74d1d533dea
planemo upload for repository https://github.com/workflow4metabolomics/batchcorrection.git commit 241fb99a843e13195c5054cd9731e1561f039bde
 
ethevenot 
parents:  
diff
changeset
 | 
3 ## Package | 
| 
 
b74d1d533dea
planemo upload for repository https://github.com/workflow4metabolomics/batchcorrection.git commit 241fb99a843e13195c5054cd9731e1561f039bde
 
ethevenot 
parents:  
diff
changeset
 | 
4 ##-------- | 
| 
 
b74d1d533dea
planemo upload for repository https://github.com/workflow4metabolomics/batchcorrection.git commit 241fb99a843e13195c5054cd9731e1561f039bde
 
ethevenot 
parents:  
diff
changeset
 | 
5 | 
| 
 
b74d1d533dea
planemo upload for repository https://github.com/workflow4metabolomics/batchcorrection.git commit 241fb99a843e13195c5054cd9731e1561f039bde
 
ethevenot 
parents:  
diff
changeset
 | 
6 library(RUnit) | 
| 
 
b74d1d533dea
planemo upload for repository https://github.com/workflow4metabolomics/batchcorrection.git commit 241fb99a843e13195c5054cd9731e1561f039bde
 
ethevenot 
parents:  
diff
changeset
 | 
7 | 
| 
 
b74d1d533dea
planemo upload for repository https://github.com/workflow4metabolomics/batchcorrection.git commit 241fb99a843e13195c5054cd9731e1561f039bde
 
ethevenot 
parents:  
diff
changeset
 | 
8 ## Constants | 
| 
 
b74d1d533dea
planemo upload for repository https://github.com/workflow4metabolomics/batchcorrection.git commit 241fb99a843e13195c5054cd9731e1561f039bde
 
ethevenot 
parents:  
diff
changeset
 | 
9 ##---------- | 
| 
 
b74d1d533dea
planemo upload for repository https://github.com/workflow4metabolomics/batchcorrection.git commit 241fb99a843e13195c5054cd9731e1561f039bde
 
ethevenot 
parents:  
diff
changeset
 | 
10 | 
| 
 
b74d1d533dea
planemo upload for repository https://github.com/workflow4metabolomics/batchcorrection.git commit 241fb99a843e13195c5054cd9731e1561f039bde
 
ethevenot 
parents:  
diff
changeset
 | 
11 testOutDirC <- "output" | 
| 
 
b74d1d533dea
planemo upload for repository https://github.com/workflow4metabolomics/batchcorrection.git commit 241fb99a843e13195c5054cd9731e1561f039bde
 
ethevenot 
parents:  
diff
changeset
 | 
12 argVc <- commandArgs(trailingOnly = FALSE) | 
| 
 
b74d1d533dea
planemo upload for repository https://github.com/workflow4metabolomics/batchcorrection.git commit 241fb99a843e13195c5054cd9731e1561f039bde
 
ethevenot 
parents:  
diff
changeset
 | 
13 scriptPathC <- sub("--file=", "", argVc[grep("--file=", argVc)]) | 
| 
 
b74d1d533dea
planemo upload for repository https://github.com/workflow4metabolomics/batchcorrection.git commit 241fb99a843e13195c5054cd9731e1561f039bde
 
ethevenot 
parents:  
diff
changeset
 | 
14 | 
| 
 
b74d1d533dea
planemo upload for repository https://github.com/workflow4metabolomics/batchcorrection.git commit 241fb99a843e13195c5054cd9731e1561f039bde
 
ethevenot 
parents:  
diff
changeset
 | 
15 | 
| 
 
b74d1d533dea
planemo upload for repository https://github.com/workflow4metabolomics/batchcorrection.git commit 241fb99a843e13195c5054cd9731e1561f039bde
 
ethevenot 
parents:  
diff
changeset
 | 
16 ## Functions | 
| 
 
b74d1d533dea
planemo upload for repository https://github.com/workflow4metabolomics/batchcorrection.git commit 241fb99a843e13195c5054cd9731e1561f039bde
 
ethevenot 
parents:  
diff
changeset
 | 
17 ##----------- | 
| 
 
b74d1d533dea
planemo upload for repository https://github.com/workflow4metabolomics/batchcorrection.git commit 241fb99a843e13195c5054cd9731e1561f039bde
 
ethevenot 
parents:  
diff
changeset
 | 
18 | 
| 
 
b74d1d533dea
planemo upload for repository https://github.com/workflow4metabolomics/batchcorrection.git commit 241fb99a843e13195c5054cd9731e1561f039bde
 
ethevenot 
parents:  
diff
changeset
 | 
19 ## Reading tables (matrix or data frame) | 
| 
 
b74d1d533dea
planemo upload for repository https://github.com/workflow4metabolomics/batchcorrection.git commit 241fb99a843e13195c5054cd9731e1561f039bde
 
ethevenot 
parents:  
diff
changeset
 | 
20 readTableF <- function(fileC, typeC = c("matrix", "dataframe")[1]) { | 
| 
 
b74d1d533dea
planemo upload for repository https://github.com/workflow4metabolomics/batchcorrection.git commit 241fb99a843e13195c5054cd9731e1561f039bde
 
ethevenot 
parents:  
diff
changeset
 | 
21 | 
| 
 
b74d1d533dea
planemo upload for repository https://github.com/workflow4metabolomics/batchcorrection.git commit 241fb99a843e13195c5054cd9731e1561f039bde
 
ethevenot 
parents:  
diff
changeset
 | 
22 file.exists(fileC) || stop(paste0("No output file \"", fileC ,"\".")) | 
| 
 
b74d1d533dea
planemo upload for repository https://github.com/workflow4metabolomics/batchcorrection.git commit 241fb99a843e13195c5054cd9731e1561f039bde
 
ethevenot 
parents:  
diff
changeset
 | 
23 | 
| 
 
b74d1d533dea
planemo upload for repository https://github.com/workflow4metabolomics/batchcorrection.git commit 241fb99a843e13195c5054cd9731e1561f039bde
 
ethevenot 
parents:  
diff
changeset
 | 
24 switch(typeC, | 
| 
 
b74d1d533dea
planemo upload for repository https://github.com/workflow4metabolomics/batchcorrection.git commit 241fb99a843e13195c5054cd9731e1561f039bde
 
ethevenot 
parents:  
diff
changeset
 | 
25 matrix = return(t(as.matrix(read.table(file = fileC, | 
| 
 
b74d1d533dea
planemo upload for repository https://github.com/workflow4metabolomics/batchcorrection.git commit 241fb99a843e13195c5054cd9731e1561f039bde
 
ethevenot 
parents:  
diff
changeset
 | 
26 header = TRUE, | 
| 
 
b74d1d533dea
planemo upload for repository https://github.com/workflow4metabolomics/batchcorrection.git commit 241fb99a843e13195c5054cd9731e1561f039bde
 
ethevenot 
parents:  
diff
changeset
 | 
27 row.names = 1, | 
| 
 
b74d1d533dea
planemo upload for repository https://github.com/workflow4metabolomics/batchcorrection.git commit 241fb99a843e13195c5054cd9731e1561f039bde
 
ethevenot 
parents:  
diff
changeset
 | 
28 sep = "\t", | 
| 
 
b74d1d533dea
planemo upload for repository https://github.com/workflow4metabolomics/batchcorrection.git commit 241fb99a843e13195c5054cd9731e1561f039bde
 
ethevenot 
parents:  
diff
changeset
 | 
29 stringsAsFactors = FALSE)))), | 
| 
 
b74d1d533dea
planemo upload for repository https://github.com/workflow4metabolomics/batchcorrection.git commit 241fb99a843e13195c5054cd9731e1561f039bde
 
ethevenot 
parents:  
diff
changeset
 | 
30 dataframe = return(read.table(file = fileC, | 
| 
 
b74d1d533dea
planemo upload for repository https://github.com/workflow4metabolomics/batchcorrection.git commit 241fb99a843e13195c5054cd9731e1561f039bde
 
ethevenot 
parents:  
diff
changeset
 | 
31 header = TRUE, | 
| 
 
b74d1d533dea
planemo upload for repository https://github.com/workflow4metabolomics/batchcorrection.git commit 241fb99a843e13195c5054cd9731e1561f039bde
 
ethevenot 
parents:  
diff
changeset
 | 
32 row.names = 1, | 
| 
 
b74d1d533dea
planemo upload for repository https://github.com/workflow4metabolomics/batchcorrection.git commit 241fb99a843e13195c5054cd9731e1561f039bde
 
ethevenot 
parents:  
diff
changeset
 | 
33 sep = "\t", | 
| 
 
b74d1d533dea
planemo upload for repository https://github.com/workflow4metabolomics/batchcorrection.git commit 241fb99a843e13195c5054cd9731e1561f039bde
 
ethevenot 
parents:  
diff
changeset
 | 
34 stringsAsFactors = FALSE))) | 
| 
 
b74d1d533dea
planemo upload for repository https://github.com/workflow4metabolomics/batchcorrection.git commit 241fb99a843e13195c5054cd9731e1561f039bde
 
ethevenot 
parents:  
diff
changeset
 | 
35 | 
| 
 
b74d1d533dea
planemo upload for repository https://github.com/workflow4metabolomics/batchcorrection.git commit 241fb99a843e13195c5054cd9731e1561f039bde
 
ethevenot 
parents:  
diff
changeset
 | 
36 } | 
| 
 
b74d1d533dea
planemo upload for repository https://github.com/workflow4metabolomics/batchcorrection.git commit 241fb99a843e13195c5054cd9731e1561f039bde
 
ethevenot 
parents:  
diff
changeset
 | 
37 | 
| 
 
b74d1d533dea
planemo upload for repository https://github.com/workflow4metabolomics/batchcorrection.git commit 241fb99a843e13195c5054cd9731e1561f039bde
 
ethevenot 
parents:  
diff
changeset
 | 
38 ## Call wrapper | 
| 
 
b74d1d533dea
planemo upload for repository https://github.com/workflow4metabolomics/batchcorrection.git commit 241fb99a843e13195c5054cd9731e1561f039bde
 
ethevenot 
parents:  
diff
changeset
 | 
39 wrapperCallF <- function(paramLs, allLoessL) { | 
| 
 
b74d1d533dea
planemo upload for repository https://github.com/workflow4metabolomics/batchcorrection.git commit 241fb99a843e13195c5054cd9731e1561f039bde
 
ethevenot 
parents:  
diff
changeset
 | 
40 | 
| 
 
b74d1d533dea
planemo upload for repository https://github.com/workflow4metabolomics/batchcorrection.git commit 241fb99a843e13195c5054cd9731e1561f039bde
 
ethevenot 
parents:  
diff
changeset
 | 
41 ## Set program path | 
| 
 
b74d1d533dea
planemo upload for repository https://github.com/workflow4metabolomics/batchcorrection.git commit 241fb99a843e13195c5054cd9731e1561f039bde
 
ethevenot 
parents:  
diff
changeset
 | 
42 wrapperPathC <- file.path(dirname(scriptPathC), "..", | 
| 
 
b74d1d533dea
planemo upload for repository https://github.com/workflow4metabolomics/batchcorrection.git commit 241fb99a843e13195c5054cd9731e1561f039bde
 
ethevenot 
parents:  
diff
changeset
 | 
43 ifelse(allLoessL, | 
| 
 
b74d1d533dea
planemo upload for repository https://github.com/workflow4metabolomics/batchcorrection.git commit 241fb99a843e13195c5054cd9731e1561f039bde
 
ethevenot 
parents:  
diff
changeset
 | 
44 "batch_correction_all_loess_wrapper.R", | 
| 
 
b74d1d533dea
planemo upload for repository https://github.com/workflow4metabolomics/batchcorrection.git commit 241fb99a843e13195c5054cd9731e1561f039bde
 
ethevenot 
parents:  
diff
changeset
 | 
45 "batch_correction_wrapper.R")) | 
| 
 
b74d1d533dea
planemo upload for repository https://github.com/workflow4metabolomics/batchcorrection.git commit 241fb99a843e13195c5054cd9731e1561f039bde
 
ethevenot 
parents:  
diff
changeset
 | 
46 | 
| 
 
b74d1d533dea
planemo upload for repository https://github.com/workflow4metabolomics/batchcorrection.git commit 241fb99a843e13195c5054cd9731e1561f039bde
 
ethevenot 
parents:  
diff
changeset
 | 
47 ## Set arguments | 
| 
 
b74d1d533dea
planemo upload for repository https://github.com/workflow4metabolomics/batchcorrection.git commit 241fb99a843e13195c5054cd9731e1561f039bde
 
ethevenot 
parents:  
diff
changeset
 | 
48 argLs <- NULL | 
| 
 
b74d1d533dea
planemo upload for repository https://github.com/workflow4metabolomics/batchcorrection.git commit 241fb99a843e13195c5054cd9731e1561f039bde
 
ethevenot 
parents:  
diff
changeset
 | 
49 for (parC in names(paramLs)) | 
| 
 
b74d1d533dea
planemo upload for repository https://github.com/workflow4metabolomics/batchcorrection.git commit 241fb99a843e13195c5054cd9731e1561f039bde
 
ethevenot 
parents:  
diff
changeset
 | 
50 argLs <- c(argLs, parC, paramLs[[parC]]) | 
| 
 
b74d1d533dea
planemo upload for repository https://github.com/workflow4metabolomics/batchcorrection.git commit 241fb99a843e13195c5054cd9731e1561f039bde
 
ethevenot 
parents:  
diff
changeset
 | 
51 | 
| 
 
b74d1d533dea
planemo upload for repository https://github.com/workflow4metabolomics/batchcorrection.git commit 241fb99a843e13195c5054cd9731e1561f039bde
 
ethevenot 
parents:  
diff
changeset
 | 
52 ## Call | 
| 
 
b74d1d533dea
planemo upload for repository https://github.com/workflow4metabolomics/batchcorrection.git commit 241fb99a843e13195c5054cd9731e1561f039bde
 
ethevenot 
parents:  
diff
changeset
 | 
53 wrapperCallC <- paste(c(wrapperPathC, argLs), collapse = " ") | 
| 
 
b74d1d533dea
planemo upload for repository https://github.com/workflow4metabolomics/batchcorrection.git commit 241fb99a843e13195c5054cd9731e1561f039bde
 
ethevenot 
parents:  
diff
changeset
 | 
54 | 
| 
 
b74d1d533dea
planemo upload for repository https://github.com/workflow4metabolomics/batchcorrection.git commit 241fb99a843e13195c5054cd9731e1561f039bde
 
ethevenot 
parents:  
diff
changeset
 | 
55 if(.Platform$OS.type == "windows") | 
| 
 
b74d1d533dea
planemo upload for repository https://github.com/workflow4metabolomics/batchcorrection.git commit 241fb99a843e13195c5054cd9731e1561f039bde
 
ethevenot 
parents:  
diff
changeset
 | 
56 wrapperCallC <- paste("Rscript", wrapperCallC) | 
| 
 
b74d1d533dea
planemo upload for repository https://github.com/workflow4metabolomics/batchcorrection.git commit 241fb99a843e13195c5054cd9731e1561f039bde
 
ethevenot 
parents:  
diff
changeset
 | 
57 | 
| 
 
b74d1d533dea
planemo upload for repository https://github.com/workflow4metabolomics/batchcorrection.git commit 241fb99a843e13195c5054cd9731e1561f039bde
 
ethevenot 
parents:  
diff
changeset
 | 
58 | 
| 
 
b74d1d533dea
planemo upload for repository https://github.com/workflow4metabolomics/batchcorrection.git commit 241fb99a843e13195c5054cd9731e1561f039bde
 
ethevenot 
parents:  
diff
changeset
 | 
59 print(wrapperCallC) | 
| 
 
b74d1d533dea
planemo upload for repository https://github.com/workflow4metabolomics/batchcorrection.git commit 241fb99a843e13195c5054cd9731e1561f039bde
 
ethevenot 
parents:  
diff
changeset
 | 
60 | 
| 
 
b74d1d533dea
planemo upload for repository https://github.com/workflow4metabolomics/batchcorrection.git commit 241fb99a843e13195c5054cd9731e1561f039bde
 
ethevenot 
parents:  
diff
changeset
 | 
61 | 
| 
 
b74d1d533dea
planemo upload for repository https://github.com/workflow4metabolomics/batchcorrection.git commit 241fb99a843e13195c5054cd9731e1561f039bde
 
ethevenot 
parents:  
diff
changeset
 | 
62 wrapperCodeN <- system(wrapperCallC) | 
| 
 
b74d1d533dea
planemo upload for repository https://github.com/workflow4metabolomics/batchcorrection.git commit 241fb99a843e13195c5054cd9731e1561f039bde
 
ethevenot 
parents:  
diff
changeset
 | 
63 | 
| 
 
b74d1d533dea
planemo upload for repository https://github.com/workflow4metabolomics/batchcorrection.git commit 241fb99a843e13195c5054cd9731e1561f039bde
 
ethevenot 
parents:  
diff
changeset
 | 
64 if (wrapperCodeN != 0) | 
| 
 
b74d1d533dea
planemo upload for repository https://github.com/workflow4metabolomics/batchcorrection.git commit 241fb99a843e13195c5054cd9731e1561f039bde
 
ethevenot 
parents:  
diff
changeset
 | 
65 stop(paste0("Error when running 'batch_correction_", | 
| 
 
b74d1d533dea
planemo upload for repository https://github.com/workflow4metabolomics/batchcorrection.git commit 241fb99a843e13195c5054cd9731e1561f039bde
 
ethevenot 
parents:  
diff
changeset
 | 
66 ifelse(allLoessL, "all_loess_", ""), | 
| 
 
b74d1d533dea
planemo upload for repository https://github.com/workflow4metabolomics/batchcorrection.git commit 241fb99a843e13195c5054cd9731e1561f039bde
 
ethevenot 
parents:  
diff
changeset
 | 
67 "wrapper.R'")) | 
| 
 
b74d1d533dea
planemo upload for repository https://github.com/workflow4metabolomics/batchcorrection.git commit 241fb99a843e13195c5054cd9731e1561f039bde
 
ethevenot 
parents:  
diff
changeset
 | 
68 | 
| 
 
b74d1d533dea
planemo upload for repository https://github.com/workflow4metabolomics/batchcorrection.git commit 241fb99a843e13195c5054cd9731e1561f039bde
 
ethevenot 
parents:  
diff
changeset
 | 
69 ## Get output | 
| 
 
b74d1d533dea
planemo upload for repository https://github.com/workflow4metabolomics/batchcorrection.git commit 241fb99a843e13195c5054cd9731e1561f039bde
 
ethevenot 
parents:  
diff
changeset
 | 
70 outLs <- list() | 
| 
 
b74d1d533dea
planemo upload for repository https://github.com/workflow4metabolomics/batchcorrection.git commit 241fb99a843e13195c5054cd9731e1561f039bde
 
ethevenot 
parents:  
diff
changeset
 | 
71 if ("dataMatrix_out" %in% names(paramLs)) | 
| 
 
b74d1d533dea
planemo upload for repository https://github.com/workflow4metabolomics/batchcorrection.git commit 241fb99a843e13195c5054cd9731e1561f039bde
 
ethevenot 
parents:  
diff
changeset
 | 
72 outLs[["datMN"]] <- readTableF(paramLs[["dataMatrix_out"]], "matrix") | 
| 
 
b74d1d533dea
planemo upload for repository https://github.com/workflow4metabolomics/batchcorrection.git commit 241fb99a843e13195c5054cd9731e1561f039bde
 
ethevenot 
parents:  
diff
changeset
 | 
73 if ("sampleMetadata_out" %in% names(paramLs)) | 
| 
 
b74d1d533dea
planemo upload for repository https://github.com/workflow4metabolomics/batchcorrection.git commit 241fb99a843e13195c5054cd9731e1561f039bde
 
ethevenot 
parents:  
diff
changeset
 | 
74 outLs[["samDF"]] <- readTableF(paramLs[["sampleMetadata_out"]], "dataframe") | 
| 
 
b74d1d533dea
planemo upload for repository https://github.com/workflow4metabolomics/batchcorrection.git commit 241fb99a843e13195c5054cd9731e1561f039bde
 
ethevenot 
parents:  
diff
changeset
 | 
75 if ("variableMetadata_out" %in% names(paramLs)) | 
| 
 
b74d1d533dea
planemo upload for repository https://github.com/workflow4metabolomics/batchcorrection.git commit 241fb99a843e13195c5054cd9731e1561f039bde
 
ethevenot 
parents:  
diff
changeset
 | 
76 outLs[["varDF"]] <- readTableF(paramLs[["variableMetadata_out"]], "dataframe") | 
| 
 
b74d1d533dea
planemo upload for repository https://github.com/workflow4metabolomics/batchcorrection.git commit 241fb99a843e13195c5054cd9731e1561f039bde
 
ethevenot 
parents:  
diff
changeset
 | 
77 if("information" %in% names(paramLs)) | 
| 
 
b74d1d533dea
planemo upload for repository https://github.com/workflow4metabolomics/batchcorrection.git commit 241fb99a843e13195c5054cd9731e1561f039bde
 
ethevenot 
parents:  
diff
changeset
 | 
78 outLs[["infVc"]] <- readLines(paramLs[["information"]]) | 
| 
 
b74d1d533dea
planemo upload for repository https://github.com/workflow4metabolomics/batchcorrection.git commit 241fb99a843e13195c5054cd9731e1561f039bde
 
ethevenot 
parents:  
diff
changeset
 | 
79 | 
| 
 
b74d1d533dea
planemo upload for repository https://github.com/workflow4metabolomics/batchcorrection.git commit 241fb99a843e13195c5054cd9731e1561f039bde
 
ethevenot 
parents:  
diff
changeset
 | 
80 if("out_preNormSummary" %in% names(paramLs)) | 
| 
 
b74d1d533dea
planemo upload for repository https://github.com/workflow4metabolomics/batchcorrection.git commit 241fb99a843e13195c5054cd9731e1561f039bde
 
ethevenot 
parents:  
diff
changeset
 | 
81 outLs[["sumDF"]] <- readTableF(paramLs[["out_preNormSummary"]], "dataframe") | 
| 
 
b74d1d533dea
planemo upload for repository https://github.com/workflow4metabolomics/batchcorrection.git commit 241fb99a843e13195c5054cd9731e1561f039bde
 
ethevenot 
parents:  
diff
changeset
 | 
82 | 
| 
 
b74d1d533dea
planemo upload for repository https://github.com/workflow4metabolomics/batchcorrection.git commit 241fb99a843e13195c5054cd9731e1561f039bde
 
ethevenot 
parents:  
diff
changeset
 | 
83 return(outLs) | 
| 
 
b74d1d533dea
planemo upload for repository https://github.com/workflow4metabolomics/batchcorrection.git commit 241fb99a843e13195c5054cd9731e1561f039bde
 
ethevenot 
parents:  
diff
changeset
 | 
84 | 
| 
 
b74d1d533dea
planemo upload for repository https://github.com/workflow4metabolomics/batchcorrection.git commit 241fb99a843e13195c5054cd9731e1561f039bde
 
ethevenot 
parents:  
diff
changeset
 | 
85 } | 
| 
 
b74d1d533dea
planemo upload for repository https://github.com/workflow4metabolomics/batchcorrection.git commit 241fb99a843e13195c5054cd9731e1561f039bde
 
ethevenot 
parents:  
diff
changeset
 | 
86 | 
| 
 
b74d1d533dea
planemo upload for repository https://github.com/workflow4metabolomics/batchcorrection.git commit 241fb99a843e13195c5054cd9731e1561f039bde
 
ethevenot 
parents:  
diff
changeset
 | 
87 ## Setting default parameters | 
| 
 
b74d1d533dea
planemo upload for repository https://github.com/workflow4metabolomics/batchcorrection.git commit 241fb99a843e13195c5054cd9731e1561f039bde
 
ethevenot 
parents:  
diff
changeset
 | 
88 defaultArgF <- function(testInDirC, determineL) { | 
| 
 
b74d1d533dea
planemo upload for repository https://github.com/workflow4metabolomics/batchcorrection.git commit 241fb99a843e13195c5054cd9731e1561f039bde
 
ethevenot 
parents:  
diff
changeset
 | 
89 | 
| 
 
b74d1d533dea
planemo upload for repository https://github.com/workflow4metabolomics/batchcorrection.git commit 241fb99a843e13195c5054cd9731e1561f039bde
 
ethevenot 
parents:  
diff
changeset
 | 
90 defaultArgLs <- list() | 
| 
 
b74d1d533dea
planemo upload for repository https://github.com/workflow4metabolomics/batchcorrection.git commit 241fb99a843e13195c5054cd9731e1561f039bde
 
ethevenot 
parents:  
diff
changeset
 | 
91 | 
| 
 
b74d1d533dea
planemo upload for repository https://github.com/workflow4metabolomics/batchcorrection.git commit 241fb99a843e13195c5054cd9731e1561f039bde
 
ethevenot 
parents:  
diff
changeset
 | 
92 if(file.exists(file.path(dirname(scriptPathC), testInDirC, "dataMatrix.tsv"))) | 
| 
 
b74d1d533dea
planemo upload for repository https://github.com/workflow4metabolomics/batchcorrection.git commit 241fb99a843e13195c5054cd9731e1561f039bde
 
ethevenot 
parents:  
diff
changeset
 | 
93 defaultArgLs[["dataMatrix"]] <- file.path(dirname(scriptPathC), testInDirC, "dataMatrix.tsv") | 
| 
 
b74d1d533dea
planemo upload for repository https://github.com/workflow4metabolomics/batchcorrection.git commit 241fb99a843e13195c5054cd9731e1561f039bde
 
ethevenot 
parents:  
diff
changeset
 | 
94 if(file.exists(file.path(dirname(scriptPathC), testInDirC, "sampleMetadata.tsv"))) | 
| 
 
b74d1d533dea
planemo upload for repository https://github.com/workflow4metabolomics/batchcorrection.git commit 241fb99a843e13195c5054cd9731e1561f039bde
 
ethevenot 
parents:  
diff
changeset
 | 
95 defaultArgLs[["sampleMetadata"]] <- file.path(dirname(scriptPathC), testInDirC, "sampleMetadata.tsv") | 
| 
 
b74d1d533dea
planemo upload for repository https://github.com/workflow4metabolomics/batchcorrection.git commit 241fb99a843e13195c5054cd9731e1561f039bde
 
ethevenot 
parents:  
diff
changeset
 | 
96 | 
| 
 
b74d1d533dea
planemo upload for repository https://github.com/workflow4metabolomics/batchcorrection.git commit 241fb99a843e13195c5054cd9731e1561f039bde
 
ethevenot 
parents:  
diff
changeset
 | 
97 if(!determineL) | 
| 
 
b74d1d533dea
planemo upload for repository https://github.com/workflow4metabolomics/batchcorrection.git commit 241fb99a843e13195c5054cd9731e1561f039bde
 
ethevenot 
parents:  
diff
changeset
 | 
98 if(file.exists(file.path(dirname(scriptPathC), testInDirC, "variableMetadata.tsv"))) | 
| 
 
b74d1d533dea
planemo upload for repository https://github.com/workflow4metabolomics/batchcorrection.git commit 241fb99a843e13195c5054cd9731e1561f039bde
 
ethevenot 
parents:  
diff
changeset
 | 
99 defaultArgLs[["variableMetadata"]] <- file.path(dirname(scriptPathC), testInDirC, "variableMetadata.tsv") | 
| 
 
b74d1d533dea
planemo upload for repository https://github.com/workflow4metabolomics/batchcorrection.git commit 241fb99a843e13195c5054cd9731e1561f039bde
 
ethevenot 
parents:  
diff
changeset
 | 
100 | 
| 
 
b74d1d533dea
planemo upload for repository https://github.com/workflow4metabolomics/batchcorrection.git commit 241fb99a843e13195c5054cd9731e1561f039bde
 
ethevenot 
parents:  
diff
changeset
 | 
101 if(determineL) { ## determinebc | 
| 
 
b74d1d533dea
planemo upload for repository https://github.com/workflow4metabolomics/batchcorrection.git commit 241fb99a843e13195c5054cd9731e1561f039bde
 
ethevenot 
parents:  
diff
changeset
 | 
102 | 
| 
 
b74d1d533dea
planemo upload for repository https://github.com/workflow4metabolomics/batchcorrection.git commit 241fb99a843e13195c5054cd9731e1561f039bde
 
ethevenot 
parents:  
diff
changeset
 | 
103 defaultArgLs[["out_graph_pdf"]] <- file.path(dirname(scriptPathC), testOutDirC, "out_graph.pdf") | 
| 
 
b74d1d533dea
planemo upload for repository https://github.com/workflow4metabolomics/batchcorrection.git commit 241fb99a843e13195c5054cd9731e1561f039bde
 
ethevenot 
parents:  
diff
changeset
 | 
104 defaultArgLs[["out_preNormSummary"]] <- file.path(dirname(scriptPathC), testOutDirC, "preNormSummary.txt") | 
| 
 
b74d1d533dea
planemo upload for repository https://github.com/workflow4metabolomics/batchcorrection.git commit 241fb99a843e13195c5054cd9731e1561f039bde
 
ethevenot 
parents:  
diff
changeset
 | 
105 | 
| 
 
b74d1d533dea
planemo upload for repository https://github.com/workflow4metabolomics/batchcorrection.git commit 241fb99a843e13195c5054cd9731e1561f039bde
 
ethevenot 
parents:  
diff
changeset
 | 
106 } else { ## batchcorrection | 
| 
 
b74d1d533dea
planemo upload for repository https://github.com/workflow4metabolomics/batchcorrection.git commit 241fb99a843e13195c5054cd9731e1561f039bde
 
ethevenot 
parents:  
diff
changeset
 | 
107 | 
| 
 
b74d1d533dea
planemo upload for repository https://github.com/workflow4metabolomics/batchcorrection.git commit 241fb99a843e13195c5054cd9731e1561f039bde
 
ethevenot 
parents:  
diff
changeset
 | 
108 defaultArgLs[["dataMatrix_out"]] <- file.path(dirname(scriptPathC), testOutDirC, "dataMatrix.tsv") | 
| 
 
b74d1d533dea
planemo upload for repository https://github.com/workflow4metabolomics/batchcorrection.git commit 241fb99a843e13195c5054cd9731e1561f039bde
 
ethevenot 
parents:  
diff
changeset
 | 
109 defaultArgLs[["variableMetadata_out"]] <- file.path(dirname(scriptPathC), testOutDirC, "variableMetadata.tsv") | 
| 
 
b74d1d533dea
planemo upload for repository https://github.com/workflow4metabolomics/batchcorrection.git commit 241fb99a843e13195c5054cd9731e1561f039bde
 
ethevenot 
parents:  
diff
changeset
 | 
110 defaultArgLs[["variable_for_simca"]] <- file.path(dirname(scriptPathC), testOutDirC, "variable_for_simca.tsv") | 
| 
 
b74d1d533dea
planemo upload for repository https://github.com/workflow4metabolomics/batchcorrection.git commit 241fb99a843e13195c5054cd9731e1561f039bde
 
ethevenot 
parents:  
diff
changeset
 | 
111 defaultArgLs[["graph_output"]] <- file.path(dirname(scriptPathC), testOutDirC, "graph_output.pdf") | 
| 
 
b74d1d533dea
planemo upload for repository https://github.com/workflow4metabolomics/batchcorrection.git commit 241fb99a843e13195c5054cd9731e1561f039bde
 
ethevenot 
parents:  
diff
changeset
 | 
112 defaultArgLs[["rdata_output"]] <- file.path(dirname(scriptPathC), testOutDirC, "rdata_output.rdata") | 
| 
 
b74d1d533dea
planemo upload for repository https://github.com/workflow4metabolomics/batchcorrection.git commit 241fb99a843e13195c5054cd9731e1561f039bde
 
ethevenot 
parents:  
diff
changeset
 | 
113 | 
| 
 
b74d1d533dea
planemo upload for repository https://github.com/workflow4metabolomics/batchcorrection.git commit 241fb99a843e13195c5054cd9731e1561f039bde
 
ethevenot 
parents:  
diff
changeset
 | 
114 } | 
| 
 
b74d1d533dea
planemo upload for repository https://github.com/workflow4metabolomics/batchcorrection.git commit 241fb99a843e13195c5054cd9731e1561f039bde
 
ethevenot 
parents:  
diff
changeset
 | 
115 | 
| 
 
b74d1d533dea
planemo upload for repository https://github.com/workflow4metabolomics/batchcorrection.git commit 241fb99a843e13195c5054cd9731e1561f039bde
 
ethevenot 
parents:  
diff
changeset
 | 
116 defaultArgLs | 
| 
 
b74d1d533dea
planemo upload for repository https://github.com/workflow4metabolomics/batchcorrection.git commit 241fb99a843e13195c5054cd9731e1561f039bde
 
ethevenot 
parents:  
diff
changeset
 | 
117 | 
| 
 
b74d1d533dea
planemo upload for repository https://github.com/workflow4metabolomics/batchcorrection.git commit 241fb99a843e13195c5054cd9731e1561f039bde
 
ethevenot 
parents:  
diff
changeset
 | 
118 } | 
| 
 
b74d1d533dea
planemo upload for repository https://github.com/workflow4metabolomics/batchcorrection.git commit 241fb99a843e13195c5054cd9731e1561f039bde
 
ethevenot 
parents:  
diff
changeset
 | 
119 | 
| 
 
b74d1d533dea
planemo upload for repository https://github.com/workflow4metabolomics/batchcorrection.git commit 241fb99a843e13195c5054cd9731e1561f039bde
 
ethevenot 
parents:  
diff
changeset
 | 
120 ## Main | 
| 
 
b74d1d533dea
planemo upload for repository https://github.com/workflow4metabolomics/batchcorrection.git commit 241fb99a843e13195c5054cd9731e1561f039bde
 
ethevenot 
parents:  
diff
changeset
 | 
121 ##----- | 
| 
 
b74d1d533dea
planemo upload for repository https://github.com/workflow4metabolomics/batchcorrection.git commit 241fb99a843e13195c5054cd9731e1561f039bde
 
ethevenot 
parents:  
diff
changeset
 | 
122 | 
| 
 
b74d1d533dea
planemo upload for repository https://github.com/workflow4metabolomics/batchcorrection.git commit 241fb99a843e13195c5054cd9731e1561f039bde
 
ethevenot 
parents:  
diff
changeset
 | 
123 ## Create output folder | 
| 
 
b74d1d533dea
planemo upload for repository https://github.com/workflow4metabolomics/batchcorrection.git commit 241fb99a843e13195c5054cd9731e1561f039bde
 
ethevenot 
parents:  
diff
changeset
 | 
124 file.exists(testOutDirC) || dir.create(testOutDirC) | 
| 
 
b74d1d533dea
planemo upload for repository https://github.com/workflow4metabolomics/batchcorrection.git commit 241fb99a843e13195c5054cd9731e1561f039bde
 
ethevenot 
parents:  
diff
changeset
 | 
125 | 
| 
 
b74d1d533dea
planemo upload for repository https://github.com/workflow4metabolomics/batchcorrection.git commit 241fb99a843e13195c5054cd9731e1561f039bde
 
ethevenot 
parents:  
diff
changeset
 | 
126 ## Run tests | 
| 
 
b74d1d533dea
planemo upload for repository https://github.com/workflow4metabolomics/batchcorrection.git commit 241fb99a843e13195c5054cd9731e1561f039bde
 
ethevenot 
parents:  
diff
changeset
 | 
127 test.suite <- defineTestSuite('tests', dirname(scriptPathC), testFileRegexp = paste0('^.*_tests\\.R$'), testFuncRegexp = '^.*$') | 
| 
 
b74d1d533dea
planemo upload for repository https://github.com/workflow4metabolomics/batchcorrection.git commit 241fb99a843e13195c5054cd9731e1561f039bde
 
ethevenot 
parents:  
diff
changeset
 | 
128 isValidTestSuite(test.suite) | 
| 
 
b74d1d533dea
planemo upload for repository https://github.com/workflow4metabolomics/batchcorrection.git commit 241fb99a843e13195c5054cd9731e1561f039bde
 
ethevenot 
parents:  
diff
changeset
 | 
129 test.results <- runTestSuite(test.suite) | 
| 
 
b74d1d533dea
planemo upload for repository https://github.com/workflow4metabolomics/batchcorrection.git commit 241fb99a843e13195c5054cd9731e1561f039bde
 
ethevenot 
parents:  
diff
changeset
 | 
130 print(test.results) | 
| 
 
b74d1d533dea
planemo upload for repository https://github.com/workflow4metabolomics/batchcorrection.git commit 241fb99a843e13195c5054cd9731e1561f039bde
 
ethevenot 
parents:  
diff
changeset
 | 
131 | 
