This is a test version of Biostars. For the public version, visit https://www.biostars.org.
plot a smoth TSS profile in R

Hi everybody! I've plot a TSS profile using deepTool as:

computeMatrix reference-point --referencePoint TSS --beforeRegionStartLength 500 --afterRegionStartLength 2000 -R tss -S sample1 sample2 sample3 -bl DACblacklist.bed.gz --skipZeros -o matrix_TSS.gz

plotProfile --matrixFile matrix_TSS.gz --outFileSortedRegions sort --averageType mean --yAxisLabel Mean_Coverage --perGroup --outFileName TSS_scale_profile

The plot is prety good, but I want to processing and smoothing it in R. My problem is that I don't know the colnames that deepTools uses for plot it, and I don't know what is the best way to load and edit the peaks.

Any suggestion please?

Best

chip-seq r

1 answer

You presumably want to process the final results that plotProfile is plotting, in which case add the --outFileNameData something.tsv option and load that into R (set colnames=F when you load the data, since columns are bins, rows are samples or groups). You can then reprocess and replot things as desired.

Thank you very much Devon. I don't know how to reprocess it, because I have 5 rows (bin labels, bins and one row per sample). I'm not very familiarised with this format, could you please give me an extensive example of the script? Thank you!

I'd probably do something like the following in R:

d = read.delim("something.tsv", header=F, skip=2)
d2 = as.data.frame(t(as.matrix(d[,-c(1,2)])))
colnames(d2) = d[,1]
d2$sample = rep(c("sample1", "sample2", "sample3"), each=250)
d2$bin = rep(c(1:250), 250)

Then you have a dataframe with the columns denoting each group and bins and samples labeled. You can further tidy this if you prefer. Note that I'm just typing the above by eye, so there's probably a typo or two.

Thank you, I've plotted the samples and bins, and the plot is exactly the same as that one reported in deepTools. I've also smoothed it in R, but there a huge difference between them, and I think that I'm missing information. Do you know if is there another approach for a slight smooth method?

Thank you

You might play around with a local regression method, like loess, where you can change the bandwidth.

Log in to answer this question.