"filterFFT"(data, pcKeepComp="auto", showPowerSpec=FALSE, useOptim=TRUE, mc.cores=1, ...)
"filterFFT"(data, pcKeepComp="auto", showPowerSpec=FALSE, useOptim=TRUE, mc.cores=1, ...)
"filterFFT"(data, pcKeepComp="auto", showPowerSpec=FALSE, useOptim=TRUE, ...)
"filterFFT"(data, pcKeepComp="auto", showPowerSpec=FALSE, useOptim=TRUE, ...)
Rle
or numeric
object) or a list of them.
FALSE
.
data
elements (only useful if data
is a list of elements)
pcKeepCompDetect
function
Other procedures, as the traditional sliding window average, can change too much the shape of the results in function of the size of the window, and moreover they don't only smooth the noise without removing it.
With a Fourier Transform of the original signal, the input signal is descomposed in diferent wavelets and described as a combination of them. Long frequencies can be explained as a function of two ore more periodical shorter frequecies. This is the reason why long, unperiodic sequences are usually identified as noise, and therefore is desireable to remove them from the signal we have to process.
This procedure here is applied to genomic data, providing a novel method to obtain perfectly clean values wich allow an efficient detection of the peaks which can be used for a direct nucleosome position recognition.
This function select a certain number of components in the original power spectrum (the result of the Fast Fourier Transform which can be seen with showPowerSpec=TRUE
) and sets the rest of them to 0 (component knock-out).
The amout of components to keep (given as a percentage of the input lenght) can be set by the pcKeepComp
. This will select the first components of the signal, knock-outing the rest. If this value is close to 1, more components will be selected and then more noise will be allowed in the output. For an effective filtering which removes the noise keeping almost all relevant peaks, a value between 0.01 and 0.05 is usually sufficient. Lower values can cause merging of adjacent minor peaks.
This library also allows the automatic detection of a fitted value for pcKeepComp
. By default, if uses the pcKeepCompDetect
function, which looks which is the minimum percentage of components than can reproduce the original signal with a corelation between the filtered and the original one of 0.99. See the help page of pcKeepCompDetect
for further details and reference of available parameters.
One of the most powerful features of nucleR
is the efficient implementation of the FFT to genomic data. This is achived trought few tweaks that allow an optimum performance of the Fourier Transform. This includes a by-range filtering, an automatic detection of uncovered regions, windowed execution of the filter and padding of the data till nearest power of 2 (this ensures an optimum case for FFT due the high factorization of components). Internal testing showed up that in specific datasets, these optimizations lead to a dramatic improvement of many orders of magnitude (from 3 days to few seconds) while keeping the correlation between the native fft
call and our filterFFT
higher than 0.99. So, the use of these optimizations is highly recomended.
If for some reason you want to apply the function without any kind of optimizations you can specify the parameter useOptim=FALSE
to bypass them and get the pure knockout inverse from native FFT call. All other parameters can be still applyied in this case.
#Load example data, raw hybridization values for Tiling Array
raw_data = get(data(nucleosome_tiling))
#Filter data
fft_data = filterFFT(raw_data, pcKeepComp=0.01)
#See both profiles
par(mfrow=c(2,1), mar=c(3, 4, 1, 1))
plot(raw_data, type="l", xlab="position", ylab="Raw intensities")
plot(fft_data, type="l", xlab="position", ylab="Filtered intensities")
#The power spectrum shows a visual representation of the components
fft_data = filterFFT(raw_data, pcKeepComp=0.01, showPowerSpec=TRUE)
Run the code above in your browser using DataLab