tests/testthat/test_strands.r

x <- tibble::tribble(
  ~chrom, ~start, ~end, ~strand,
  "chr1", 1, 100, "+",
  "chr2", 1, 100, "-"
)

test_that("strands are flipped", {
  res <- flip_strands(x)
  expect_equal(res$strand, c("-", "+"))
})

y <- tibble::tribble(
  ~chrom, ~start, ~end,
  "chr1", 1, 100,
  "chr2", 1, 100
)

test_that("unstranded tbls throw an error", {
  expect_error(flip_strands(y))
})

Try the valr package in your browser

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

valr documentation built on Sept. 19, 2023, 1:07 a.m.