Learn R Programming

bPeaks (version 1.2)

dataSmoothing: Function to smooth sequencing coverage along a chromosome

Description

This function allows to obtain a smoothed signal of the genome-wide read depth. Simple moving average (SMA) procedure is used. At each genomic position, the sequencing coverage is replaced by the unweighted mean of the n surrounding positions (n/2 before and n/2 after).

Usage

dataSmoothing(vecData, widthValue = 20)

Arguments

vecData
A vector with the numbers of sequences aligned at each genomic position to be considered in the analysis
widthValue
The number (n/2) of surrounding positions to use for mean calculation

Value

A vector with the smoothed signal. Note that the SMA procedure creates missing values at the beginning and at the end of the vector with the smoothed signal.

Details

Detailed information and tutorials can be found online http://bpeaks.gene-networks.net/.

References

http://bpeaks.gene-networks.net/

See Also

bPeaksAnalysis baseLineCalc

Examples

Run this code
# get data
data(dataPDR1)

# inital IP signal
iniIPsignal = dataPDR1$IPdata[,3]

par(mfrow = c(2,2))

# plot initial IP signal
plot(iniIPsignal[416900:417400], type = "h", 
    xlab = "genomic position", ylab = "sequencing coverage",
    main = "IP sample (PDR1 data)\nno smoothing", 
    col = "red")

# calculate and plot smoothed signal (widthValue = 5)
smoothedIPsignal = dataSmoothing(vecData = iniIPsignal, widthValue = 5)
plot(smoothedIPsignal[416900:417400], type = "h", 
    xlab = "genomic position", ylab = "sequencing coverage",
    main = "IP sample (PDR1 data)\nsmoothing (widthValue = 5)", 
    col = "pink")

# calculate and plot smoothed signal (widthValue = 10)
smoothedIPsignal = dataSmoothing(vecData = iniIPsignal, widthValue = 10)
plot(smoothedIPsignal[416900:417400], type = "h", 
    xlab = "genomic position", ylab = "sequencing coverage",
    main = "IP sample (PDR1 data)\nsmoothing (widthValue = 10)", 
    col = "pink")

# calculate and plot smoothed signal (widthValue = 20)
smoothedIPsignal = dataSmoothing(vecData = iniIPsignal, widthValue = 20)
plot(smoothedIPsignal[416900:417400], type = "h", 
    xlab = "genomic position", ylab = "sequencing coverage",
    main = "IP sample (PDR1 data)\nsmoothing (widthValue = 20)", 
    col = "pink")

Run the code above in your browser using DataLab