This is a test version of Biostars. For the public version, visit https://www.biostars.org.
highlighting specific genes (from a user-supplied list) in a Volcano plot in R

I've generated a volcano plot using DeSeq2 results and would like to specifically highlight a subset of genes by providing a list of gene IDs

Dataset$condition <- relevel(Dataset$condition, "Ctrl")
res <- lfcShrink(DatasetProcessed, contrast=c("condition","Treat","Ctrl")) 
with(res, plot(log2FoldChange, -log10(pvalue), pch=16, cex=0.6, main="Volcano plot", xlim=c(-5,5)))

Given a list of geneIDs (corresponding to IDs in res) that I have converted into a vector, how can I then highlight these in the volcano plot?

gene_list <- scan("genelist.txt", what="", sep="\n") 
gene_list <- as.vector(gene_list)
r volcano plot deseq2

1 answer

As always seems to be the case, I figured out the answer five minutes after asking the question...

with(res, plot(log2FoldChange, -log10(pvalue), pch=16, cex=0.6, main="Volcano plot", xlim=c(-5,5))) 
gene_list <- scan("genelist.txt", what="", sep="\n")
gene_list <- as.vector(gene_list) 
with(subset(res, rownames(res) %in% gene_list), points(log2FoldChange, -log10(pvalue), pch=20, col="orange"))

Hopefully this will help someone else down the line

I would rather use padj than pvalue to assess the significance of DEGs. In that case, it comes in handy to also add abline(h=-log(0.05, base = 10), col="red") to see a significance threshold line on the Volcano plot.

Log in to answer this question.