test_that("identifyTSSonChromAndStrand", {
pos <- c(-50, 0, 25, 50, 61, 100)
startIdx <- 1
expect_equal(identifyTSSonChromAndStrand(pos, 30, startIdx), c(1, 2, 2, 2, 2, 3))
expect_equal(identifyTSSonChromAndStrand(pos, 1000, startIdx), c(1, 1, 1, 1, 1, 1))
expect_equal(identifyTSSonChromAndStrand(pos, 12, startIdx), c(1, 2, 3, 4, 4, 5))
})
test_that("identifyTSSs", {
dat <- tibble(seqnames = rep(c("chr1", "chr2"), c(10, 10)),
strand = rep(c("+", "-", "+", "-"), c(5, 5, 5, 5)),
ID5 = rep(c(2, 8, 10, 14, 30), 4)) %>% setDT()
identifyTSSs(dat, 60)
expect_equal(dat$tssId, rep(1:4, each = 5))
identifyTSSs(dat, 5)
ans <- rep(c(0,3,6,9), each = 5) + rep(c(1, 2, 2, 2, 3), 4)
expect_equal(dat$tssId, ans)
})
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.