DESeq2: How do one label specific points (gene) on the DESEq2 plot?
1
1
Entering edit mode
15 months ago
jaqx008 ▴ 110

Hello everyone. I am doing a DESeq2 analysis and wanting to identify all the genes (points) colored in red. I found this somewhere (see below) but not sure how to change it to identify all the red and ignore the grey. Any other suggestion apart from this will be helpful. Thanks

plotMA(res, ylim=c(-5,5))
with(res[topGene, ], {
points(baseMean, log2FoldChange, col="dodgerblue", cex=2, lwd=2)
text(baseMean, log2FoldChange, topGene, pos=2, col="dodgerblue")
})

Deseq2 R R-studio Gene • 897 views
0
Entering edit mode

Hi,

It is not clear to me what you want. Do you want to plot the gene ids of the red points? Do you want just to retrieve the gene ids from the red dots?

António

0
Entering edit mode

Exactly, to add the gene IDs to the red dots, I can then manually retrieve them.

0
Entering edit mode

Hi,

So, it's not a good idea try to plot the names of all those genes, because depending how many genes you want to label (red points - usually dozens to hundreds/thousands), the final result may not be "readable", i.e., most of the gene labels will be overlapped.

So, if what you really want is to identify the gene id of the differentially expressed genes, you can do the following:

alpha <- 0.05 # the significant FDR to filter/select the differentially expressed genes
sign_pos <- which(res\$padj < alpha ) # obtain a vector with the positions of the DEG
genes <- rownames(res) # retrieve row names - gene ids
sign.genes <- genes[sign_pos] # filter the significant genes based on position

head(sign.genes) # print just the first few differentially expressed genes - gene ids
res[sign.genes,] # check in the final deseq result table, that actually the DEG were picked right


Let me know if this does what you need,

António

0
Entering edit mode

Hello. Thank you very much for your input. I did run the commands you suggested but it only returned up-regulated genes (they grey) instead of the red. Let me mention that the grey are untreated sample while the red are treatments, hence I want to see up-regulated genes in the treatment (Red dots). I will try to attach an image of what the plot looks like.

https://ibb.co/hf9k89J

1
Entering edit mode

The red dots are up- and down-regulated genes depending on the log fold-change, if it is positive or negative, respectively (y-axis). The gray are not untreated or treated, but instead they are the non-significant genes. Each point represents a gene. the log2 fold change is the ratio between log2(treated/untreated) - scale across y-axis -, and the x-axis represents expression level - mean of normalized counts.

Since you have just a few genes that are significant (red) you might want to try the solution of Kevin Blighe below.

If you just print sign.genes in R, it should show you all the red dot genes (please check the documentation of plotMA, where it says (citation) ...Statistically significant features are colored red.)

I hope this clarifies your doubts.

António

0
Entering edit mode

Thank you very much Antonia. your explanation was really helpful. Thank you

3
Entering edit mode
15 months ago

I guess that one issue is that baseMean is not being plot - it is log(baseMean + 1)?

The user could try EnhancedVolcano to produce an 'EnhancedMA':

Kevin