Learn R Programming

bumphunter (version 1.12.0)

smoother: Smooth genomic profiles

Description

Apply smoothing to values typically representing the difference between two populations across genomic regions.

Usage

smoother(y, x = NULL, cluster, weights = NULL, smoothFunction, 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.
smoothFunction
A function to be used for smoothing the estimate of the genomic profile. Two functions are provided by the package: loessByCluster and runmedByCluster.
verbose
Boolean. Should progress be reported?
...
Further arguments to be passed to smoothFunction

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
The name of the smoother used

Details

This function is typically called by bumphunter prior to identifying candidate bump regions. Smoothing is carried out within regions defined by the cluster argument.

See Also

loessByCluster, runmedByCluster

Examples

Run this code
dat <- dummyData()

# Enable parallelization
require(doParallel)
registerDoParallel(cores = 2)

## loessByCluster
smoothed <- smoother(y=dat$mat[,1], cluster=dat$cluster, smoothFunction=loessByCluster, 
                       bpSpan = 1000, minNum=7, minInSpan=5, maxSpan=1)
## runmedByCluster
smoothed <- smoother(y=dat$mat[,1], cluster=dat$cluster, smoothFunction=runmedByCluster, 
                     k=5, endrule="constant")
# cleanup, for Windows
bumphunter:::foreachCleanup()

Run the code above in your browser using DataLab