This is a test version of Biostars. For the public version, visit https://www.biostars.org.
Is there any way to create MA plot with edgeR output?

Dear, everyone,

Is there any way to create MA plot using the output of edgeR? I would like to sign up some DEGs on MA plot.

I have the table of edgeR results as following. Could you take me some advice?

Thank you.

sampleA sampleB logFC   logCPM  PValue  FDR
Ab_DN4787_c0_g1 Control Dry 8.70154251030303    6.48158277911193    8.71808885189159e-95    1.89827666661087e-90
Ab_DN9125_c0_g3 Control Dry -8.57589578562532   6.31161228069997    5.98429714436042e-77    6.51510430106519e-73
Ab_DN4518_c0_g2 Control Dry -3.88026889665754   8.60164700593824    1.12539800319035e-68    8.16813870715555e-65
Ab_DN11435_c0_g1    Control Dry 13.8024924704861    6.56614711142173    2.59956020581222e-64    1.41507059803388e-60
edger plot ggplot2 ma r

1 answer

Normally you make an MA plot (aka mean-difference plot) directly from the fitted object. Here is an example

res <- glmQLFTest(fit, contrast=B.LvsP)
is.de <- decideTestsDGE(res)
plotMD(res, status=is.de)

that I have taken from the edgeR workflow paper: https://www.bioconductor.org/packages/devel/workflows/vignettes/RnaSeqGeneEdgeRQL/inst/doc/edgeRQL.html

If all you have is a data.frame of edgeR topTags results (call it tab), then you simply plot logFC vs logCPM. For example:

plot(tab$logCPM, tab$logFC, xlab="Average log CPM", ylab="log-fold-change", pch=16, cex=0.4)

Thank you fo your advice. But very sorry I don't know "tab", so I got an error message "object 'tab' not found". Could you tell me more about it?

In your question you showed the first 4 rows of a data.frame (which you did not show the name of). It is that data.frame.

Thank you very much! I have created the MAplot by following the steps below.

> res <- read.table("input", sep="\t", header=T, quote = "\"", fill = T)
> A <- res$logCPM
> M <- res$logFC
> plot(A, M, xlab="Average log CPM", ylab="log-fold-change", pch=16, cex=0.4)

Log in to answer this question.