GO-plot:超好看的GO富集可视化

以下代码均来自GO-plot的manual(GOplot (wencke.github.io))。
GO-plot用条形图,气泡图,弦图,热图等方式将基因表达数据和功能注释数据结合展示出来。

#安装GO-plot包
install.packages('GOplot')

下载示例数据(wencke.github.io/EC.rda at master · wencke/wencke.github.io · GitHub)

#加载数据集
EC <- load("C:/Users/19724/Desktop/EC.rda")
data(EC)
#查看数据
head(EC$eset)
标准化的基因表达量数据集
head(EC$genelist)
差异表达基因数据集
head(EC$david)
DAVID GO注释结果
head(EC$genes)
选择要进行富集分析的基因
EC$process
选择富集生物学过程的特征向量

cirlce_dat函数将GO注释结果文件和基因差异表达分析文件结合起来,生成作图对象。

circ <- circle_dat(EC$david, EC$genelist)
head(circ)

category:GO term分为3类,分别为BP(生物学过程),CC(细胞组分),MF(分子功能);
ID和term来自于gene ontology数据库;
count为划分到相应term的基因数目;
logFC为差异表达基因的log标准化的倍数变化;
adj_pval为校正过的p-value值,adj_pval < 0.05显著富集;



zscore并不是一个标准的统计值,但是能暗示某个生物学功能更有可能上调还是下调;up和down分别表示划分到某个term的上调和下调基因数。

#只展示某一类GO term
GOBar(subset(circ, category == 'BP'))
#展示3类GO term
GOBar(circ, display = 'multiple', title = 'Z-score coloured barplot', zsc.col = c('yellow', 'black', 'cyan')) 
#气泡图
GOBubble(circ, labels = 3)

标记adj_pval负对数大于等于3的GO term,气泡的大小表明富集到该GO term的基因数目。



reduce_overlap函数过滤掉冗余的GO term,每组只保留一个代表性的GO term以增加图的可读性。

#过滤基因重叠度等于或超过0.75的GO term
reduced_circ <- reduce_overlap(circ, overlap = 0.75)
GOBubble(reduced_circ, labels = 2.8)
GOBubble(circ, title = 'Bubble plot', colour = c('orange', 'darkred', 'gold'), display = 'multiple', labels = 2)  
GOBubble(circ, title = 'Bubble plot with background colour', display = 'multiple', bg.col = T, labels = 3)
#圈图
IDs <- c('GO:0007507', 'GO:0001568', 'GO:0001944', 'GO:0048729', 'GO:0048514', 'GO:0005886', 'GO:0008092', 'GO:0008047')
GOCircle(circ, nsub = IDs)

通过指定ID或者指定ID数目来展示GO term,如nsub = 10;这种图还展示了上下调基因的分布情况,但是这种图最多只能展示12个GO term。


#弦图
chord <- chord_dat(circ, EC$genes, EC$process)
head(chord)

chord_dat函数整理出弦图所需的二进制矩阵。0代表该基因不可以被注释到该GO term,反之1代表可以。

chord <- chord_dat(data = circ, genes = EC$genes, process = EC$process)
GOChord(chord, space = 0.02, gene.order = 'logFC', gene.space = 0.25, gene.size = 5)

弦图展示了感兴趣的基因和某些GO term的关系,以基因差异表达倍数的大小排序。


GOChord(chord, limit = c(3, 0), gene.order = 'logFC')

只展示至少与三个生物学过程相关的基因。


#热图
GOHeat(chord[,-8], nlfc = 0)

热图类似于弦图,横轴代表不同的基因,count代表基因被注释到的GO term数目。


GOHeat(chord, nlfc = 1, fill.col = c('red', 'yellow', 'green'))
#聚类图
GOCluster(circ, EC$process, clust.by = 'logFC', term.width = 2)

将具有相似表达模式的基因聚类到一起。


GOCluster(circ, EC$process, clust.by = 'term', lfc.col = c('darkgoldenrod1', 'black', 'cyan1'))

将富集到的GO term情况类似的基因聚类到一起。


#韦恩图
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, label = c('heart development', 'plasma membrane', 'tissue morphogenesis'))

最多只能展示3个数据集,红色为上调,蓝色为下调。


你可能感兴趣的:(GO-plot:超好看的GO富集可视化)