# #——消息= FALSE ------------------------------------------------------------ 库(fgsea)图书馆(data.table)图书馆(ggplot2) # #——回声= FALSE --------------------------------------------------------------- 库(BiocParallel) (SerialParam登记 ()) ## ----------------------------------------------------------------------------- 数据(examplePathways)数据(exampleRanks set.seed (42) ) ## ----------------------------------------------------------------------------- fgseaRes < -fgsea(通路= examplePathways统计= exampleRanks minSize = 15,最大尺寸= 500 ) ## ----------------------------------------------------------------------------- 头(fgseaRes [(pval秩序 ), ]) ## ----------------------------------------------------------------------------- fgseaRes < - fgsea(通路= examplePathways统计= exampleRanks eps = 0.0, minSize = 15,最大尺寸= 500)头(fgseaRes [(pval秩序 ), ]) ## ---- fig.width = 7,fig.height = 4 ----------------------------------------------- plotEnrichment (examplePathways[[“5991130 _programmed_cell_death”]],exampleRanks) +实验室(title =“程序性细胞死亡 ") ## ---- fig.width = 7, fig.height = 8, fig.retina = 2 --------------------------------- topPathwaysUp < - fgseaRes[西文> 0][头(订单(pval), n = 10),途径]topPathwaysDown < - fgseaRes[西文< 0][头(订单(pval), n = 10),途径]topPathways < - c (topPathwaysUp,牧师(topPathwaysDown)) plotGseaTable (examplePathways [topPathways],exampleeranks, fgseaRes, gseaParam=0.5) ## ---- fig.width=7, fig.height=8, fig.retina=2, warning=FALSE------------------ collapsedPathways <- collapsePathways(fgseaRes[order(pval)][padj < 0.01], examplePathways, exampleRanks) mainPathways <- fgseaRes[pathway %in% collapsedPathways$mainPathways][order(- nes), pathway] plotGseaTable(examplePathways[mainPathways], exampleRanks, fgseaRes,gseaParam = 0.5) # #——消息= FALSE ------------------------------------------------------------ 写入文件(fgseaRes文件= " fgseaRes.txt ", 9 =“t \”,sep2 = c ("", " ", "")) ## ---- 消息= FALSE ------------------------------------------------------------ 库(org.Mm.eg.db) fgseaResMain < - fgseaRes[匹配(mainPathways通路)]fgseaResMain[叶片:= mapIdsList (x = org.Mm.eg.db,键=前缘,keytype =“ENTREZID”,列=“象征”))写入文件(fgseaResMain文件=“fgseaResMain.txt”,9 =“t \”,sep2 = c ("", " ", "")) ## ---- 消息= FALSE,警告= FALSE --------------------------------------------- 路径< - reactomePathways(名字(exampleRanks) fgseaRes < - fgsea(通道,exampleRanks,最大尺寸= 500)头(fgseaRes ) ## ----------------------------------------------------------------------------- rnk。文件<- system。文件(“extdata”、“naive.vs.th1。Rnk ", package="fgsea")。文件<- system。文件(“extdata”、“mouse.reactome。格林尼治时间”,包= " fgsea ") ## ----------------------------------------------------------------------------- < - read.table (rnk行列。文件、头= TRUE colClasses = c(“性格”、“数字”))排名< - setNames(排名$ t,排名$ ID) str(排名 ) ## ----------------------------------------------------------------------------- 路径< - gmtPathways (gmt.file) str(头(通路 )) ## ---- 警告= FALSE ------------------------------------------------------------ fgseaRes < - fgsea(通路、地位minSize = 15,最大尺寸= 500)头(fgseaRes)