使用fgsea的包

Alexey Sergushichev

2016-06-22

fgsea是一个快速的R-package preranked基因集富集分析(GSEA)。性能是通过使用一个累积GSEA-statistic算法计算。这允许重用不同基因之间的样本大小。看到预印对算法的细节。

加载必要libraryries

快速运行

加载示例路径和能够统计数据:

数据(examplePathways)数据(exampleRanks)

fgsea:

fgseaRes < -fgsea(通路=examplePathways,统计=exampleRanks,minSize =15,最大尺寸=500年,nperm =10000年)

生成的表包含浓缩分数和假定值:

(fgseaRes [订单(pval)])
# #通路pval padj ES # # 1: 5990980 _cell_cycle 0.0001241157 0.001931221 0.5388497 # # 2: 5990979 _cell_cycle, _Mitotic 0.0001270810 0.001931221 0.5594755 # # 3: 5991210 _signaling_by_rho_gtpases 0.0001328904 0.001931221 0.4238512 # # 4: 5991454 _m_phase 0.0001379501 0.001931221 0.5576247 # # 5: 5991023 _metabolism_of_carbohydrates 0.0001393534 0.001931221 0.4944766 # # 6: 5991209 _rho_gtpase_effectors 0.0001396258 0.001931221 0.5248796 # # NES nMoreExtreme大小叶片# # 1:2.678919 0 369 66336,66977,12442,107995,66442,19361,# # 2:2.742692 0 317 66336,66977,12442,107995,66442,12571,# # 3:2.011171 0 231 66336,66977,20430,104215,233406,107995,# # 4:2.552523 0 173 66336,66977,12442,107995,66442,52276,# # 5:2.237706 0 160 11676,21991,15366,58250,12505,20527,# # 6:2.368627 0 157 66336,66977,20430,104215,233406,107995,

大约需要十秒钟后得到结果与重大打击罗斯福更正:

总和(fgseaRes [padj <0.01])
# # 76年[1]

一个可以使一个浓缩情节的途径:

plotEnrichment(examplePathways [[“5991130 _programmed_cell_death”]],exampleRanks) +实验室(title =“程序性细胞死亡”)

或者让一堆表情节选择途径:

topPathwaysUp < -fgseaRes[西文>0][(订单(pval),n =10topPathwaysDown < -),途径)fgseaRes[西文<0][(订单(pval),n =10topPathways < -),途径)c(topPathwaysUp牧师(topPathwaysDown))plotGseaTable(examplePathways [topPathways], exampleRanks fgseaRes,gseaParam =0.5)

性能考虑

请注意,fgsea功能需要O (nk ^ {3/2})时间,n排列和数量吗k是一个路径的最大大小。这意味着设置最大尺寸参数值的~ 500是强烈推荐。

同时,fgsea并行使用BiocParallel包中。默认第一个注册后端返回的bpparam ()使用。调整并行可以指定BPPARAM参数用于bclapply的设置nproc参数,这是一个缩写设置BPPARAM = MulticoreParam(工人= nproc)

使用Reactome通路

为了方便有reactomePathways函数获取途径从Reactome给定的一组基因。包reactome.db需要安装。

路径< -reactomePathways(的名字(exampleRanks)) fgseaRes < - - - - - -fgsea(exampleRanks通路nperm =1000年,最大尺寸=500年)(fgseaRes)
# #通路pval # # 1:白细胞介素- 6信号0.002040816 # # 2:细胞凋亡0.001557632 # # 3:止血0.006613757 # # 4:内在途径凋亡0.003521127 # # 5:乳沟的转录终止地区0.482014388 # # 6:PKB-mediated事件0.478417266 # # padj ES NES nMoreExtreme大小# # 1:0.03105125 -0.8129902 -1.8460927 0 6 # # 2:0.03105125 0.5237963 2.0569452 66 0 # # 3:0.06861772 0.2985258 1.4202376 257 # # 4:0.04764410 0.6872693 2.2375711 1 28 # # 5:0.78769211 -0.2451371 -0.9957147 200年44 # # 6:0.78458331 0.3248924 1.0119083 265 24 # #前缘# # 1:20848年,12402年,16195年,16194年# # 2:58801,14958,97165,22352,12043,14103,# # 3:71946,16184,14062,16185,22339,20720,# # 4:58801,12043,12367,14940,14942,12018,# # 5:54451,67337,66118,433702,54196,53817,# # 6:13685,66508,54170,105787,13631,11651,

从文件

也可以从之一.rnk.gmt在原始GSEA文件:

rnk。文件< -执行(“extdata”,“naive.vs.th1.rnk”,包=“fgsea”格林尼治时间)。文件< -执行(“extdata”,“mouse.reactome.gmt”,包=“fgsea”)

加载等级:

排名< -read.table(rnk.file头=真正的,colClasses =c(“性格”,“数字”)< -行列setNames(排名$ t,排名$ ID)str(排名)
# #叫num (1:12000) -63.3 -49.7 -43.6 -41.5 -33.3……# # - attr(*,“名字”)=(1:12000)从而向“170942”“109711”“18124”“12775”……

加载路径:

路径< -gmtPathways(gmt.file)str((途径)
# # 6 # # $ 1221633 _meiotic_synapsis:列表对应(1:64)“12189”“13006”“15077”“15078”……# # $ 1368092 _rora_activates_gene_expression:[1:9]从而向“11865”“12753”“12894”“18143”……# # $ 1368110 _bmal1:时钟,Npas2_activates_circadian_gene_expression:[1:16]从而向“11865”“11998”“12753”“12952”……# # $ 1445146 _translocation_of_glut4_to_the_plasma_membrane:科(55分)“11461”“11465”“11651”“11652”……# # 186574美元_endocrine-committed_ngn3 + _progenitor_cells:[1:4]从而向“18012”“18088”“18506”“53626”# # $ 186589 _late_stage_branching_morphogenesis_pancreatic_bud_precursor_cells:[1:4]从而向“11925”“15205”“21410”“246086”

和运行方式fgsea:

fgseaRes < -fgsea(通路、地位minSize =15,最大尺寸=500年,nperm =1000年)(fgseaRes)
# # 1 # #途径:1221633 _meiotic_synapsis # # 2: 1445146 _translocation_of_glut4_to_the_plasma_membrane # # 3: 442533 _transcriptional_regulation_of_adipocyte_differentiation_in_3t3-l1_pre-adipocytes # # 4: 508751 _circadian_clock # # 5: 5334727 _mus_musculus_biological_processes # # 6: 573389 _norc_negatively_regulates_rrna_expression # # pval padj ES NES nMoreExtreme大小# # 1:0.5361345 0.7124806 0.2885754 0.9355472 318 27 # # 2:0.6748366 0.8222483 0.2387284 0.8431415 412 39 # # 3:47 31 # # 4:0.1185185 0.2776338 -0.3640706 -1.3350019 0.7902946 0.8808833 0.2516324 0.7290777 455 17 # # 5:0.3795181 0.5866431 0.2469065 1.0477230 251 106 # # 6:0.4142114 0.6266551 0.3607407 1.0452072 238 17 # #前缘# # 1:15270年,12189年,71846年,19357年# # 2:17918,19341,20336,22628,22627,20619,# # 3:20602,327987,59024,67381,70208,12537,# # 4:20893年,59027年,19883年# # 5:60406,19361,15270,20893,12189,68240,# # 6:60406,20018,245688,20017