ggplot2绘制Pathway富集分析气泡图

>library(ggplot2) #载入ggplot2

>pathway=read.table("KEGG.enrichment.txt",,header=T,sep="\t") #读取数据

>pathway=head(read.table("KEGG.enrichment.result.txt",header=T,sep="\t"),n=20) #读取数据前20行

> p = ggplot(pathway,aes(enrichFactor,Term_Name)) #以富集因子和pathway名称为X轴和Y轴
+ geom_point(aes(size=GeneHitsInSelectedSet,color=-1*log10(Qvalue))) #点图大小和颜色数据
+scale_colour_gradient(low="green",high="red") #颜色变化
+labs(color=expression(-log10),size="Gene number",x="Rich factor",y="Pathway name",title="Top20 of pathway enrichment") #标签名称

> pr=pr+theme_bw()

> pr

ggplot2绘制Pathway富集分析气泡图_第1张图片
KEGG.enrichment.result.jpg

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

这是参考以下教程用自己的数据实现一遍,

R语言ggplot2画图系列——Pathway富集分析气泡图 - 生信技能树 - Powered by Discuz! http://www.biotrainee.com/forum.php?mod=viewthread&action=printable&tid=927

R语言ggplot2绘图教程——Pathway富集分析气泡图 - CSDN博客 http://blog.csdn.net/sinat_38163598/article/details/72827851

你可能感兴趣的:(ggplot2绘制Pathway富集分析气泡图)