diff runit/batchcorrection_tests.R @ 0:71d83d8920bf draft

planemo upload for repository https://github.com/workflow4metabolomics/batchcorrection.git commit de79117e6ab856420b87efca3675c7963688f975
author melpetera
date Tue, 09 Aug 2016 06:47:41 -0400
parents
children
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/runit/batchcorrection_tests.R	Tue Aug 09 06:47:41 2016 -0400
@@ -0,0 +1,109 @@
+test_input_allLoessPool <- function() {
+
+    testDirC <- "input"
+    determineL <- FALSE
+    allLoessL <- TRUE
+    argLs <- list(method = "all_loess_pool",
+                  span = "1")
+
+    if(!allLoessL)
+        argLs[["analyse"]] <- ifelse(determineL, "determine_bc", "batch_correction")
+    
+    argLs <- c(defaultArgF(testDirC, determineL = determineL), argLs)
+    outLs <- wrapperCallF(argLs, allLoessL = allLoessL)  
+
+    checkEqualsNumeric(outLs[['datMN']][1, 1], 25803076, tolerance = 1e-3)
+
+}
+
+test_input_allLoessSample <- function() {
+
+    testDirC <- "input"
+    determineL <- FALSE
+    allLoessL <- TRUE
+    argLs <- list(method = "all_loess_sample",
+                  span = "1")
+
+    if(!allLoessL)
+        argLs[["analyse"]] <- ifelse(determineL, "determine_bc", "batch_correction")
+    
+    argLs <- c(defaultArgF(testDirC, determineL = determineL), argLs)
+    outLs <- wrapperCallF(argLs, allLoessL = allLoessL)
+    
+    checkEqualsNumeric(outLs[['datMN']][1, 1], 23402048, tolerance = 1e-3)
+
+}
+
+test_example1_allLoessSample <- function() {
+
+    testDirC <- "example1"
+    determineL <- FALSE
+    allLoessL <- TRUE
+    argLs <- list(method = "all_loess_sample",
+                  span = "1")
+
+    if(!allLoessL)
+        argLs[["analyse"]] <- ifelse(determineL, "determine_bc", "batch_correction")
+    
+    argLs <- c(defaultArgF(testDirC, determineL = determineL), argLs)
+    outLs <- wrapperCallF(argLs, allLoessL = allLoessL)    
+
+    checkEqualsNumeric(outLs[['datMN']][1, 1], 21732604, tolerance = 1e-3)
+
+}
+
+test_example1_allLoessSampleSpan06 <- function() {
+
+    testDirC <- "example1"
+    determineL <- FALSE
+    allLoessL <- TRUE
+    argLs <- list(method = "all_loess_sample",
+                  span = "0.6")
+
+    if(!allLoessL)
+        argLs[["analyse"]] <- ifelse(determineL, "determine_bc", "batch_correction")
+    
+    argLs <- c(defaultArgF(testDirC, determineL = determineL), argLs)
+    outLs <- wrapperCallF(argLs, allLoessL = allLoessL)
+
+    checkEqualsNumeric(outLs[['datMN']][1, 1], 134619170, tolerance = 1e-3)
+
+}
+
+test_sacurine_allLoessPool <- function() {
+
+    testDirC <- "sacurine"
+    determineL <- FALSE
+    allLoessL <- TRUE
+    argLs <- list(method = "all_loess_pool",
+                  span = "1")
+
+    if(!allLoessL)
+        argLs[["analyse"]] <- ifelse(determineL, "determine_bc", "batch_correction")
+    
+    argLs <- c(defaultArgF(testDirC, determineL = determineL), argLs)
+    outLs <- wrapperCallF(argLs, allLoessL = allLoessL)
+ 
+    checkEqualsNumeric(outLs[['datMN']]["HU_neg_017", "M53T345"], 7902.366, tolerance = 1e-3)
+
+
+}
+
+test_sacurine_determinebc <- function() {
+
+    testDirC <- "sacurine"
+    determineL <- TRUE
+    allLoessL <- FALSE
+    argLs <- list(ref_factor = "batch",
+                  span = "none")
+
+    if(!allLoessL)
+        argLs[["analyse"]] <- ifelse(determineL, "determine_bc", "batch_correction")
+
+    argLs <- c(defaultArgF(testDirC, determineL = determineL), argLs)
+    outLs <- wrapperCallF(argLs, allLoessL = allLoessL)
+
+    checkEqualsNumeric(outLs[['sumDF']]["M59T62", "batch.2.linear"], 3, tolerance = 1e-3)
+
+
+}