tests/testthat/test_GDSFile-class.R

test_that("GDSFile constructor works", {
    file <- SeqArray::seqExampleFileName("gds")
    gf <- GDSFile(file)
    expect_s4_class(gf, "GDSFile")
    expect_true(validObject(gf))
    
})

test_that("gdsfile getter and setter works", {
    file <- SeqArray::seqExampleFileName("gds")
    gf <- GDSFile(file)
    expect_equal(gdsfile(gf), file)
    
    file1 <- SNPRelate::snpgdsExampleFileName()
    gdsfile(gf) <- file1
    expect_true(validObject(gf))
})

test_that("$ completion works", {
    file <- SeqArray::seqExampleFileName("gds")
    gf <- GDSFile(file)
    .DollarNames.GDSFile <- GDSArray:::.DollarNames.GDSFile
    expect_true("annotation" %in% .DollarNames.GDSFile(gf, "anno"))
    expect_true("info" %in% .DollarNames.GDSFile(gf$annotation, "in"))
})

test_that("$ works", {
    file <- SeqArray::seqExampleFileName("gds")
    gf <- GDSFile(file)
    expect_true(validObject(gf$sample.id))
    expect_s4_class(gf$annotation, "GDSFile")
    expect_s4_class(gf$annotation$info$AC, "GDSArray")
})

test_that("gdsnodes works", {
    file <- SeqArray::seqExampleFileName("gds")
    gf <- GDSFile(file)
    expect_true(all(gdsnodes(gf) %in% gdsnodes(file)))
})

Try the GDSArray package in your browser

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

GDSArray documentation built on April 2, 2021, 6 p.m.