Mercurial > repos > ethevenot > checkformat
diff runit/checkformat_tests.R @ 3:80a38d36f946 draft
planemo upload for repository https://github.com/workflow4metabolomics/checkformat.git commit 5cf3f6eb62c1396ade1b068a3dd3cc2e3f827e15
author | ethevenot |
---|---|
date | Thu, 11 Jan 2018 10:24:56 -0500 |
parents | e194eec8e70c |
children |
line wrap: on
line diff
--- a/runit/checkformat_tests.R Tue Jun 06 11:51:33 2017 -0400 +++ b/runit/checkformat_tests.R Thu Jan 11 10:24:56 2018 -0500 @@ -1,11 +1,95 @@ test_input_default <- function() { testDirC <- "input" - argLs <- list() + argLs <- list(makeNameL = FALSE) + + argLs <- c(defaultArgF(testDirC), argLs) + outLs <- wrapperCallF(argLs) + + checkEquals(outLs[['infVc']][4], 'The input tables have a correct format and can be used for your analyses.') + +} + +test_datSamInv <- function() { + + ## first two samples inverted in dataMatrix + + testDirC <- "datSamInv" + argLs <- list(makeNameL = FALSE) + + argLs <- c(defaultArgF(testDirC), argLs) + outLs <- wrapperCallF(argLs) + + checkEquals(outLs[['infVc']][7], 'Warning: The sample and/or variable names or orders from the input tables have been modified') + +} + +test_datSamFls <- function() { + + ## first sample name in dataMatrix is 17, and in sampleMetadata is X17 + + ## also used in test-data + + testDirC <- "datSamFls" + argLs <- list(makeNameL = TRUE) argLs <- c(defaultArgF(testDirC), argLs) outLs <- wrapperCallF(argLs) - checkEquals(outLs[['infVc']][4], 'Table formats are OK; enjoy your analyses!') + checkEquals(outLs[['infVc']][5], 'Message: Converting sample and variable names to the standard R format') + + checkEquals(outLs[['infVc']][7], 'Warning: The sample and/or variable names or orders from the input tables have been modified') + + checkEquals(rownames(outLs[['datMN']])[1], 'X17') + +} + +test_datSamFlsInv <- function() { + + ## first sample name in dataMatrix is X17, and in sampleMetadata is 17 + + testDirC <- "datSamFlsInv" + argLs <- list(makeNameL = TRUE) + + argLs <- c(defaultArgF(testDirC), argLs) + outLs <- wrapperCallF(argLs) + + checkEquals(outLs[['infVc']][5], 'Message: Converting sample and variable names to the standard R format') + + checkEquals(outLs[['infVc']][7], 'Warning: The sample and/or variable names or orders from the input tables have been modified') + + checkEquals(rownames(outLs[['samDF']])[1], 'X17') } + +test_datVarInv <- function() { + + ## first two variables inverted in variableMetadata + + testDirC <- "datVarInv" + argLs <- list(makeNameL = FALSE) + + argLs <- c(defaultArgF(testDirC), argLs) + outLs <- wrapperCallF(argLs) + + checkEquals(outLs[['infVc']][7], 'Warning: The sample and/or variable names or orders from the input tables have been modified') + +} + +test_datVarFls <- function() { + + ## second variable name in dataMatrix is 3072, and in variableMetadata is X3072 + + testDirC <- "datVarFls" + argLs <- list(makeNameL = TRUE) + + argLs <- c(defaultArgF(testDirC), argLs) + outLs <- wrapperCallF(argLs) + + checkEquals(outLs[['infVc']][5], 'Message: Converting sample and variable names to the standard R format') + + checkEquals(outLs[['infVc']][7], 'Warning: The sample and/or variable names or orders from the input tables have been modified') + + checkEquals(colnames(outLs[['datMN']])[2], 'X3072') + +}