Skip to content

Commit

Permalink
add useNormFilt = FALSE to tests to reflect bugfix
Browse files Browse the repository at this point in the history
  • Loading branch information
Malisa Smith committed Dec 16, 2021
1 parent 5323bb0 commit d54ac0a
Showing 1 changed file with 17 additions and 9 deletions.
26 changes: 17 additions & 9 deletions tests/testthat/test-spillover.R
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,9 @@ controls <- controls[,c(3,1,4,5,2,6,7)]
test_that("spillover: Match columns using regexpr", {
ref_file <- system.file("extdata", "compdata", "compref1", package="flowCore")
comp_ref <- as.matrix(read.table(ref_file, check.names = FALSE))
comp <- spillover(controls, unstained = "UNSTAINED", fsc="FSC-H", ssc="SSC-H", patt = "-H", stain_match="regexpr")
comp <- spillover(controls, unstained = "UNSTAINED", fsc="FSC-H",
ssc="SSC-H", patt = "-H", stain_match="regexpr",
useNormFilt = FALSE)
expect_equal(colnames(comp), colnames(comp_ref))
expect_equal(rownames(comp), rownames(comp_ref))
expect_equivalent(comp, comp_ref, tolerance=3e-08)
Expand All @@ -28,7 +30,9 @@ test_that("spillover: Match columns using ordered", {
comp_ref <- as.matrix(read.table(ref_file, check.names = FALSE))
# The spillover matrix here should (appropriately) be incorrect bc the rows are
# not in the order of the columns.
comp <- spillover(controls, unstained = "UNSTAINED", fsc="FSC-H", ssc="SSC-H", patt = "-H", stain_match="ordered")
comp <- spillover(controls, unstained = "UNSTAINED", fsc="FSC-H",
ssc="SSC-H", patt = "-H", stain_match="ordered",
useNormFilt = FALSE)
expect_equal(colnames(comp), colnames(comp_ref))
expect_equal(rownames(comp), rownames(comp_ref))
expect_equivalent(comp, comp_ref, tolerance=3e-08)
Expand All @@ -37,19 +41,20 @@ test_that("spillover: Match columns using ordered", {
test_that("spillover: Match columns using intensity", {
ref_file <- system.file("extdata", "compdata", "compref1", package="flowCore")
comp_ref <- as.matrix(read.table(ref_file, check.names = FALSE))
comp <- spillover(controls, unstained = "UNSTAINED", fsc="FSC-H", ssc="SSC-H", patt = "-H", stain_match="intensity")
comp <- spillover(controls, unstained = "UNSTAINED", fsc="FSC-H",
ssc="SSC-H", patt = "-H", stain_match="intensity",
useNormFilt = FALSE)
expect_equal(colnames(comp), colnames(comp_ref))
expect_equal(rownames(comp), rownames(comp_ref))
expect_equivalent(comp, comp_ref, tolerance=3e-08)
})


test_that("spillover_match: Using path to dir with files", {
ref_file <- system.file("extdata", "compdata", "compref3", package="flowCore")
comp_ref <- as.matrix(read.table(ref_file, check.names = FALSE))
matched <- spillover_match(path=control_path, fsc="FSC-H", ssc="SSC-H", matchfile = matchfile_path)
comp <- spillover(matched, prematched = TRUE, fsc="FSC-H", ssc="SSC-H", patt = "-H",
useNormFilt = TRUE, method = "mode")
useNormFilt = FALSE, method = "mode")
expect_equal(colnames(comp), colnames(comp_ref))
expect_equal(rownames(comp), rownames(comp_ref))
expect_equivalent(comp, comp_ref, tolerance=3e-08)
Expand All @@ -61,7 +66,7 @@ test_that("spillover_match: Using preconstructed flowSet with filenames as sampl
comp_ref <- as.matrix(read.table(ref_file, check.names = FALSE))
matched <- spillover_match(controls, fsc="FSC-H", ssc="SSC-H", matchfile = matchfile_path)
comp <- spillover(matched, prematched = TRUE, fsc="FSC-H", ssc="SSC-H", patt = "-H",
useNormFilt = TRUE, method = "mode")
useNormFilt = FALSE, method = "mode")
expect_equal(colnames(comp), colnames(comp_ref))
expect_equal(rownames(comp), rownames(comp_ref))
expect_equivalent(comp, comp_ref, tolerance=3e-08)
Expand All @@ -71,7 +76,8 @@ test_that("spillover_ng: Using path to dir with files", {
ref_file <- system.file("extdata", "compdata", "compref4", package="flowCore")
comp_ref <- as.matrix(read.table(ref_file, check.names = FALSE))
comp <- spillover_ng(path=control_path, fsc="FSC-H", ssc="SSC-H",
patt="-H", matchfile = matchfile_path, pregate = FALSE)
patt="-H", matchfile = matchfile_path, pregate = FALSE,
useNormFilt = FALSE)
expect_equal(colnames(comp), colnames(comp_ref))
expect_equal(rownames(comp), rownames(comp_ref))
expect_equivalent(comp, comp_ref, tolerance=3e-08)
Expand All @@ -83,7 +89,8 @@ test_that("spillover_ng: Using preconstructed flowSet with filenames as sample n
comp_ref <- as.matrix(read.table(ref_file, check.names = FALSE))
matched <- spillover_match(controls, fsc="FSC-H", ssc="SSC-H", matchfile = matchfile_path)
comp <- spillover_ng(path=control_path, fsc="FSC-H", ssc="SSC-H",
patt="-H", matchfile = matchfile_path, pregate = FALSE)
patt="-H", matchfile = matchfile_path, pregate = FALSE,
useNormFilt = FALSE)
expect_equal(colnames(comp), colnames(comp_ref))
expect_equal(rownames(comp), rownames(comp_ref))
expect_equivalent(comp, comp_ref, tolerance=3e-08)
Expand All @@ -104,7 +111,8 @@ test_that("spillover_ng: Using preconstructed flowSet with channels in new order
# approach used to re-order rows of the matrix in the spillover function.

comp <- spillover_ng(x=fs, fsc="FSC-H", ssc="SSC-H",
patt="-H", matchfile = matchfile_path, pregate = FALSE)
patt="-H", matchfile = matchfile_path, pregate = FALSE,
useNormFilt = FALSE)
# The diagonals should be equal to 1
for (i in 1:4) {
expect_equal(comp[i,i], 1)
Expand Down

0 comments on commit d54ac0a

Please sign in to comment.