sliding.quantile {Ringo} | R Documentation |
This functions is used to slide a window of specified size over scores at given positions. Computed is the quantile over the scores in the window.
sliding.quantile(positions, scores, half.width, prob = 0.5, return.counts = TRUE)
positions |
numeric; sorted vector of (genomic) positions of scores |
scores |
numeric; scores to be smoothed associated to the
positions |
half.width |
numeric, half the window size of the sliding window |
prob |
numeric specifying which quantile is to be computed over the scores in the window; default 0.5 means compute the median over the scores. |
return.counts |
logical; should the number of points, e.g. probes, that were used for computing the median in each sliding window also returned? |
This function is meant as a more general alternative to the
sliding.median
function. In most, but not in all, situations,
we found it to outperform sliding.median
.
Matrix with two columns:
quantile |
medians over running window centered at the
positions that were specified in argument positions . |
count |
number of points that were considerd for computing the median at each position |
These positions are given as row.names
of the resulting vector.
If argument return.counts
is FALSE
, only a vector
of the medians is returned, with the positions as names
.
Oleg Sklyar and Joern Toedling
sampleSize <- 1000 ap <- cumsum(1+round(runif(sampleSize)*10)) as <- c(rnorm(floor(sampleSize/3)), rnorm(ceiling(sampleSize/3),mean=1.5), rnorm(floor(sampleSize/3))) arm <- sliding.quantile(ap, as, 20) arq <- sliding.quantile(ap, as, 20, prob=0.25) plot(ap, as, pch=20, xlab="position",ylab="level") points(ap, arm[,1], type="l", col="red", lwd=2) points(ap, arq[,1], type="l", col="green", lwd=2) legend(x="topleft", legend=c("median","1st quartile"), col=c("red","green"), lty=1, lwd=2)