Question: how to label one gene only inside my volcano plot? or to show the gene names but in a good way?
0
gravatar for Raia262
9 months ago by
Raia2620
Raia2620 wrote:

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()
ADD COMMENTlink modified 9 months ago by geek_y11k • written 9 months ago by Raia2620

Can you attach an image ? The FINALLY plot ?

ADD REPLYlink modified 9 months ago • written 9 months ago by geek_y11k

enter image description here

ADD REPLYlink written 9 months ago by Raia2620

https://ibb.co/DrzTh86

ADD REPLYlink modified 9 months ago • written 9 months ago by Raia2620
1
gravatar for geek_y
9 months ago by
geek_y11k
Barcelona
geek_y11k wrote:

EnhancedVolcano from Kevin

ADD COMMENTlink modified 9 months ago • written 9 months ago by geek_y11k

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

ADD REPLYlink written 9 months ago by ATpoint44k
Please log in to add an answer.

Help
Access

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