#Load dataset
data(nucleosome_htseq)
data = as.vector(coverage.rpm(nucleosome_htseq)[[1]])
#Get recommended pcKeepComp value
pckeepcomp = pcKeepCompDetect(data, cor.target=0.99)
print(pckeepcomp)
#call filterFFT
f1 = filterFFT(data, pcKeepComp=pckeepcomp)
#Also this can be called directly
f2 = filterFFT(data, pcKeepComp="auto", cor.target=0.99)
#Plot
plot(data[1:2000], col="black", type="l", lwd=2)
lines(f1[1:2000], col="red", lwd=2)
lines(f2[1:2000], col="blue", lwd=2, lty=2)
legend("bottom", c("original", "two calls", "one call"), col=c("black", "red", "blue"), lty=c(1,1,2), horiz=TRUE, bty="n")
Run the code above in your browser using DataLab