smoother: Smooth genomic profiles

View source: R/smooth.R

smootherR Documentation

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

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.

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

Author(s)

Rafael A. Irizarry and Martin J. Aryee

See Also

loessByCluster, runmedByCluster

Examples

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()

ririzarr/bumphunter documentation built on March 20, 2024, 8:08 a.m.