Skip to content

2. Installation

wguo-research edited this page Dec 11, 2020 · 17 revisions

System Requirements

  • R version: >= 3.5.0 (suggest: R 3.6, not 4.0)
  • Hint: For R (version>=4.0) under Windows system, the Rtools needs to be updated to version 4.0 from https://cran.r-project.org/bin/windows/Rtools/. So, if you are not familiar with R environment configuration, we don't suggest to use R (>=4.0).

Installation

  • Some dependent packages on GitHub may not be able to install automatically, so we provide the following codes to install them by source packages.
  • Any questions about installation, please contact the author.
## 0.check whether the package is installed
checkPkg <- function(pkg){
    return(requireNamespace(pkg, quietly = TRUE))
}
## 1.install some basic packages
if(!checkPkg("BiocManager")) install.packages("BiocManager")
if(!checkPkg("pkgbuild")) install.packages("pkgbuild")
if(!checkPkg("Seurat")) install.packages("Seurat")
# if(!checkPkg("devtools")) install.packages("devtools")
## 2.install NNLM and the packages on GitHub
library(pkgbuild)
install_zip <- function(file, args = "--no-build-vignettes") {
    dir <- tempfile()
    utils::unzip(file, exdir=dir)
    fs <- list.files(path=dir, full.names=T)
    if (length(fs) == 1 && dir.exists(fs)) {
        dir <- fs
    }
    pkg <- pkgbuild::build(dir, args=args)
    install.packages(pkg)
}
install_tmp <- function(pk.name, link){
    f <- tempfile(fileext=".zip")
    method <- ifelse(.Platform$OS.type == "windows", "curl", "auto")
    download.file(paste0(link, pk.name, "-master.zip"), destfile = f, method = method)
    # file.copy(paste0(link, pk.name, "-master.zip"), f, overwrite = T)
    install_zip(f, args="--no-build-vignettes")
}

link <- "http://lifeome.net/software/sccancer/packages/"

### for harmony
if(!checkPkg("SingleCellExperiment")) BiocManager::install("SingleCellExperiment")
if(!checkPkg("harmony")) install_tmp("harmony", link)

### for NNLM
if(!checkPkg("RcppArmadillo")) install.packages("RcppArmadillo")
if(!checkPkg("RcppProgress")) install.packages("RcppProgress")
if(!checkPkg("NNLM")) install.packages(paste0(link, 'NNLM_0.4.3.tar.gz'), repos = NULL, type = 'source')

### for liger
if(!checkPkg("riverplot")) install.packages("riverplot")
if(!checkPkg("Hmisc")) install.packages("Hmisc")
if(!checkPkg("foreach")) install.packages("foreach")
if(!checkPkg("doSNOW")) install.packages("doSNOW")
if(!checkPkg("mclust")) install.packages("mclust")
if(!checkPkg("psych")) install.packages("psych")
if(!checkPkg("liger")) install_tmp("liger", link)

### for scCancer
if(!checkPkg("ggExtra")) install.packages("ggExtra")
if(!checkPkg("pheatmap")) install.packages("pheatmap")
if(!checkPkg("survminer")) install.packages("survminer")
if(!checkPkg("SoupX")) install.packages("SoupX")
if(!checkPkg("GSVA")) BiocManager::install("GSVA")
if(!checkPkg("scds")) BiocManager::install("scds")
if(!checkPkg("scCancer")) install_tmp("scCancer", link)
Clone this wiki locally