1.R 中安装
>options(BioC_mirror="https://mirrors.tuna.tsinghua.edu.cn/bioconductor")
>options("repos" = c(CRAN="https://mirrors.tuna.tsinghua.edu.cn/CRAN/"))
>install.packages("BiocManager")
之后可以随意安装了R包了,依赖问题解决
#library('BiocManager')
library('BiocManager', quietly = TRUE)
BiocManager::install("***") ## ***为需要安装的包的名称
BiocManager::install(version="3.9") #更新自己
2.conda 安装环境
#创建
conda create -n Renv r-essentials r-base
#conda create -n Renv R r-biocmanager
#激活
conda activate Renv
#使用conda 安装BiocManager
conda install r-biocmanager
进入R 配置镜像
$R
#Bioconductor的国内源
>options(BioC_mirror="https://mirrors.tuna.tsinghua.edu.cn/bioconductor")
#基础R包的国内源
>options("repos" = c(CRAN="https://mirrors.tuna.tsinghua.edu.cn/CRAN/"))
#可以把上面两句加入到~/.Rprofile,这样R会在启动时自动配置
#载入BiocManager
>library('BiocManager')
#通过BiocManager的repositories()查看镜像是否配置成功
>repositories()
R 环境下 更新安装R包
>BiocManager::valid()
>update.packages(checkBuilt=TRUE, ask=FALSE)
安装常用的包
BiocManager::install("ggplot2")
BiocManager::install("gcookbook")
BiocManager::install(c("GSEABase","GSVA","clusterProfiler" ),ask = F,update = F)
BiocManager::install(c("GEOquery","limma","impute" ),ask = F,update = F)
BiocManager::install(c("org.Hs.eg.db","hgu133plus2.db" ),ask = F,update = F)
#配色包ggsci
BiocManager::install("ggsci")
#配色包ggtech
BiocManager::install("devtools")
BiocManager::install("curl")
#windows 用户自己手动下载安装Rtools
#[https://cran.r-project.org/bin/windows/Rtools/](https://cran.r-project.org/bin/windows/Rtools/)
devtools::install_github("ricardo-bion/ggtech", dependencies=TRUE)
#配色包RColorBrewe
BiocManager::install("RColorBrewer")
3.在基于cpu 的R多核notebook镜像中
source activate r3.6 #进入,安装R包
#安装BiocManager
$CONDA_DIR/envs/r3.6/bin/Rscript -e 'options(BioC_mirror="https://mirrors.tuna.tsinghua.edu.cn/bioconductor")' \-e 'options("repos" = c(CRAN="https://mirrors.tuna.tsinghua.edu.cn/CRAN/"))' \-e 'install.packages("BiocManager")'
#安装MAST
$CONDA_DIR/envs/r3.6/bin/Rscript -e 'options(repos="http://bioconductor.org/packages/MAST/")' \-e 'options("repos" = c(CRAN="https://mirrors.tuna.tsinghua.edu.cn/CRAN/"))' \-e 'library('BiocManager', quietly = TRUE)' \-e 'BiocManager::install("MAST")'