Volcano Plot (highlighting top genes in a different color)
1
0
Entering edit mode
Nithisha ▴ 10
@nithisha-14272
Last seen 3.8 years ago

Hi everyone,

I am trying to plot Volcano plots for analysis mostly from Limma. I found 2 sources- one that labels points above certain thresholds of adjusted p values and logFC values and another one that uses the MarrayLM object as input and labels the top gene hits.

Here are the source links:

1)  http://www.gettinggeneticsdone.com/2014/05/r-volcano-plots-to-visualize-rnaseq-microarray.html

2) http://web.mit.edu/~r/current/arch/i386_linux26/lib/R/library/limma/html/volcanoplot.html (can only be used for Limma I believe)

Is there a way I can label the top 20 most up-regulated genes and 20 most down-regulated genes as per LogFC values and also change the color of the points that represent them? Is it possible to only highlight points that meet certain conditions in different colors and to label them (as in Source 1) or to label the top gene hits only (as in Source 2)? 

Thanks for all the help.

volcanoplot • 5.5k views
ADD COMMENT
2
Entering edit mode
thokall ▴ 160
@thokall-14310
Last seen 4 months ago
Swedish Museum of Natural History

Hi,

Not sure exactly what you mean, but looking at the first example you can identify the threshold for fold change and then almost unaltered use Turners example.

threshold.high <- sort(res$log2FoldChange, decreasing = TRUE)[20]
threshold.low <- sort(res$log2FoldChange, decreasing = FALSE)[20]
with(res, plot(log2FoldChange, -log10(pvalue), pch=20,
     main="Volcano plot", xlim=c(-2.5,2)))
with(subset(res, log2FoldChange > threshold.high),
     points(log2FoldChange, -log10(pvalue), pch=20, col="red"))
with(subset(res, log2FoldChange < threshold.low),
     points(log2FoldChange, -log10(pvalue), pch=20, col="red"))
with(subset(res, log2FoldChange > threshold.high),
     textxy(log2FoldChange, -log10(pvalue), labs=Gene, cex=.8))
with(subset(res, log2FoldChange < threshold.low),
     textxy(log2FoldChange, -log10(pvalue), labs=Gene, cex=.8))
ADD COMMENT
0
Entering edit mode

I used your code to make volcano plot from rna seq data i get this error im not sure what it is can you tell me ?

Error in as.graphicsAnnot(labels) : object 'Gene' not found
 
 
ADD REPLY
0
Entering edit mode

If you followed the example by Turner you, the data frame res have a column with the name Gene. 

> head(res)
     Gene log2FoldChange    pvalue      padj
1    DOK6         0.5100 1.861e-08 0.0003053
2    TBX5        -2.1290 5.655e-08 0.0004191
3 SLC32A1         0.9003 7.664e-08 0.0004191
4  IFITM1        -1.6870 3.735e-06 0.0068090
5   NUP93         0.3659 3.373e-06 0.0068090
6 EMILIN2         1.5340 2.976e-06 0.0068090

You hence have to supply a vector with gene names from your own data.

 

ADD REPLY
0
Entering edit mode

Thank you, I shall try this out!

ADD REPLY

Login before adding your answer.

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