averagePerBin: Find the average values of x in provided bins

View source: R/utils.R

averagePerBinR Documentation

Find the average values of x in provided bins

Description

Uses a method similar to the GenomicRanges tutorial for finding binned averages. Note, this method may not return the same results as averagePerBinBSseqLike().

Usage

averagePerBin(x, bins)

Arguments

x

GRanges with values to find average of

bins

GRanges with bins to average over

Value

matrix

Examples


gr1 <- GRanges(seqnames = "chr2", ranges = IRanges(103, 106), strand = "+", score = 5L, GC = 0.45)
gr2 <- GRanges(
    seqnames = c("chr1", "chr2"),
    ranges = IRanges(c(107, 113), width = 3),
    strand = c("+", "-"),
    score = 3:4, GC = c(0.3, 0.5))
gr3 <- mergeMCols(gr1, gr2)

bins <- GRanges(seqnames=c("chr1","chr2"), ranges=IRanges(c(100, 100), width=15))

averagePerBin(gr3, bins)


huishenlab/bisplotti documentation built on Sept. 20, 2023, 10:13 p.m.