单细胞分析环境搭建(三)

导读

本文将介绍并实战搭建分析单细胞的环境。

1. R

  • R语言安装(Ubuntu

在命令行运行下面的命令,如果是root帐号,请去除sudo,其他系统参考 > Install R

# update indices
sudo apt update -qq

# install two helper packages we need
sudo apt install --no-install-recommends software-properties-common dirmngr

# add the signing key (by Michael Rutter) for these repos
# To verify key, run gpg --show-keys /etc/apt/trusted.gpg.d/cran_ubuntu_key.asc 
# Fingerprint: E298A3A825C0D65DFD57CBB651716619E084DAB9
wget -qO- https://cloud.r-project.org/bin/linux/ubuntu/marutter_pubkey.asc | sudo tee -a /etc/apt/trusted.gpg.d/cran_ubuntu_key.asc

# add the R 4.0 repo from CRAN -- adjust 'focal' to 'groovy' or 'bionic' as needed
sudo add-apt-repository "deb https://cloud.r-project.org/bin/linux/ubuntu $(lsb_release -cs)-cran40/"

# 安装
sudo apt install --no-install-recommends r-base

2. RStudio

  • RStudio安装
  1. 下载安装包 > Download
  2. 安装
# 根据自己下载的版本,修改文件名
sudo apt install ./rstudio-*-amd64.deb
  1. 打开RStudio

  1. 更换下载镜像

参考 > RStudio换源

3. Rpackages

  • R包安装
  1. 按照BiocManager
# 在 RStudio 中的 Console 中输入下面命令
install.packages("BiocManager")
  1. 修改Bioconductor
# 在 RStudio 中的 Console 中输入下面命令
chooseBioCmirror()

# 选择 China

chooseBioCmirror

  1. Bioconductor中安装以下 包

注意1:当 (”R may ask you if you want to update any old packages by asking Update all/some/none? [a/s/n]”)请输入a, 并回车。

注意2:当(“Do you want to install from sources the package which needs compilation? y/n”)请输入n, 并回车。

# 在 RStudio 中的 Console 中输入下面命令
# 建议复制,因为大小写敏感
BiocManager::install("SingleCellExperiment")
BiocManager::install("AnnotationHub")
BiocManager::install("ensembldb")
BiocManager::install("multtest")
BiocManager::install("glmGamPoi")
  1. CRAN中安装以下 包
# 在 RStudio 中的 Console 中输入下面命令
# 建议复制,因为大小写敏感
install.packages("tidyverse")
install.packages("Matrix")
install.packages("RCurl")
install.packages("scales")
install.packages("cowplot")
install.packages("Seurat")
install.packages("metap")
  1. 加载 包
# 加载前,请确保上面包安装过程是成功的
library(Seurat)
library(tidyverse)
library(Matrix)
library(RCurl)
library(scales)
library(cowplot)
library(SingleCellExperiment)
library(AnnotationHub)
library(ensembldb)
  1. 加载完毕后,运行sessionInfo()
sessionInfo()

本文由mdnice多平台发布

posted @ 2022-10-31 22:23  数据科学工厂  阅读(93)  评论(0编辑  收藏  举报