wiggle_smooth: Sliding window smooth of wiggle data

Description Usage Arguments Value Examples

Description

This function allows you to smooth wiggle data using a sliding window.

Usage

1
wiggle_smooth(wiggleData, chrNumber, bandwidth = 200, useKsmooth = FALSE)

Arguments

wiggleData

Accepts input in one of the following formats:

  1. An R list of the 16 chromosome wiggle data (output of readall_tab()).

  2. An element of an R list of the form described in the first item above. Can be extracted with either '[]' or '[[]]'.

  3. An R data frame in the same format as the individual chromosome data frames composing the list described in the first item above.

No default.

chrNumber

An integer representing the chromosome to smooth. Will be ignored in case the provided wiggleData is not a list of data for the 16 chromosomes. No default.

bandwidth

An integer representing the length of the smoothing window in bp (or the Gaussian kernel bandwith, if useKsmooth = TRUE). Defaults to 200.

useKsmooth

Boolean indicating choice of smoothing function:

  1. useKsmooth = FALSE: use a simple sliding window smoother. Smoothing is performed by sliding a window of the specified size (bandwidth argument) over all genomic positions in the data and replacing the position values by the middle position and the signal values by their mean.

  2. useKsmooth = TRUE: use a Gaussian Kernel Regression Smoother. Smoothing is performed using function ksmooth() from 'stats' package using the default normal kernel and the specified bandwith.

Defaults to FALSE.

Value

An R data frame with two columns: genome position and smoothed signal.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
## Not run: 
wiggle_smooth(WT, 1, 200)

wiggle_smooth(rec8, 16, 100)

wiggle_smooth(WT[[5]], bandwidth = 1000)

wiggle_smooth(WT[[9]], bandwidth = 1000, useKsmooth = T)

## End(Not run)

luisvalesilva/hwglabr documentation built on May 21, 2019, 8:56 a.m.