wwhm {csaw} | R Documentation

## Window width at half maximum

### Description

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

### Usage

    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

    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)

[Package csaw version 1.21.4 Index]