Search
Question: Volcano Plot (highlighting top genes in a different color)
0
gravatar for Nithisha
7 months ago by
Nithisha10
Nithisha10 wrote:

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.

ADD COMMENTlink modified 7 months ago by thokall110 • written 7 months ago by Nithisha10
2
gravatar for thokall
7 months ago by
thokall110
Swedish Museum of Natural History
thokall110 wrote:

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 COMMENTlink modified 7 months ago • written 7 months ago by thokall110

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 REPLYlink written 7 months ago by krushnach800

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 REPLYlink written 7 months ago by thokall110

Thank you, I shall try this out!

ADD REPLYlink written 7 months ago by Nithisha10
Please log in to add an answer.

Help
Access

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