Skip to content

Instantly share code, notes, and snippets.

@zero323
Last active August 29, 2015 14:10
Show Gist options
  • Save zero323/a380c7347c10414e8b52 to your computer and use it in GitHub Desktop.
Save zero323/a380c7347c10414e8b52 to your computer and use it in GitHub Desktop.
library(GenomicRanges)
gr1 <- GRanges(
"chr1", strand="+",
IRanges(start = c(100, 200), end =c(200, 300))
)
gr2 <- GRanges(
"chr1", strand="+",
IRanges(start = 0, end = 250)
)
# Use 'within' as a type parameter
hits <- findOverlaps(gr1, gr2, type = 'within')
gr1[queryHits(hits)]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment