Question: What the heck is going on with this DESeq2 MA Plot?
gravatar for Kristin Muench
3.2 years ago by
United States
Kristin Muench520 wrote:


I'm getting a very strange MA plot, despite following the DESeq2 instructions. Effectively, my MA plot looks exactly like a line, with x-values ranging from 0 to 50,000, and y ranging from 0 to 90,000 (so, not the y-axis range of -2 to 2 the code predicts). Furthermore, when I look at the data itself, it doesn't look so odd - in fact, log2FoldChange (this is what is plotted on y axis right?) seems to have an even number of points below and above 0, which is not the case in the MA Plot.

What is going on? Any suggestions would be appreciated!

Image here:

   dds <- DESeq(myData)
   deseqOutput <- results(dds)
   deseqOutput_p05 <- results(dds, alpha=0.05)

    out of 23719 with nonzero total read count
    adjusted p-value < 0.05
    LFC > 0 (up)     : 339, 1.4% 
    LFC < 0 (down)   : 381, 1.6% 
    outliers [1]     : 0, 0% 
    low counts [2]   : 4143, 17% 
    (mean count < 3)

    sum(deseqOutput$log2FoldChange < 0)
        [1] 13241

    sum(deseqOutput$log2FoldChange > 0)
        [1] 10478

plotMA(deseqOutput , ylim=c(-2,2))
plotMA(deseqOutput, ylim=c(-2,100000), xlim=c(0,100000))

EDIT: I found a clue! If I do a remove objects AND clear plots AND type into the console in R, I still get this error. However, the error disappears if I completely close RStudio and open it up again/re-run code...UNLESS I include a piece of code that plots a PCA using ggplot2. Any ideas what this means? Thanks for your help!

EDIT 2: Here is the code from the PCA code that seems to cause this problem:

quickPCA <- function(rawCounts, sampleNames, condition, title){ #sometimes have to change function names to match what you are passing in for some reason

  # load ggplot2

  sizeFactors <- calcNormFactors(rawCounts, method="RLE")
  rawCounts_normd <- asinh(rawCounts*sizeFactors)
  colnames(rawCounts_normd) <- sampleNames

  # PCA
  cds.pca <- prcomp(t(rawCounts_normd),
                           center = TRUE)

  # create data frame with scores
  scores <-$x)

  # plot of first two principal components
  p= ggplot(data =$x), aes(x = PC1, y = PC2, label = rownames($x) ) )) +
    geom_hline(yintercept = 0, colour = "gray65") +
    geom_vline(xintercept = 0, colour = "gray65") +
    geom_point() +
    geom_text_repel(size = 5, aes(colour = factor(condition), label = rownames($x)), fontface='bold')) +
    scale_colour_discrete(l=40) +
rna-seq ma plot deseq2 R • 2.3k views
ADD COMMENTlink modified 6 months ago by Anna80 • written 3.2 years ago by Kristin Muench520

UNLESS I include a piece of code that plots a PCA using ggplot2.

This seems crucial. If you add that code to your post this might also provide us with clues about what goes wrong.

ADD REPLYlink modified 3.2 years ago • written 3.2 years ago by WouterDeCoster44k

Good point! I've included my PCA-plotting code under Edit2 in the original post.

ADD REPLYlink written 3.2 years ago by Kristin Muench520
gravatar for Anna
6 months ago by
Anna80 wrote:

I had the same problem, but not necessarily linked to a previous PCA plot. In my case, the plotMA function was being called from a different package. Be aware that there are many packages that have a plotMA and not all of them take the same class of object.

I solved it by using DESeq2::plotMA(res)

ADD COMMENTlink written 6 months ago by Anna80
Please log in to add an answer.


Use of this site constitutes acceptance of our User Agreement and Privacy Policy.
Powered by Biostar version 2.3.0
Traffic: 1177 users visited in the last hour