tests/testthat/test_fisher.r

x <- tibble::tribble(
  ~chrom , ~start , ~end ,
  "chr1" ,     10 ,   20 ,
  "chr1" ,     30 ,   40 ,
  "chr1" ,     51 ,   52
)

y <- tibble::tribble(
  ~chrom , ~start , ~end ,
  "chr1" ,     15 ,   25 ,
  "chr1" ,     51 ,   52
)

genome <- tibble::tribble(
  ~chrom , ~size ,
  "chr1" ,   500
)

test_that("fisher p.value is correct", {
  res <- bed_fisher(x, y, genome)
  expect_equal(round(res$p.value, 5), 0.00385)
})

Try the valr package in your browser

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

valr documentation built on Dec. 10, 2025, 9:08 a.m.