点击查看代码
x = list()
p = list()
  outdir = paste0(getwd(),'/8.metabolites.connect.enrichment')
    if(dir.exists(outdir)){
      print("dir exists")
    }else{
      dir.create(outdir)
    }

for (i in c(2:length(each))){
      x[[i]] = enricher(final[[i]], TERM2GENE=disease2gene, TERM2NAME=disease2name)
     write.csv(x[[i]]@result,file = paste0(outdir,'/',colnames(df)[i],'.enrichment.csv'))
    tryCatch({
        p[[i]] = dotplot(x[[i]])
        ggsave(p[[i]],file = paste0(outdir,'/',colnames(df)[i],'.pdf'))
        }, error = function(e) {
        print('chucuop')
        },finally = {
        next

        })
}
posted on 2023-10-12 18:03  Bonjour_!  阅读(39)  评论(0编辑  收藏  举报