泛癌分析— (2)

单基因数据在癌症中的表达

上面得到的result.txt文件,读入R中,进行可视化。
代码如下(Rstudio):

setwd("W:\\singleExp")
#install.packages("ggpubr")
library(ggpubr)

singleExp <- read.table("result.txt",sep="\t",
                        header=T,check.names=F)
colnames(singleExp)[1]="ID"
geneName <-  colnames(singleExp)[2]
  

# 可视化
ggboxplot(singleExp, 
          x="tumorType", 
          y= geneName, 
          ylab=paste0(geneName,"   Expression Level"),
          xlab="",
          fill = "tissueType",
          palette = c("#0072B5FF","#BC3C29FF") )+
  font("caption", size = 10, color = "orange")+
  font("xlab", size = 12, color = "blue")+
  font("ylab", size = 14, color = "#993333")+
  font("legend.title", color="black", face = "bold",size = 16)+
  font("legend.text", color = "black",size = 12)+
  rotate_x_text(60)+
  stat_compare_means(aes(group=tissueType),
                     method="wilcox.test",
                     symnum.args=list(cutpoints = c(0, 0.001, 0.01, 0.05, 1), 
                                      symbols = c("***", "**", "*", " ")),
                     label = "p.signif")

得到的图片如下:


基因表达

你可能感兴趣的:(泛癌分析— (2))