[R代码]差异表达基因画火山图

2023-11-12  本文已影响0人  expgene

探序基因肿瘤研究院 整理

library(ggplot2)

library(ggrepel)

library(RColorBrewer)

Dat <- read.table("D:/aaa-DEG.xls",header = TRUE)

Dat1 <- Dat[which(Dat$baseMean > 50),]

Dat1$sig[Dat1$log2FoldChange > 1 & Dat1$padj < 0.05] <- "up"

Dat1$sig[Dat1$log2FoldChange < -1 & Dat1$padj < 0.05] <- "down"

Dat1$sig[is.na(Dat1$sig)] <- "nosig"

Dat1$sig <- as.factor(Dat1$sig)

Dat2 <- Dat1[which(Dat1$gene != "EGFR"),]

pdf("D:/aaa-DEG.pdf",height = 10,width = 10)

p <- ggplot(Dat2,aes(x=log2FoldChange,y=-log10(padj),color = sig))+

  geom_point()+

  scale_color_manual(values=c("blue","gray","red"))+

  theme_bw()+

  theme(

    legend.title = element_blank()

  )+

  ylab('-log10 (p-adj)')+

  xlab('log2 FoldChange')+

  geom_vline(xintercept=1,lty=3,col="black",lwd=0.5) +

  geom_vline(xintercept=-1,lty=3,col="black",lwd=0.5) +

  theme(panel.grid =element_blank())

上一篇下一篇

猜你喜欢

热点阅读