PlotMA Filters for DeSEQ2 ; adjusting script
Entering edit mode
sjs0282 • 0
Last seen 6.5 years ago

I'm trying to get a mean expression plot, where only genes that are + - 0.6 LFC, and have a padj <0.001 to be in red. I have tried the following 2-3 things, but don't know how to get a plot where only the genes that are greater than 0.6 LFC and less than padj<0.001 to be in red. I''ve checked different forums and versions of DeSEQ2 vignettes. 

Please advise,

## how to add a filter for LFC +- 0.6 to to this script: plot(log10(res$baseMean),res$log2FoldChange,xlab="mean expression",ylab="log fold change",pch=3,cex=0.5)
filt <- res$pvalue < 0.001

##or fix this script

plotMA(res, res$padj < 0.01 & res$log2FoldChangee > 0.5, main= "Differentially Expressed Genes", ylim=c(-1.5, 1.5))


deseq2 rnaseq plotMA deseq rna-seq • 4.1k views
Entering edit mode
Last seen 10 days ago
EMBL European Molecular Biology Laborat…


If you're only interested in genes with a minimal absolute fold-change, you should insert that already in your null hypothesis. Have a look at Section 3.9 of the DESeq2 vignette: Tests of log2 fold change above or below a threshold

Best wishes



Entering edit mode
Last seen 4 days ago
United States

First, see Wolfgang's answer which is our preferred way to test LFC greater than a threshold.


However, if you still want to test a null of LFC = 0, but you want to customize the plot, if you do:


You should get a set of options:

Choose one

1: Generate an MA plot {geneplotter}
2: MA-plot from base means and log fold changes {DESeq2}
3: MA-plot: plot differences versus averages for high-throughput data {BiocGenerics}

Note that (2) is the DESeq2 method which works on results tables. This method itself creates a data.frame and calls (1).

See the manual page for (1) for ideas on how to customize. The x is res$baseMean, the y is res$log2FoldChange, and the third column is res$padj < alpha, except to deal with NA (from filtering) you can use: 

ifelse( res$padj ), FALSE, res$padj < alpha )


plotMA-methods           package:geneplotter           R Documentation

Generate an MA plot


     Generate a plot of log fold change versus mean expression (MA


     ## S4 method for signature 'data.frame'
     plotMA( object, ylim = NULL,
       colNonSig = "gray32", colSig = "red3", colLine = "#ff000080",
       log = "x", cex=0.45, xlab="mean expression", ylab="log fold change", ... )


  object: A ‘data.frame’ with (at least) three columns, the first
          containing the mean expression values (for the x-axis), the
          second the logarithmic fold change (for the-y axis) and the
          third a logical vector indicating significance (for the
          colouring of the dots).


Login before adding your answer.

Traffic: 543 users visited in the last hour
Help About
Access RSS

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

Powered by the version 2.3.6