wwhm: Window width at half maximum

Description Usage Arguments Details Value Author(s) See Also Examples

View source: R/profileSites.R

Description

Get the width of the window from the half-maximum of the coverage profile.

Usage

1
wwhm(profile, regions, ext=100, proportion=0.5, rlen=NULL)

Arguments

profile

a numeric vector containing a coverage profile, as produced by profileSites

regions

the GRanges object with which the profile was constructed

ext

an integer scalar specifying the average fragment length for single-end data

proportion

a numeric scalar specifying the proportion of the maximum coverage at which to compute the window width

rlen

a numeric scalar or vector containing read lengths, if any ext=NA, i.e., fragments are unextended reads

Details

This function computes the ideal window size, based on the width of the peak in the coverage profile at the specified proportion of the maximum. Obviously, the values of regions and ext should be the same as those used in profileSites (set ext to the median fragment length for paired-end data). The regions should contain windows of a constant size.

Some subtleties are involved in obtaining the window width. First, twice the average fragment length must be subtracted from the peak width, as the profile is constructed from (inferred) fragments. The size of the viewpoints in regions must also be subtracted, to account for the inflated peak width when spatial resolution is lost after aggregation across many windows.

Value

An integer scalar is returned, specifying the ideal window width.

Author(s)

Aaron Lun

See Also

profileSites, getWidths

Examples

1
2
3
4
5
6
7
8
9
x <- dnorm(-200:200/100) # Mocking up a profile.
windows <- GRanges("chrA", IRanges(1, 50)) # Making up some windows.

wwhm(x, windows)
wwhm(x, windows, ext=50)
wwhm(x, windows, proportion=0.2)

# Need to set 'rlen' if ext=NA.
wwhm(x, windows, ext=NA, rlen=10)

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