gravatar for a.rahim2626

2 hours ago by

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()



Source link