-
Notifications
You must be signed in to change notification settings - Fork 3
/
install_r_dependencies.R
37 lines (31 loc) · 1.04 KB
/
install_r_dependencies.R
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#!/usr/bin/env Rscript
# Objective : Install R dependencies for Baltica analysis
# Created by: tbrittoborges
# Created on: 19.05.20
# Based on: https://github.com/dieterich-lab/circtools/blob/master/scripts/install_R_dependencies.R
args <- commandArgs(trailingOnly = TRUE)
cran <- "https://cran.uni-muenster.de/"
if (!is.na(args[1])){
cran <- args[1]
}
options(
repos = c(CRAN = cran))
Sys.setenv(R_INSTALL_STAGED = FALSE) # requires 3.6
install_many <- function (pkgs, install_fun, ...){
pkgs <- pkgs[!pkgs %in% installed.packages()[,1L]]
if (length(pkgs) > 0L)
install_fun(pkgs, quietly = TRUE, ...)
}
pkgs.cran <- c(
"UpSetR", "dplyr", "openxlsx", "optparse", "stringr", "tidyr", "readr", "here"
)
# First install packages from CRAN
install_many(pkgs.cran, install.packages)
# Next, packages from bioconductor
if (!requireNamespace("BiocManager", quietly = TRUE))
install.packages("BiocManager")
BiocManager::install(version = "3.10")
pkgs.bioc <- c(
"GenomicRanges", "Rsamtools", "yaml"
)
install_many(pkgs.bioc, BiocManager::install)