runmedByCluster {bumphunter} | R Documentation

## Apply running median smoothing to values within each spatially-defined cluster

### Description

Running median smoothing is applied independently to each cluster of genomic locations. Locations within the same cluster are close together to warrant smoothing across neighbouring locations.

### Usage

    runmedByCluster(y, x = NULL, cluster, weights = NULL, k = 5,
                    endrule = "constant", verbose = TRUE)

### Arguments

`y` | A vector or matrix of values to be smoothed. If a matrix, each column represents a sample.
`x` | The genomic location of the values in y.
`cluster` | A vector indicating clusters of locations. A cluster is typically defined as a region that is small enough that it makes sense to smooth across neighbouring locations. Smoothing will only be applied within a cluster, not across locations from different clusters.
`weights` | weights used by the smoother.
`k` | integer width of median window; must be odd. See `runmed`
`endrule` | character string indicating how the values at the beginning and the end (of the data) should be treated. See `runmed`.
`verbose` | Boolean. Should progress be reported?

### Details

This function is typically called by `smoother`, which is in turn called by `bumphunter`.

### Value

`fitted` | The smoothed data values
`smoothed` | A boolean vector indicating whether a given position was smoothed
`spans` | The span used by the loess smoother. One per cluster.
`clusterL` | The number of locations in each cluster.
`smoother` | always set to ‘runmed’.

### Author(s)

Rafael A. Irizarry

### See Also

`smoother`, `loessByCluster`. Also see `runmed`.

### Examples

    dat <- dummyData()
    smoothed <- runmedByCluster(y=dat$mat[,1], cluster=dat$cluster,
                                k=5, endrule="constant")

[Package bumphunter version 1.30.0 Index]