20260610 重建R环境
conda remove -n R4 --all
rm -rf ~/miniconda3/env/R4
conda clean --all
# create R env & install
conda create -n R4 r-base=4.3 python=3.10 r-seurat
# config repos
vim ~/.Rprofile
# add info
# options("repos" = c(CRAN="https://mirror.nju.edu.cn/CRAN/"))
# options(BioC_mirror="https://mirrors.ustc.edu.cn/bioc/") ##指定镜像,这个是中国科技大学镜像
# options("repos" = c(CRAN="https://mirrors.tuna.tsinghua.edu.cn/CRAN/")) ##指定install.packages安装镜像,这个是清华镜像
options("repos" = c(CRAN="https://mirrors.aliyun.com/CRAN/"))
.First <- function() {
autoloads <- c("ggplot2", "reshape2", "pheatmap")
options(defaultPackages = c(getOption("defaultPackages"), autoloads))
}
# install others packages
if (!require("BiocManager", quietly = TRUE))
install.packages("BiocManager")
# 其中有几个包每次安装都很蛋疼:Matrix,Curl ... 其中创建环境时已经安装 curl-7.88
install.packages(c("ggplot2","reshape2","pheatmap"))
# 蛋疼,Matrxi,curl,SeuratObject,Seurat就是版本不能愉快的兼容
# 安装 remotes(如果还没有),这样就可以安装指定版本的某些包了
if (!require("remotes")) install.packages("remotes")
remotes::install_version("Matrix", version = "1.6-4")
install.packages(c("SeuratObject","Seurat"))