美文网首页
[R代码]差异表达基因画火山图

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

作者: expgene | 来源:发表于2023-11-12 16:48 被阅读0次

    探序基因肿瘤研究院 整理

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

    相关文章

      网友评论

          本文标题:[R代码]差异表达基因画火山图

          本文链接:https://www.haomeiwen.com/subject/ttcrwdtx.html