Browse code

Bugfix for test for the time being.

LTLA authored on 07/03/2021 03:36:05
Showing 1 changed files

... ...
@@ -1,6 +1,8 @@
1 1
 # This tests the various quickCorrect functions.
2 2
 # library(testthat); library(batchelor); source("test-quick-correct.R")
3 3
 
4
+library(dqrng) # see https://github.com/daqana/dqrng/issues/43.
5
+
4 6
 set.seed(100)
5 7
 d1 <- matrix(rnbinom(50000, mu=10, size=1), ncol=100)
6 8
 sce1 <- SingleCellExperiment(list(counts=d1))
... ...
@@ -12,19 +14,20 @@ sce2 <- SingleCellExperiment(list(counts=d2))
12 14
 sizeFactors(sce2) <- runif(ncol(d2))
13 15
 rownames(sce2) <- paste0("GENE", 201:700)
14 16
 
17
+universe <- intersect(rownames(sce1), rownames(sce2))
18
+
15 19
 set.seed(1000)
16 20
 output <- quickCorrect(sce1, sce2)
17
-universe <- intersect(rownames(sce1), rownames(sce2))
18 21
 
19 22
 test_that("quickCorrect works as expected", {
20 23
     expect_identical(rownames(output$corrected), universe)
21 24
 
22 25
     # Same results.
26
+    set.seed(1000)
23 27
     normed <- multiBatchNorm(sce1[universe,], sce2[universe,])
24 28
     dec1 <- scran::modelGeneVar(normed[[1]])
25 29
     dec2 <- scran::modelGeneVar(normed[[2]])
26 30
 
27
-    set.seed(1000)
28 31
     pre <- quickCorrect(sce1, sce2, precomputed=list(dec1, dec2))
29 32
     expect_equal(reducedDim(output$corrected), reducedDim(pre$corrected))
30 33