之前分享了如何用ggplot2可視化GO分析的結(jié)果。既然做了GO,當(dāng)然少不了KEGG了。
成都創(chuàng)新互聯(lián)公司專注于云城網(wǎng)站建設(shè)服務(wù)及定制,我們擁有豐富的企業(yè)做網(wǎng)站經(jīng)驗(yàn)。 熱誠為您提供云城營(yíng)銷型網(wǎng)站建設(shè),云城網(wǎng)站制作、云城網(wǎng)頁設(shè)計(jì)、云城網(wǎng)站官網(wǎng)定制、微信平臺(tái)小程序開發(fā)服務(wù),打造云城網(wǎng)絡(luò)公司原創(chuàng)品牌,更為您提供云城網(wǎng)站排名全網(wǎng)營(yíng)銷落地服務(wù)。
同樣的,我們從 DAVID 獲取KEGG pathway的結(jié)果。
對(duì)于KEGG,我比較喜歡做氣泡圖,這樣用兩種形式的圖結(jié)合在一起,效果更豐富更好看一點(diǎn)。
Term_Name GeneHitsInSelectedSet AllGenesInSelectedSet GeneHitsInBackground AllGenesInBackground p-value enrichFactor GeneListInSelectedSets Qvalue
00941 Flavonoid biosynthesis 14 492 41 3857 3.30E-04 2.676878842 "[FvH4_2g26480, FvH4_2g05780, FvH4_4g23870, FvH4_5g35170, FvH4_5g14010, FvH4_7g01160, FvH4_3g44420, FvH4_7g20870, FvH4_4g06180, FvH4_5g01170, FvH4_6g28410, FvH4_3g40570, FvH4_5g22390, FvH4_7g25890]" 0.04909626
00360 Phenylalanine metabolism 14 492 46 3857 0.001221701 2.38591375 "[FvH4_2g05780, FvH4_4g23870, FvH4_5g35170, FvH4_6g16060, FvH4_4g06180, FvH4_4g25490, FvH4_6g16460, FvH4_6g27650, FvH4_4g09340, FvH4_7g19130, FvH4_3g40570, FvH4_6g26610, FvH4_6g27940, FvH4_6g26600]" 0.091016736
00945 Stilbenoid, diarylheptanoid and gingerol biosynthesis 9 492 31 3857 0.012547314 2.275963808 "[FvH4_2g05780, FvH4_4g23870, FvH4_5g35170, FvH4_6g28410, FvH4_3g40570, FvH4_5g22390, FvH4_6g26800, FvH4_3g44420, FvH4_4g06180]" 0.467387431
00270 Cysteine and methionine metabolism 17 492 94 3857 0.083418875 1.417769417 "[FvH4_4g21340, FvH4_1g10540, FvH4_4g01140, FvH4_2g02530, FvH4_6g27650, FvH4_1g18690, FvH4_5g05120, FvH4_3g14020, FvH4_6g26610, FvH4_4g13980, FvH4_1g18490, FvH4_6g26600, FvH4_1g21920, FvH4_1g26460, FvH4_2g05040, FvH4_2g41260, FvH4_4g13280]" 0.654179598
04120 Ubiquitin mediated proteolysis 23 492 126 3857 0.04529262 1.431007227 "[FvH4_7g29370, FvH4_6g11010, FvH4_6g38720, FvH4_5g03910, FvH4_3g09200, FvH4_6g17370, FvH4_3g39370, FvH4_4g01260, FvH4_2g39250, FvH4_5g30320, FvH4_3g00910, FvH4_5g29350, FvH4_6g35920, FvH4_5g33030, FvH4_1g05910, FvH4_5g22570, FvH4_4g14790, FvH4_1g25030, FvH4_4g17530, FvH4_7g16630, FvH4_6g09540, FvH4_6g10930, FvH4_3g18500]" 0.674860033
00260 Glycine, serine and threonine metabolism 11 492 49 3857 0.0408107 1.759872242 "[FvH4_1g08890, FvH4_7g07540, FvH4_5g38450, FvH4_2g05310, FvH4_2g22570, FvH4_1g21920, FvH4_2g16830, FvH4_2g36660, FvH4_1g19090, FvH4_4g13290, FvH4_4g25490]" 0.675643816
00670 One carbon pool by folate 5 492 18 3857 0.069014744 2.177619693 "[FvH4_7g07540, FvH4_5g38450, FvH4_1g00040, FvH4_1g19090, FvH4_4g13290]" 0.685546458
03015 mRNA surveillance pathway 20 492 114 3857 0.082844862 1.375338753 "[FvH4_7g29390, FvH4_6g17300, FvH4_5g13570, FvH4_3g29340, FvH4_4g03530, FvH4_2g38640, FvH4_1g18700, FvH4_1g18000, FvH4_2g34040, FvH4_5g33710, FvH4_6g06810, FvH4_5g25490, FvH4_5g03260, FvH4_2g15670, FvH4_4g07000, FvH4_4g36800, FvH4_5g25550, FvH4_2g06580, FvH4_5g05510, FvH4_6g09230]" 0.685771358
00603 Glycosphingolipid biosynthesis - globo and isoglobo series 3 492 9 3857 0.096237762 2.613143631 "[FvH4_7g21240, FvH4_6g11740, FvH4_3g04760]" 0.71697133
00400 Phenylalanine, tyrosine and tryptophan biosynthesis 9 492 37 3857 0.038722924 1.906888596 "[FvH4_7g11530, FvH4_6g27650, FvH4_6g26610, FvH4_4g21980, FvH4_6g26600, FvH4_2g22570, FvH4_6g47770, FvH4_5g36810, FvH4_1g20450]" 0.721214462
00071 Fatty acid degradation 8 492 35 3857 0.068800169 1.791869919 "[FvH4_1g26810, FvH4_1g08890, FvH4_5g05130, FvH4_2g14760, FvH4_4g18500, FvH4_1g25230, FvH4_2g37760, FvH4_6g40560]" 0.732230372
04712 Circadian rhythm - plant 5 492 14 3857 0.024734738 2.799796748 "[FvH4_2g29440, FvH4_7g29370, FvH4_1g17250, FvH4_7g01160, FvH4_5g22570]" 0.737095202
03410 Base excision repair 8 492 34 3857 0.05939718 1.844571975 "[FvH4_4g29150, FvH4_4g36650, FvH4_2g21980, FvH4_6g11530, FvH4_2g39710, FvH4_4g35010, FvH4_2g40160, FvH4_4g35030]" 0.737514985
00130 Ubiquinone and other terpenoid-quinone biosynthesis 8 492 34 3857 0.05939718 1.844571975 "[FvH4_4g28800, FvH4_4g09340, FvH4_3g40570, FvH4_6g26610, FvH4_6g27940, FvH4_6g26600, FvH4_4g06180, FvH4_6g16460]" 0.737514985
00460 Cyanoamino acid metabolism 7 492 32 3857 0.103957465 1.714875508 "[FvH4_4g26180, FvH4_7g07540, FvH4_5g38450, FvH4_7g05220, FvH4_1g19090, FvH4_4g13290, FvH4_3g43510]" 0.737602967
00310 Lysine degradation 8 492 30 3857 0.030124137 2.090514905 "[FvH4_1g08890, FvH4_5g05130, FvH4_3g23070, FvH4_1g16260, FvH4_1g25230, FvH4_2g36660, FvH4_6g40560, FvH4_3g25420]" 0.748082742
00785 Lipoic acid metabolism 2 492 4 3857 0.081725815 3.919715447 "[FvH4_6g44960, FvH4_4g37350]" 0.761071655
00601 Glycosphingolipid biosynthesis - lacto and neolacto series 2 492 4 3857 0.081725815 3.919715447 "[FvH4_6g11740, FvH4_3g04760]" 0.761071655
00940 Phenylpropanoid biosynthesis 26 492 149 3857 0.056260767 1.367954384 "[FvH4_2g05780, FvH4_4g23870, FvH4_5g35170, FvH4_7g32980, FvH4_2g30540, FvH4_2g26620, FvH4_7g05220, FvH4_3g44420, FvH4_6g16060, FvH4_4g06180, FvH4_6g16460, FvH4_3g43510, FvH4_7g19130, FvH4_4g26180, FvH4_6g28410, FvH4_6g27940, FvH4_4g36130, FvH4_3g46010, FvH4_1g16790, FvH4_6g30610, FvH4_4g09340, FvH4_3g15230, FvH4_3g40570, FvH4_5g22390, FvH4_6g27610, FvH4_5g21320]" 0.762077663
00450 Selenocompound metabolism 4 492 15 3857 0.113762224 2.090514905 "[FvH4_2g38710, FvH4_7g04540, FvH4_6g24170, FvH4_2g41260]" 0.770480519
00563 Glycosylphosphatidylinositol(GPI)-anchor biosynthesis 3 492 13 3857 0.224775136 1.809099437 "[FvH4_5g04770, FvH4_2g15820, FvH4_1g19740]" 0.797416555
03008 Ribosome biogenesis in eukaryotes 6 492 33 3857 0.238324783 1.425351072 "[FvH4_1g27070, FvH4_1g17250, FvH4_1g16590, FvH4_2g38700, FvH4_3g27590, FvH4_1g22910]" 0.807054378
00860 Porphyrin and chlorophyll metabolism 8 492 47 3857 0.244407142 1.334371216 "[FvH4_3g20600, FvH4_5g33760, FvH4_7g25640, FvH4_2g27000, FvH4_3g20590, FvH4_1g04700, FvH4_2g23050, FvH4_4g37020]" 0.809259204
00053 Ascorbate and aldarate metabolism 8 492 47 3857 0.244407142 1.334371216 "[FvH4_1g08890, FvH4_5g05130, FvH4_3g33910, FvH4_6g20720, FvH4_7g08190, FvH4_7g13380, FvH4_1g25230, FvH4_5g20650]" 0.809259204
00944 Flavone and flavonol biosynthesis 2 492 5 3857 0.124932679 3.135772358 "[FvH4_6g17070, FvH4_5g14010]" 0.809346486
00040 Pentose and glucuronate interconversions 15 492 96 3857 0.236599083 1.224911077 "[FvH4_2g26010, FvH4_6g41430, FvH4_6g17310, FvH4_6g17430, FvH4_3g01680, FvH4_5g27090, FvH4_6g53340, FvH4_2g19540, FvH4_5g33570, FvH4_1g00260, FvH4_2g25970, FvH4_7g08190, FvH4_1g26360, FvH4_4g21500, FvH4_1g27720]" 0.819843336
03450 Non-homologous end-joining 2 492 7 3857 0.221439565 2.239837398 "[FvH4_4g35010, FvH4_4g35030]" 0.824862379
00942 Anthocyanin biosynthesis 2 492 7 3857 0.221439565 2.239837398 "[FvH4_3g19220, FvH4_7g33840]" 0.824862379
這是參考以下教程用自己的數(shù)據(jù)實(shí)現(xiàn)一遍,
R語言ggplot2畫圖系列——Pathway富集分析氣泡圖 - 生信技能樹 - Powered by Discuz! ;action=printabletid=927
R語言ggplot2繪圖教程——Pathway富集分析氣泡圖 - CSDN博客
數(shù)據(jù)準(zhǔn)備
氣泡圖(bubble plot):在二維散點(diǎn)圖的基礎(chǔ)上,用點(diǎn)的大小來代表第三個(gè)變量的值。
symbols()函數(shù)來創(chuàng)建氣泡圖。該函數(shù)可以在指定的(x, y)坐標(biāo)上繪制圓圈圖、方形圖、星形圖、溫度計(jì)圖和箱線圖。
symbols(x, y, circle=radius)
其中x、y和radius是需要設(shè)定的向量,分別表示x、y坐標(biāo)和圓圈半徑。
你可能想用面積而不是半徑來表示第三個(gè)變量,那么按照?qǐng)A圈半徑的公式(r = /πA )變換即可:
symbols(x, y, circle=sqrt(z/pi))
一般來說,統(tǒng)計(jì)人員使用R時(shí)都傾向于避免用氣泡圖,原因和避免使用餅圖一樣:相比對(duì)長(zhǎng)度的判斷,人們對(duì)體積/面積的判斷通常更困難。
參考資料:
前面我給大家詳細(xì)介紹過
?GO簡(jiǎn)介及GO富集結(jié)果解讀
?四種GO富集柱形圖、氣泡圖解讀
?GO富集分析四種風(fēng)格展示結(jié)果—柱形圖,氣泡圖
?KEGG富集分析—柱形圖,氣泡圖,通路圖
? DAVID GO和KEGG富集分析及結(jié)果可視化
也用視頻給大家介紹過
? GO和KEGG富集分析視頻講解
最近有粉絲反映說,利用clusterProfiler這個(gè)包繪制GO富集分析氣泡圖和柱形圖的時(shí)候,發(fā)現(xiàn)GO條目的名字都重疊在一起了。
氣泡圖
柱形圖
這個(gè)圖別說美觀了,簡(jiǎn)直不忍直視。經(jīng)過我的認(rèn)真研究,發(fā)現(xiàn)跟R版本有關(guān)。前面我給大家展示的基本都是R 3.6.3做出來的圖。很多粉絲可能用的都是最新版本的R 4.1.2。
我們知道R的版本在不停的更新,相應(yīng)的R包也在不停的更新。我把繪制氣泡圖和柱形圖相關(guān)的函數(shù)拿出來認(rèn)真的研究了一下,終于發(fā)現(xiàn)的癥結(jié)所在。
dotplot這個(gè)函數(shù),多了個(gè) label_format 參數(shù)
我們來看看這個(gè)參數(shù)究竟是干什么用的,看看參數(shù)說明
label_format :
a numeric value sets wrap length, alternatively a custom function to format axis labels. by default wraps names longer that 30 characters
原來這個(gè)參數(shù)默認(rèn)值是30,當(dāng)標(biāo)簽的長(zhǎng)度大于30個(gè)字符就會(huì)被折疊,用多行來展示。既然問題找到了,我們就來調(diào)節(jié)一下這個(gè)參數(shù),把他設(shè)置成100,讓我們的標(biāo)簽可以一行展示。
是不是還是原來的配方,還是熟悉的味道
同樣的柱形圖,我們也能讓他恢復(fù)原來的容貌。
關(guān)于如何使用R做GO和KEGG富集分析,可參考下文
GO和KEGG富集分析視頻講解