Hi, I have a question, I want to creat Volcano-diagram, I want to label the genes and differentiate the upregulated and downregulated by colours? But I have one blue color.
library(GEOquery)
library(limma)
library(umap)
load series and platform data from GEO
tmp <- read.delim("C:/Users/reham/Downloads/GSE18520.top.table.tsv")
View(tmp
)
de <- tmp[complete.cases(tmp), ]
ggplot(data=de, aes(x=logFC, y=adj.P.Val)) + geom_point()
p <- ggplot(data=de, aes(x=logFC, y=-log10(adj.P.Val))) + geom_point()
p <- ggplot(data=de, aes(x=logFC, y=-log10(adj.P.Val))) + geom_point() + theme_minimal()
p2 <- p + geom_vline(xintercept=c(-1, 1), col="red") +
geom_hline(yintercept=-log10(0.01), col="red")
de$diffexpressed <- "NO"
de$diffexpressed[de$log2FC > 1 & de$adj.P.Val < 0.01] <- "UP"
de$diffexpressed[de$log2FC < -1 & de$adj.P.Val < 0.01] <- "DOWN"
p <- ggplot(data=de, aes(x=logFC, y=-log10(adj.P.Val), col=diffexpressed)) + geom_point() + theme_minimal()
p2 <- p + geom_vline(xintercept=c(-1, 1), col="red") +
geom_hline(yintercept=-log10(0.01), col="red")
p3 <- p2 + scale_color_manual(values=c("blue", "black", "red"))
mycolors <- c("blue", "red", "black")
names(mycolors) <- c("DOWN", "UP", "NO")
p3 <- p2 + scale_colour_manual(values = mycolors)
de$delabel <- NA
de$delabel[de$diffexpressed != "NO"] <- de$gene_symbol[de$diffexpressed != "NO"]
ggplot(data=de, aes(x=logFC, y=-log10(adj.P.Val), col=diffexpressed, label=delabel)) +
geom_point() +
theme_minimal() +
geom_text()
library(ggrepel)
ggplot(data=de, aes(x=logFC, y=-log10(adj.P.Val), col=diffexpressed, label=delabel)) +
geom_point() +
theme_minimal() +
geom_text_repel() +
scale_color_manual(values=c("blue", "black", "red")) +
geom_vline(xintercept=c(-1, 1), col="red") +
geom_hline(yintercept=-log10(0.01), col="red")