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