安装"DESeq2", "edgeR", "limma", "clusterProfiler"几个R包

安装"DESeq2", "edgeR", "limma", "clusterProfiler"

bioPackages=c("DESeq2", "edgeR", "limma", "clusterProfiler")
#设置镜像
local({
  r <- getOption( "repos" );
  r[ "CRAN" ] <- "https://mirrors.tuna.tsinghua.edu.cn/CRAN/";
  options( repos = r )
  BioC <- getOption( "BioC_mirror" );
  BioC[ "BioC_mirror" ] <- "https://mirrors.ustc.edu.cn/bioc/";
  options( BioC_mirror = BioC )
})

if (!requireNamespace("BiocManager", quietly = TRUE))
    install.packages("BiocManager")
lapply( bioPackages,
  function( bioPackage ){
    if( !require( bioPackage, character.only = T ) ){
      CRANpackages <- available.packages()
      if( bioPackage %in% rownames( CRANpackages) ){
        install.packages( bioPackage )
      }else{
        BiocManager::install( bioPackage, suppressUpdates = FALSE, ask = FALSE)
      }
    }
  }
)

转自:https://zhuanlan.zhihu.com/p/362312121

posted @ 2024-03-17 19:04  corrschi  阅读(432)  评论(0)    收藏  举报