plotMD invert colors
1
0
Entering edit mode
chodar • 0
@chodar-23083
Last seen 4.7 years ago

Hi all.

I successfully run my scripts to get DEs genes between different libraries, but when I plot the MD graphics, the last coefficient inverts the colors in the plot. The code for graphics is:

par(mfrow=c(2,2),mar=c(2,3,2,3))
for (i in 1:4){
  plotMD(tfit, coef =colnames(tfit)[i], xlab = "Average log-expression",
         ylab = "log-fold-change", main = colnames(tfit)[i] ,status=dt3[,i],
         hl.cex=c(0.7,0.7,0.7))
  abline(h=0,lty=3,col="red")
}

The contrast matrix is:

> contrast_matrix
           Contrasts
Levels      Adult_vs_N4 Adult_vs_N5 N4_vs_N5 Adult_vs_Embryo
  Ov_Adult            1           1        0               1
  Embryo              0           0        0              -1
  Ov_Nynph4          -1           0        1               0
  Ov_Nynph5           0          -1       -1               0

And the plot looks like: https://chodar.wixsite.com/rplot

Any idea of what happens?

limma plotMD • 1.0k views
ADD COMMENT
0
Entering edit mode
@gordon-smyth
Last seen 5 hours ago
WEHI, Melbourne, Australia

You appear to be using an earlier version of limma (prior to Bioconductor 3.10). For your code, the current version of limma would default to red for the up-regulated genes and blue for the down-regulated genes for all the plots.

In the version of limma you are using, you can add values=c(1,-1) and hl.col=c("red","blue") to the plotMD call to control the colouring.

The reason for the colouring you see is explained on the plotWithHighlights help page. If you don't specify which status values to highlight, then the most common value (0 in your case) will be black, the next most common (1 for your first three plots and -1 for the fourth) will be red, the third most common will be green, and so on. Hence, the colours were inverted on your fourth plot because the logFC changes for that contrast were mostly down instead of mostly up.

ADD COMMENT
0
Entering edit mode

Great, thanks vary much Gordon!.

ADD REPLY

Login before adding your answer.

Traffic: 619 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6