Question: How to label custom multiple gene lists object into volcano plot?
gravatar for choijamtsm
5 days ago by
choijamtsm0 wrote:

Hello everyone!

I am new here and I tried to make a basic volcano plot with R.

#import data
res <- read.table("results.txt", header=TRUE)
genes <- read.table("genes.txt", header=TRUE)

# Make a basic volcano plot 
with(res, plot(log2foldchange, -log10(pvalue), pch=20, cex.lab=1.6, main="Volcano Plot", xlim=c(-8,8), col="grey"))

# Add colored points:
with(subset(res, pvalue<.05 & abs(log2foldchange)>1.5), points(log2foldchange, -log10(pvalue), pch=20, col="cyan"))

# Label points with the textxy function from the calibrate plot

#Label only 1 gene
with(subset(res, Gene == "WNT7A"), textxy(log2FoldChange, -log10(pvalue), labs=Gene, cex=.8))

#How to insert "genes" into volcano plot (overlap res)?

My question is how to add "genes" which contains multiple gene lists into res? (which should label only genes list)

Thank you so much!

rna-seq R gene • 73 views
ADD COMMENTlink modified 5 days ago by RamRS25k • written 5 days ago by choijamtsm0

Provide example input: res and genes objects.

Note, there is a dedicated package for volcanoes - EnhancedVolcano

ADD REPLYlink written 5 days ago by zx87549.0k

Thanks for your reply

  • Here is the input:

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

gene      log2foldchange    pvalue      padj
Cx3cr1      -8.039238787    1.29E-11     2.78E-116
Trem1       -5.258501816    3.01E-44       1.77E-42
Serpina3f  3.202817674  2.12E-09       2.40E-08
Fcrl1        -4.56714509    2.99E-16       5.91866E-15
AU021092 1.886580391    8.00E-03       0.031416887 and so on..

genes <- read.table("genes.txt", header=TRUE)

Serpina3f and so on..

I am struggling with inject genes$gene into res volcano plot

Thank you

ADD REPLYlink modified 5 days ago • written 5 days ago by choijamtsm0

Run this:

if (!requireNamespace('BiocManager', quietly = TRUE))


    lab = res$gene,
    x = 'log2foldchange',
    y = 'pvalue')

More information in the vignette that I wrote:

ADD REPLYlink modified 4 days ago • written 4 days ago by Kevin Blighe54k

Please use the formatting bar (especially the code option) to present your post better. You can use backticks for inline code (`text` becomes text), or select a chunk of text and use the highlighted button to format it as a code block. I've done it for you this time.

ADD REPLYlink written 5 days ago by RamRS25k
Please log in to add an answer.


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