PlotMA Filters for DeSEQ2 ; adjusting script
2
0
Entering edit mode
sjs0282 • 0
@sjs0282-9822
Last seen 5.6 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
points(log10(res$baseMean)[filt],res$log2FoldChange[filt],col=2,pch=3,cex=0.5)
abline(h=0,col=4)

##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 • 3.8k views
ADD COMMENT
0
Entering edit mode
@wolfgang-huber-3550
Last seen 11 weeks ago
EMBL European Molecular Biology Laborat…

sjs0282

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

Wolfgang

 

ADD COMMENT
0
Entering edit mode
@mikelove
Last seen 2 hours 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:

library(DESeq2)
?plotMA

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( is.na( res$padj ), FALSE, res$padj < alpha )

 

plotMA-methods           package:geneplotter           R Documentation

Generate an MA plot

Description:

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

Usage:

     ## 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", ... )

Arguments:

  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).

...
ADD COMMENT

Login before adding your answer.

Traffic: 189 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