-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathrequirements.R
46 lines (38 loc) · 1.22 KB
/
requirements.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
38
39
40
41
42
43
44
45
46
# Require R 3.3, don't forget to update Bioconductor as well when updating R.
stopifnot(version['major'] == '3')
stopifnot(substr(version['minor'], 1, 1) == '3')
cran_requirements = c(
'tidyverse',
'optparse',
'devtools',
'ggplot2',
'ncdf4')
bioc_requirements = c(
'edgeR',
'limma')
github_requirements = c(
ggsea='NKI-CCB/ggsea'
)
# Installation script #
to_install_cran = setdiff(cran_requirements, installed.packages()[,1])
if (length(to_install_cran) > 0) {
r <- getOption("repos")
r["CRAN"] <- "https://cloud.r-project.org/"
options(repos=r)
install.packages(to_install_cran)
}
to_install_bioc = setdiff(bioc_requirements, installed.packages()[,1])
if (length(to_install_bioc) > 0) {
if (!(requireNamespace('BiocInstaller'))) {
install.packages('BiocInstaller',
repo='https://bioconductor.org/packages/3.4/bioc/')
loadNamespace('BiocInstaller')
}
BiocInstaller::biocLite(to_install_bioc)
}
to_install_github = setdiff(names(github_requirements),
installed.packages()[,1])
if (length(to_install_github) > 0) {
loadNamespace('devtools')
devtools::install_github(github_requirements[to_install_github])
}