diff --git a/DESCRIPTION b/DESCRIPTION index 69239f9..592e7c6 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -2,7 +2,7 @@ Package: NanoStringNorm Type: Package Title: Normalize NanoString miRNA and mRNA Data Version: 3.0.0 -Date: 2025-01-15 +Date: 2025-01-17 Authors@R: c( person(c("Daryl", "M."), "Waggott", role = "aut"), person("Paul", "Boutros", email = "PBoutros@mednet.ucla.edu", role = "cre"), @@ -11,7 +11,10 @@ Depends: R (>= 2.14.0) Imports: methods -Suggests: googleVis (>= 0.2.14), lme4, RUnit (>= 0.4.26) +Suggests: + testthat, + googleVis (>= 0.2.14), + lme4 Description: A set of tools for normalizing, diagnostics and visualization of NanoString nCounter data. License: GPL-2 LazyLoad: yes diff --git a/NEWS.md b/NEWS.md index 1a422a3..94d66ab 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,4 +1,4 @@ -# NanoStringNorm 3.0.0 (2025-01-15) +# NanoStringNorm 3.0.0 (2025-01-17) ## Removed * Removed Excel `.xls` support due to broken CRAN dependency @@ -8,6 +8,7 @@ ## Changed * Update changelog to Markdown format +* Replaced RUnit framework with testthat # NanoStringNorm 2.0.0 (2023-03-21) diff --git a/R/read.csv.RCC.R b/R/read.csv.RCC.R index 7128a5c..92d455d 100644 --- a/R/read.csv.RCC.R +++ b/R/read.csv.RCC.R @@ -64,6 +64,7 @@ read.csv.RCC <- function(path, sample.id.row = 'File.Name') { colnames(rcc$x) <- gsub(' ', '.', colnames(rcc$x)); colnames(rcc$x) <- c(colnames(rcc$x)[1:3], sample.ids); + rcc$x[, sample.ids] <- lapply(rcc$x[, sample.ids], as.numeric); cat(paste('There were', length(sample.ids), 'samples imported. \nNote that spaces in sample names will be replaced by dots. \n')); diff --git a/R/unit.testing.NanoStringNorm.R b/R/unit.testing.NanoStringNorm.R deleted file mode 100644 index cae69b9..0000000 --- a/R/unit.testing.NanoStringNorm.R +++ /dev/null @@ -1,38 +0,0 @@ -# The NanoStringNorm package is copyright (c) 2011 Ontario Institute for Cancer Research (OICR) -# This package and its accompanying libraries is free software; you can redistribute it and/or modify it under the terms of the GPL -# (either version 1, or at your option, any later version) or the Artistic License 2.0. Refer to LICENSE for the full license text. -# OICR makes no representations whatsoever as to the SOFTWARE contained herein. It is experimental in nature and is provided WITHOUT -# WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE OR ANY OTHER WARRANTY, EXPRESS OR IMPLIED. OICR MAKES NO REPRESENTATION -# OR WARRANTY THAT THE USE OF THIS SOFTWARE WILL NOT INFRINGE ANY PATENT OR OTHER PROPRIETARY RIGHT. -# By downloading this SOFTWARE, your Institution hereby indemnifies OICR against any loss, claim, damage or liability, of whatsoever kind or -# nature, which may arise from your Institution's respective use, handling or storage of the SOFTWARE. -# If publications result from research using this SOFTWARE, we ask that the Ontario Institute for Cancer Research be acknowledged and/or -# credit be given to OICR scientists, as scientifically appropriate. - -.test <- function(dir, pattern = "^test_.*\\.R$") { - - requireNamespace("RUnit"); - package.name <- "NanoStringNorm"; - - print( - paste( - ".test: ", - system.file("unitTests", package = package.name), - sep = "" - ) - ); - - suite <- RUnit::defineTestSuite( - name = paste(package.name, "RUnit Tests", sep = " "), - dirs = system.file("unitTests", package = package.name), - testFileRegexp = pattern, - rngKind = "default", - rngNormalKind = "default" - ); - - result <- RUnit::runTestSuite(suite); - - RUnit::printTextProtocol(result, showDetails=TRUE); - - return(result); - } diff --git a/tests/NanoStringNorm.unitTests.R b/tests/NanoStringNorm.unitTests.R deleted file mode 100644 index 485285c..0000000 --- a/tests/NanoStringNorm.unitTests.R +++ /dev/null @@ -1,15 +0,0 @@ -# The NanoStringNorm package is copyright (c) 2011 Ontario Institute for Cancer Research (OICR) -# This package and its accompanying libraries is free software; you can redistribute it and/or modify it under the terms of the GPL -# (either version 1, or at your option, any later version) or the Artistic License 2.0. Refer to LICENSE for the full license text. -# OICR makes no representations whatsoever as to the SOFTWARE contained herein. It is experimental in nature and is provided WITHOUT -# WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE OR ANY OTHER WARRANTY, EXPRESS OR IMPLIED. OICR MAKES NO REPRESENTATION -# OR WARRANTY THAT THE USE OF THIS SOFTWARE WILL NOT INFRINGE ANY PATENT OR OTHER PROPRIETARY RIGHT. -# By downloading this SOFTWARE, your Institution hereby indemnifies OICR against any loss, claim, damage or liability, of whatsoever kind or -# nature, which may arise from your Institution's respective use, handling or storage of the SOFTWARE. -# If publications result from research using this SOFTWARE, we ask that the Ontario Institute for Cancer Research be acknowledged and/or -# credit be given to OICR scientists, as scientifically appropriate. - -require("NanoStringNorm") || stop("unable to load NanoStringNorm package") -if (require(RUnit)) { - NanoStringNorm:::.test() - } diff --git a/tests/testthat.R b/tests/testthat.R new file mode 100644 index 0000000..8431f9a --- /dev/null +++ b/tests/testthat.R @@ -0,0 +1,4 @@ +library(testthat); +library(NanoStringNorm); + +test_check('NanoStringNorm'); diff --git a/tests/testthat/data/load.rcc.Rda b/tests/testthat/data/load.rcc.Rda new file mode 100644 index 0000000..1cf6c38 Binary files /dev/null and b/tests/testthat/data/load.rcc.Rda differ diff --git a/tests/testthat/test-load.rcc.R b/tests/testthat/test-load.rcc.R new file mode 100644 index 0000000..2593a56 --- /dev/null +++ b/tests/testthat/test-load.rcc.R @@ -0,0 +1,29 @@ +test_that( + 'read.csv.RCC header loads correctly', { + load('data/load.rcc.Rda'); + + path <- system.file( + 'extdata', + 'RCC_files', + 'RCCCollector1_rat_tcdd.csv', + package = 'NanoStringNorm' + ); + result <- read.csv.RCC(path); + expect_equivalent(result$header, csv.nanostring.mrna.result$header); + } + ); + +test_that( + 'read.csv.RCC counts load correctly', { + load('data/load.rcc.Rda'); + + path <- system.file( + 'extdata', + 'RCC_files', + 'RCCCollector1_rat_tcdd.csv', + package = 'NanoStringNorm' + ); + result <- read.csv.RCC(path); + expect_equivalent(result$x, csv.nanostring.mrna.result$x, ); + } +); \ No newline at end of file