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))
})
jayhesselberth/valr documentation built on April 8, 2024, 12:32 p.m.