Question: Distribution Of Peaks From Tss-Kernel Density Estimation
0
e.karasmani120 wrote:

Dear All,

Good afternoon. I want to plot the distribution of my ChIP seq peaks from TSS.

So I want to make a picture like that.....

Hence, I tried to use the density function which looks like that....

`````` d <- density(lena\$distance.to.gene)
``````

lena\$distance.to.gene is a column from my data frame which has the distances from the TSS.

Hence, when I am using the density function like i descibed it above it gives me a graph which looks like a gausian distribution.

What i want to change is the resolution of the density of the peaks. For example to have them every 100bp or every 200 bp.

However from the manual `?density` it is not clear to me which option should I use to set this criteria.

Moreover, do you have any other suggestions on how to plot the graph that i want to make?

best regards Lena

R chip-seq chipseq • 2.2k views
modified 6.9 years ago by Michael Dondrup47k • written 6.9 years ago by e.karasmani120
1
Michael Dondrup47k wrote:

Not totally sure what you mean with:

What i want to change is the resolution of the density of the peaks. For example to have them every 100bp or every 200 bp.

If you mean the resolution of the peak detection, e.g. trying to detect two peaks with 100bp distance as two separate peaks instead of one, you have to change parameters in the peak finding.

If you are referring to the "resolution" of the density estimate, then you should look at the `bw` parameter:

bw the smoothing bandwidth to be used. The kernels are scaled such that this is the standard deviation of the smoothing kernel.

Larger values will give a 'smoother' result, and lower values more 'wobbly' density estimates. Compare these two plots:

``````plot(density(rpois(100,10),bw=0.1))
plot(density(rpois(100,10),bw=10))
``````