# NOT RUN {
df <- data.frame(seqnames = c("chr1", rep("chr2", 2),
rep("chr3", 3), rep("chr4", 4)),
start = 1:10,
width = 10:1,
strand = c("-", "+", "+", "*", "*", "+", "+", "+", "-", "-"),
name = letters[1:10])
query <- as_granges(df)
df2 <- data.frame(seqnames = c(rep("chr2", 2), rep("chr1", 3), "chr2"),
start = c(4,3,7,13,1,4),
width = c(6,6,3,3,3,9),
strand = c(rep("+", 3), rep("-", 3)))
subject <- as_granges(df2)
filter_by_overlaps(query, subject)
filter_by_non_overlaps(query, subject)
# }
Run the code above in your browser using DataLab