tests/testthat/test-performNormalization.R

# test script for performNormalization.R - testcases are NOT comprehensive!

test_that("performNormalization works", {
  
  seuratObj <- getdata("performPCA", "pbmc_hallmarks")
  GS.hallmark <- getdata("performNormalization", "GS.Hallmark")
  
  
  seuratObj.p <- performNormalization(seuratObj, 
                                      assay = "escape.ssGSEA", 
                                      gene.sets = GS.hallmark,
                                      make.positive = TRUE)
  seuratObj.pg <- performNormalization(seuratObj, 
                                      assay = "escape.ssGSEA", 
                                      gene.sets = GS.hallmark,
                                      make.positive = TRUE, groups=20)
  
  expect_equal(seuratObj.p@assays$escape.ssGSEA, 
               seuratObj.pg@assays$escape.ssGSEA)
  
  seuratObj.n <- performNormalization(seuratObj, 
                                      assay = "escape.ssGSEA", 
                                      gene.sets = GS.hallmark,
                                      make.positive = FALSE)
  seuratObj.ng <- performNormalization(seuratObj, 
                                      assay = "escape.ssGSEA", 
                                      gene.sets = GS.hallmark,
                                      make.positive = FALSE, groups=20)
  
  expect_equal(seuratObj.n@assays$escape.ssGSEA, 
               getdata("performNormalization", "performNormalization_nonpositive"))
  expect_equal(seuratObj.n@assays$escape.ssGSEA, 
               seuratObj.ng@assays$escape.ssGSEA)
  
})
ncborcherding/escape documentation built on Sept. 23, 2024, 10:01 p.m.