highlighting specific genes (from a user-supplied list) in a Volcano plot in R
1
2
Entering edit mode
6.0 years ago
Eskimo ▴ 120

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 • 3.7k views
ADD COMMENT
0
Entering edit mode
ADD REPLY
8
Entering edit mode
6.0 years ago
Eskimo ▴ 120

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

ADD COMMENT
0
Entering edit mode

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.

ADD REPLY

Login before adding your answer.

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