tests/testthat/test_windows_itemselect.R

test_that("itemselect works as expected on the number of selected probes",
  {
    skip_on_cran()
    skip_on_os(c("mac", "linux", "solaris"))
    
    datafilename <- system.file("extdata", "transcripto_sample.txt", package="DRomics")
    (o <- microarraydata(datafilename, check = TRUE, norm.method = "cyclicloess"))
    (s_quad0p001 <- itemselect(o, select.method = "quadratic", FDR = 0.001))
    expect_equal(length(s_quad0p001$selectindex), 78)
    (s_quad0p05 <- itemselect(o, select.method = "quadratic", FDR = 0.05))
    expect_equal(length(s_quad0p05$selectindex), 318)
    (s_lin0p001 <- itemselect(o, select.method = "linear", FDR = 0.001))
    expect_equal(length(s_lin0p001$selectindex), 14)
    (s_lin0p05 <- itemselect(o, select.method = "linear", FDR = 0.05))
    expect_equal(length(s_lin0p05$selectindex), 90)
    (s_ANOVA0p001 <- itemselect(o, select.method = "ANOVA", FDR = 0.001))
    expect_equal(length(s_ANOVA0p001$selectindex), 55)
    (s_ANOVA0p05 <- itemselect(o, select.method = "ANOVA", FDR = 0.05))
    expect_equal(length(s_ANOVA0p05$selectindex), 203)
    datafilename.m <- system.file("extdata", "metabolo_sample.txt", package="DRomics")
    o.m <- continuousomicdata(datafilename.m, check = TRUE)
    (s_quad0p05.m <- itemselect(o.m, select.method = "quadratic", FDR = 0.05))
    expect_equal(length(s_quad0p05.m$selectindex), 36)
    (s_quad0p05.mb <- itemselect(o.m, select.method = "quadratic", FDR = 0.05,
                                max.ties.prop = 0.5))
    expect_equal(length(s_quad0p05.mb$selectindex), 40)
    datafilename.r <- system.file("extdata", "RNAseq_sample.txt", package="DRomics")
    (o.r <- RNAseqdata(datafilename.r, check = TRUE, transfo.method = "rlog"))
    (s_quad.r <- itemselect(o.r, select.method = "quadratic", FDR = 0.05))
    expect_equal(length(s_quad.r$selectindex), 43)
    
  })

Try the DRomics package in your browser

Any scripts or data that you put into this service are public.

DRomics documentation built on Oct. 16, 2024, 5:09 p.m.