Description Usage Arguments Value Examples
Apply a function to summarise data from multiple metadata columns of GRanges in gr2 that fall within GRanges provided by gr1
1 | applyGRonGR(gr1, gr2, applyTo, fun, ...)
|
gr1 |
A GenomicRanges object with windows of interest |
gr2 |
A GenomicRanges object with data of interest |
applyTo |
Vector with names of columns in gr2 on which to apply the function |
fun |
Function to apply (e.g. sum, mean, paste0) |
GRanges from gr1 with summed values of metadata columns from gr2
1 2 3 4 5 6 7 | # single gr
gr1 <- GenomicRanges::GRanges("chr1", IRanges::IRanges(c(1,3,7), c(5,6,10),names=paste0("win", letters[1:3])), score=4:6)
gr2 <- GenomicRanges::GRanges("chr1", IRanges::IRanges(c(1, 3, 8), c(1, 3, 8),names=paste0("dataID:", letters[1:3])), score=c(10,20,30))
applyGRonGR(gr1,gr2,applyTo="score",fun=sum)
gr1 <- GenomicRanges::GRanges("chr1", IRanges::IRanges(c(1,3,7), c(5,6,10),names=paste0("win", letters[1:3])), score=4:6, other=1:3)
gr2 <- GenomicRanges::GRanges("chr1", IRanges::IRanges(c(1, 3, 8), c(1, 3, 8),names=paste0("dataID:", letters[1:3])), score=c(10,20,30), other=c(100,NA,300))
applyGRonGR(gr1,gr2,c("score","other"),fun=sum,na.rm=T)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.