R语言GEO数据处理(七)
# 6. 可视化展示 ----------------------------------------------------------------
##6.1 火山图
library(ggplot2)
p <- ggplot(data = deg,
aes(x = logFC,
y = -log10(P.Value))) +
geom_point(alpha=0.4, size=1.5,
aes(color=change)) +
ylab("-log10(Pvalue)")+
scale_color_manual(values=c("blue", "grey","red"))+
geom_vline(xintercept=c(-logFC,logFC),lty=4,col="black",lwd=0.8) +
geom_hline(yintercept = -log10(P.Value),lty=4,col="black",lwd=0.8) +
theme_bw()
p
###添加标签
x1 = deg %>%
filter(change == "up") %>%
head(5)
x2 = deg %>%
filter(change == "down") %>%
head(5)
label = rbind(x1,x2)
volcano_plot <- p +
geom_point(size = 1, shape = 1, data = label) +
ggrepel::geom_label_repel(data = label, aes(label = rownames(label)), color="black")
volcano_plot
##6.2 热图
#全部差异基因
cg = rownames(deg)[deg$change !="not"]
diff=exp2[cg,]
library(pheatmap)
annotation_col=data.frame(group=group_list)
rownames(annotation_col)=colnames(diff)
p3 <- pheatmap(diff,
annotation_col=annotation_col,
scale = "row",
show_rownames = F,
show_colnames = F,
color = colorRampPalette(c("navy", "white", "red"))(50),
fontsize = 10,
fontsize_row = 3,
fontsize_col = 3)
p3
