This is a test version of Biostars. For the public version, visit https://www.biostars.org.
How to add single gene name in volcano plot ?

Hi all,

I am using R script from Getting Genetics Done ( http://www.gettinggeneticsdone.com/2014/05/r-volcano-plots-to-visualize-rnaseq-microarray.html) to generating Volcano plots but my problem is how to show particular single gene name on volcano plot without any condition (i.e foldchange or pvalue). I just want to highlight my gene name "WNT7A" on volcano plot.

It would be great help if someone help me how to modify following code:

labs=Gene

I tried labs <- res$Gene[WNT7A]

but couldnt work...

This is original code from Getting Genetics Done:

res <- read.table("results.txt", header=TRUE)
head(res)

# Make a basic volcano plot 
with(res, plot(log2FoldChange, -log10(pvalue), pch=20, main="Volcano plot", xlim=c(-2.5,2)))

# Add colored points: red if padj<0.05, orange of log2FC>1, green if both)
with(subset(res, padj<.05 ), points(log2FoldChange, -log10(pvalue), pch=20, col="red"))
with(subset(res, abs(log2FoldChange)>1), points(log2FoldChange, -log10(pvalue), pch=20, col="orange"))
with(subset(res, padj<.05 & abs(log2FoldChange)>1), points(log2FoldChange, -log10(pvalue), pch=20, col="green"))

# Label points with the textxy function from the calibrate plot
library(calibrate)
with(subset(res, padj<.05 & abs(log2FoldChange)>1), textxy(log2FoldChange, -log10(pvalue), labs=Gene, cex=.8))
r volcano plot

1 answer

Perhaps I missed something, but it looks quite obvious to me:

with(subset(res, Gene == "WNT7A"), textxy(log2FoldChange, -log10(pvalue), labs=Gene, cex=.8))

Thank you very much..

It is working perfectly fine.

Log in to answer this question.