GO分析在科研中十分常见,简单的表格或者柱状图已经很难满足大家的需求,今天小编介绍一个专注于可视化的R包--GOplot。 ###########安装 #install.packages('GOplot') #install_github('wencke/wencke.')
###########加载 library(GOplot)
data(EC) head(EC$david)###DAVID富集分析结果 head(EC$genelist)###差异分析结果 ###大家也可以根据上面的格式将自己的文件读入 circ <- circle_dat(EC$david, EC$genelist)#创建绘图对象 head(circ)
 其中,category代表GO term category logFC代表相关基因差异表达分析中的logFC值 其中up,down,count,分别代表在相关GO term中上调,下调,总计的基因数 准备好上面的数据,就可以开始绘制各种GO富集分析图啦~GOBar(circ, display = 'multiple', title = 'Z-score coloured barplot', ##设置标题 zsc.col = c('firebrick3', 'white', 'royalblue3')##设置颜色 )

GOBar(subset(circ, category == 'BP'))##仅展示部分GO

GOBubble(circ, title='GOBubble plot',##设置标题 labels = 5,##-log(adj p-value)>5 ID = TRUE,##TRUE显示符合标准的GO term ID,FALSE显示GO term name table.legend = TRUE, table.col = TRUE, ##右侧表格设置 bg.col = FALSE#背景颜色设置 )

GOBubble(circ, title = 'GOBubble plot', labels = 3, colour = c('orange', 'darkred', 'gold'), ##颜色设置 display = 'multiple',##根据类别对图像进行分面处理 bg.col = TRUE#背景颜色设置 )

GOCircle(circ, rad1=2, rad2=3,##内径、外径设置 zsc.col=c('firebrick3', 'white', 'royalblue3'),#z-score颜色设置 lfc.col=c('firebrick3', 'royalblue3'),##上调下调颜色设置 label.size=5,label.fontface='bold',##字体大小格式设置 table.legend=TRUE##右侧表格设置 )
$ GOCircle(circ, nsub = 5)###选择GO term 进行展示(即选取前n行展示)

$ IDs <- c('GO:0007507', 'GO:0001568', 'GO:0001944', 'GO:0048729', 'GO:0048514', 'GO:0005886', 'GO:0008092', 'GO:0008047') GOCircle(circ, nsub = IDs)##用户自定义选择GO term 进行展示
head(EC$genes) head(EC$process) chord <- chord_dat(data = circ, genes = EC$genes)#生成带有选定基因列表的矩阵 chord <- chord_dat(data = circ, process = EC$process)#生成带有选定GO term列表的矩阵
chord <- chord_dat(data=circ, genes=EC$genes, process=EC$process)#构建数据 head(chord) GOChord(chord, title='GOChord plot',#标题设置 space = 0.02, #GO term处间隔大小设置 limit = c(3, 5),#第一个数值为至少分配给一个基因的Goterm数,第二个数值为至少分配给一个GOterm的基因数 gene.order = 'logFC', gene.space = 0.25, gene.size = 5,#基因排序,间隔,名字大小设置 lfc.col=c('firebrick3', 'white','royalblue3'),##上调下调颜色设置 #ribbon.col=colorRampPalette(c('blue', 'red'))(length(EC$process)),#GO term 颜色设置 ribbon.col=brewer.pal(length(EC$process), 'Set3'),#GO term 颜色设置 )

GOHeat(chord[,-ncol(chord)], ##去除最后一列logFC nlfc = 0,#定义logFC列的数量(默认值为0) )

GOHeat(chord, nlfc = 1, fill.col = c('firebrick3', 'white','royalblue3')#颜色设置 )

GOCluster(data=circ, process=EC$process,#选择GO term metric='euclidean',#选择距离度量方法 clust='average', #选择聚类方法 clust.by = 'term',#指定是否应该对基因表达模式或功能类别进行聚类。term(default) or logFC term.width = 2,term.col=brewer.pal(length(EC$process), 'Set3'),#GO term 宽度,颜色设置 nlfc=FALSE, lfc.col=c('firebrick3', 'white','royalblue3')#是否包含多个logFC列,颜色设置 )
 figure-7 GOVenn(max 3sets)l1 <- subset(circ, term == 'heart development', c(genes,logFC)) l2 <- subset(circ, term == 'plasma membrane', c(genes,logFC)) l3 <- subset(circ, term == 'tissue morphogenesis', c(genes,logFC)) GOVenn(l1,l2,l3, lfc.col=c('firebrick3', 'white','royalblue3'),#logFC颜色设置 circle.col=brewer.pal(3, 'Dark2'),#Venn颜色设置 label = c('heart development', 'plasma membrane', 'tissue morphogenesis')#标签设置 )

|