tests/testthat/test-as.data.frame.GRanges.R

context("as.data.frame.GRanges")

test_that("test util function .as.data.frame.GRanges", {
    gr <- GRanges("chr1", IRanges(1:4, 5:8))
    gr$tooltip <- as.data.frame(gr)
    df <- .as.data.frame.GRanges(gr)
    
    expect_identical(class(df), "data.frame")
    expect_identical(colnames(df), c("seqnames", "start", "end", "width", "strand", "tooltip"))
    expect_identical(class(df$tooltip), c("AsIs", "data.frame"))
    expect_identical(colnames(df$tooltip), c("seqnames", "start", "end", "width", "strand"))
})

Try the TnT package in your browser

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

TnT documentation built on Nov. 8, 2020, 8:11 p.m.