在Ubuntu下安装旧版seurat
演示如何配置单细胞数据处理环境。
先准备Ubuntu系统
这里首推华为云:https://www.huaweicloud.com/pricing.html#/ecs
可以和其它按需购买的云服务对比:
https://www.amazonaws.cn/ec2/pricing/ec2-linux-pricing/ (亚马逊中国,aws)
https://buy.cloud.tencent.com/price/cvm#tab0-list1 (腾讯云服务器)
https://cn.aliyun.com/price/product#/ecs/detail (阿里云服务器)
https://cloud.google.com/compute/pricing?hl=zh-CN (谷歌云服务器)
其它,美团云,百度云等等就不一一展示
安装R语言
假如系统R版本不够,就需要升
# 首先删除系统自带旧版本的R
sudo apt-get --purge remove r-base r-base-core r-base-dev
sudo apt-get --purge remove r-base-core
sudo apt-get --purge remove r-base-dev
# sudo apt-get remove -y 'r-cran-*'
# apt-get remove 会删除软件包而保留软件的配置文件r
# apt-get purge 会同时清除软件包和软件的配置文件
#然后更新Ubuntu源文件
## 这里,不同Ubuntu系统有点不一样:
cat /etc/issue
# 18.04
# 使用VIM添加下面代码到/etc/apt/sources.list文件
# deb https://cloud.r-project.org/bin/linux/ubuntu bionic-cran35/
sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys E084DAB9
sudo apt-get update
sudo apt-get install -y r-base r-base-core r-base-dev
安装shiny-server及Rstudio-server
https://www.rstudio.com/products/shiny/shiny-server/
https://www.rstudio.com/products/rstudio/download-server/
sudo su - \
-c "R -e \"install.packages('shiny', repos='https://mirrors.tuna.tsinghua.edu.cn/CRAN/')\""
sudo apt-get install gdebi-core
wget https://download3.rstudio.org/ubuntu-14.04/x86_64/shiny-server-1.5.9.923-amd64.deb
sudo gdebi shiny-server-1.5.9.923-amd64.deb
wget https://download2.rstudio.org/server/trusty/amd64/rstudio-server-1.2.1335-amd64.deb
sudo gdebi rstudio-server-1.2.1335-amd64.deb
这样的话 http://139.9.249.168:3838/ 和 http://139.9.249.168:8787 就是可以访问的啦,不过在华为云上需要开通指定的端口。
安装旧版seurat的依赖包
如何知道旧版seurat的依赖包呢?先运行:
packageurl <- "https://cran.r-project.org/src/contrib/Archive/Seurat/Seurat_2.3.4.tar.gz"
packageurl
install.packages(packageurl, repos=NULL, type="source")
看报错,找到依赖包:
options()$repos
options()$BioC_mirror
options(BioC_mirror="https://mirrors.ustc.edu.cn/bioc/")
options("repos" = c(CRAN="https://mirrors.tuna.tsinghua.edu.cn/CRAN/"))
options()$repos
options()$BioC_mirror
# https://bioconductor.org/packages/release/bioc/html/GEOquery.html
if (!requireNamespace("BiocManager", quietly = TRUE))
install.packages("BiocManager")
pkgs=c("ggplot2", "cowplot", "ROCR", "mixtools", "lars", "ica", "tsne", "Rtsne", "fpc", "ape", "pbapply", "igraph", "RANN", "dplyr", "RColorBrewer", "irlba", "reshape2", "gplots", "dtw", "SDMTools", "plotly", "Hmisc", "httr", "tidyr", "ggridges", "metap", "lmtest", "fitdistrplus", "png", "doSNOW", "reticulate", "foreach", "hdf5r", "RcppEigen", "RcppProgress")
BiocManager::install(pkgs,ask = F,update = F)
依赖包并不是一帆风顺的,因为Ubuntu系统缺库:
sudo apt-get -y install libcurl4-gnutls-dev libxml2-dev libssl-dev subversion scons libfuse-dev gcc
sudo apt-get -y install libmariadb-client-lgpl-dev libcurl4-openssl-dev libudunits2-dev
安装好必备库之后,再安装R包:
pkgs=c('curl','openssl','hdf5r','httr','plotly')
BiocManager::install(pkgs,ask = F,update = F)
关于hdf5r的失败
谷歌没有找到答案,重新看日志,同样是缺库:
sudo apt-get install libhdf5-dev
再次安装hdf5r就可以成功。
pkgs='hdf5r'
BiocManager::install(pkgs,ask = F,update = F)
最后成功安装旧版seurat
packageurl <- "https://cran.r-project.org/src/contrib/Archive/Seurat/Seurat_2.3.4.tar.gz"
packageurl
install.packages(packageurl, repos=NULL, type="source")
■ ■ ■