Entering edit mode
4.1 years ago
choijamtsm
▴
60
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
library(calibrate)
#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!
Provide example input: res and genes objects.
Note, there is a dedicated package for volcanoes - EnhancedVolcano
Thanks for your reply
res <- read.table("results.txt", header=TRUE)
genes <- read.table("genes.txt", header=TRUE)
I am struggling with inject genes$gene into res volcano plot
Thank you
Run this:
More information in the vignette that I wrote: https://bioconductor.org/packages/release/bioc/vignettes/EnhancedVolcano/inst/doc/EnhancedVolcano.html
Thank you so much for your reply. I downloaded 'EnhancedVolcano' package then run above command.
But All of the res$gene labeled on volcano plot.
Volcano plot Enhanced Volcano res$gene
Actually my goal is to label custom genes. So I've tried to run following command:
But it gives me the following plot! which are only row number's shown? how can I see the gene name?
Trying to labeling custom genes
Thank you
You simply need to alter the cut-offs for p-value and log [base 2] fold-change. Please read the manual or take a look at the vignette:
---------------------------------------
Please show the outputs of the following:
Thank you,
1. I altered the cut-offs for p-value and log2 fold change and graph looks nice!
altered p-value and log2 fold change
2. Here are the outputs:
class(res)
head(res)
head(res$gene)
class(gene_list)
head(gene_list)
My goal is to only label gene_list in res. I also tried following code but failed!
Thank you~
Oh, you just need to do this before running anything else:
It works now!! thank you so much
Please use the formatting bar (especially the
code
option) to present your post better. You can use backticks for inline code (`text` becomestext
), 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.