LTLA / csaw

Clone of the Bioconductor repository for the csaw package.

Home Page:https://bioconductor.org/packages/devel/bioc/html/csaw.html

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

plotMD in Csaw

EllieDuan opened this issue · comments

Hello Aaron,
I followed your tutorial for window-based DB analysis:
https://bioconductor.org/packages/release/workflows/vignettes/chipseqDB/inst/doc/cbp.html
I can plot the mean-difference plot using plotMD for the non-merged bins (10bp) to show the up- down- DB, it shows too many dots, so I want to plot the merged-windows data since this is the final DB output I used, but I don't know how. Could you give some suggestions?

Thank you!

contrast <- makeContrasts(wt-ko, levels=design)
res <- glmQLFTest(fit, contrast=contrast)
plotMD(res) # this works

merged <- mergeWindows(rowRanges(filtered.data), tol=100, max.width=5000)
tabcom <- combineTests(merged$id, res$table)
is.sig <- tabcom$FDR <= 0.05
summary(is.sig)
table(tabcom$direction[is.sig])
tabbest <- getBestTest(merged$id, res$table)
is.sig.pos <- (tabbest$logFC > 0)[is.sig]
summary(is.sig.pos)

This requires you to make a decision, because when you have regions created by merging windows, there are multiple ways you can summarize window-level statistics into one value per region. The simplest way would be to use the abundance and log-fold change of the best test in each region, i.e.:

plot(res$table$logCPM[tabbest$best], res$table$logFC[tabbest$best])

This is easy and the most directly relevant to the window-level statistics that you actually used.

Another approach might be to re-count reads across the merged regions and then compute the log-fold change and abundance from those counts. But this might be misleading as the significance statistics are computed from a different perspective from what you're showing. For example, if only a part of an enriched region is DB, the reported log-fold change would be near zero for the entire region.

This works great! Thank you for your guidance!