how to label one gene only inside my volcano plot? or to show the gene names but in a good way?
1
0
Entering edit mode
4.6 years ago
Raia262 • 0

hello guys, i am new to R and i really hope to help me with this analysis. Thank you in advance!! so this is my code and my results are in a text file, i tried to show only the relevant genes that have a q_val less than .05 and then i wanted to label these genes, but im not getting the names/labels or i get them but in a messy way where i cant even read them. any help??

library(ggplot2)
library(ggrepel)
library(MASS)
library(RColorBrewer)
library(reshape)
pdf("FINALLY.pdf")
res <- read.table(file = 'Genetun.txt', sep = '\t', header = TRUE)
threshold <- res$q_value<.05
length(which(threshold))
res$threshold <- threshold
res_ordered <- res[order(res$q_value), ] 
res_ordered$gene <- ""
res_ordered$gene[1:10] <- rownames(res_ordered)[1:10]

with(res_ordered, plot(log2.fold_change., -log10(p_value), pch=20, main="Volcano plot", xlim=c(-2.5,2)))

# Add colored points: red if q_value<0.05, orange of log2FC>1, green if both)
with(subset(res_ordered, q_value<.05 ), points(log2.fold_change., -log10(p_value), pch=20, col="red"))
with(subset(res_ordered, abs(log2.fold_change.)>1), points(log2.fold_change., -log10(p_value), pch=20, col="orange"))
with(subset(res_ordered, q_value<.05 & abs(log2.fold_change.)>1), points(log2.fold_change., -log10(p_value), pch=20, col="green"))

library(calibrate)
with(subset(res_ordered, q_value<.05 & abs(log2.fold_change.)>1), textxy(log2.fold_change., -log10(p_value), labs=res_ordered$gene, cex=.8),highlight=100)
dev.off()
R gene volcano_plot differential expression • 1.6k views
ADD COMMENT
0
Entering edit mode

Can you attach an image ? The FINALLY plot ?

ADD REPLY
0
Entering edit mode

enter image description here

ADD REPLY
0
Entering edit mode
ADD REPLY
1
Entering edit mode
4.6 years ago

EnhancedVolcano from Kevin

ADD COMMENT
0
Entering edit mode

Good choice. Check the selectLab option to label individual genes.

ADD REPLY

Login before adding your answer.

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