R/overlapResultsList.R

Defines functions overlapResultsList

Documented in overlapResultsList

#' @export
#' @importFrom S4Vectors DataFrame metadata<-
#' @importFrom IRanges findOverlaps
overlapResultsList <- function(ranges.list, tab.list, regions, equiweight=TRUE, get.best=TRUE, 
    overlap.args=list(), combine.args=list(), best.args=list()) 
{
    .verify_ranges_tabs(ranges.list, tab.list)
    olap.out <- do.call(findOverlapsList, c(list(ranges.list, regions), overlap.args))
    tab <- do.call(rbind, tab.list)

    combine.args$overlaps <- best.args$overlaps <- olap.out$overlaps
    combine.args$tab <- best.args$tab <- tab
    if (equiweight) {
        combine.args$o.weights <- best.args$o.weights <- olap.out$weights
    }

    combined <- do.call(combineOverlaps, combine.args)
    output <- DataFrame(regions=I(regions), combined=I(combined))
    if (get.best) {
        output$best <- do.call(getBestOverlaps, best.args)
    }

    metadata(output) <- olap.out
    metadata(output)$tab <- tab
    output
}

Try the csaw package in your browser

Any scripts or data that you put into this service are public.

csaw documentation built on Nov. 12, 2020, 2:03 a.m.