# NOT RUN {
gr1 <- data.frame(seqnames = "chr1",
start = c(2,9),
end = c(7,9),
strand = c("+", "-")) %>%
as_granges()
gr2 <- data.frame(seqnames = "chr1", start = 5, width = 5, strand = "-") %>%
as_granges()
union_ranges(gr1, gr2)
union_ranges_directed(gr1, gr2)
intersect_ranges(gr1, gr2)
intersect_ranges_directed(gr1, gr2)
setdiff_ranges(gr1, gr2)
setdiff_ranges_directed(gr1, gr2)
# taking the complement of a ranges requires annotation information
gr1 <- set_genome_info(gr1, seqlengths = 100)
complement_ranges(gr1)
# }
Run the code above in your browser using DataLab