美文网首页R语言做生信R
Biological theme comparison—画出多样

Biological theme comparison—画出多样

作者: 五谷吃不完了 | 来源:发表于2019-04-04 10:50 被阅读32次

参考1:听说你也在画dotplot,但是我不服!

参考2:Statistical analysis and visualization of functional profiles for genes and gene clusters

#clusterProfiler这个包里面给出了样例数据

rm(list = ls())
library(clusterProfiler)
library(ggplot2)

#这个gcSample他是一个list,里面包含有不同分组的基因名,参见下图
data(gcSample)
lapply(gcSample, head)

如何制作上述的gcSample

#主要就是R语言中的xlsx包
install.packages("rJava")
install.packages("xlsxjars")
install.packages("xlsx")
library(xlsx)

#这一步就是读取Excel表格当中不同sheet的内容
#可以把同个样本找到的差异基因放在一个sheet里面
#读出之后,首次是data.frame的格式,后续需要调整一下
data.list<-list()
for (i in 1:3){
  data.list[[i]]=read.xlsx("test.xlsx",i)
}

data.list[[i]]=as.character(data.list[[i]]$x)


正式画图

#经过上面的步骤,应该已经制作好了自己的gcSample

library(clusterProfiler)
library(ggplot2)
library(xlsx)
data(gcSample)

#fun参数在这里就是可以选择不同的富集类型
ck <- compareCluster(geneCluster = gcSample,fun = 'enrichKEGG')
p <- dotplot(ck, showCategory=10)
p
#还可以调整颜色
p2 <- p + scale_color_continuous(low='Firebrick2', high='ForestGreen')
#改变点的形状
p2 + aes(shape=GeneRatio > 0.1) 

附上几张自己的图


相关文章

网友评论

    本文标题:Biological theme comparison—画出多样

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