-
Notifications
You must be signed in to change notification settings - Fork 41
/
URD-Install.R
44 lines (40 loc) · 2.05 KB
/
URD-Install.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
# Install Bioconductor requirements: Biobase, S4Vectors, AnnotationDbi, destiny
# Needs to check R version because installation method changed between R 3.4 and 3.5
if (as.numeric(R.version$major) <= 3 && as.numeric(R.version$minor) < 5) {
# R < 3.5
message("Loading Bioconductor (biocLite) to install required packages.")
source("https://bioconductor.org/biocLite.R")
message("Installing required packages from Bioconductor.")
biocLite(c('Biobase', 'S4Vectors', 'AnnotationDbi', 'destiny'), suppressUpdates=T)
} else {
# R >= 3.5
if (!requireNamespace("BiocManager", quietly = TRUE)) {
message("Installing biocManager to install required Bioconductor packages.")
install.packages("BiocManager")
}
message("Installing required packages from Bioconductor (BiocManager).")
BiocManager::install(c('Biobase', 'S4Vectors', 'AnnotationDbi', 'destiny'), suppressUpdates=T)
}
# Check that Bioconductor installation went smoothly.
if (!requireNamespace("Biobase", quietly = TRUE)) {stop("Failed to install required package 'Biobase' from Bioconductor.")}
if (!requireNamespace("S4Vectors", quietly = TRUE)) {stop("Failed to install required package 'S4Vectors' from Bioconductor.")}
if (!requireNamespace("AnnotationDbi", quietly = TRUE)) {stop("Failed to install required package 'AnnotationDbi' from Bioconductor.")}
if (!requireNamespace("destiny", quietly = TRUE)) {stop("Failed to install required package 'destiny' from Bioconductor.")}
# Install URD (and devtools, if necessary)
if (requireNamespace("devtools", quietly = TRUE)) {
message("Installing URD")
devtools::install_github(repo="farrellja/URD")
} else {
message("Installing devtools")
install.packages("devtools")
message("Installing URD")
devtools::install_github(repo="farrellja/URD")
}
# Check that URD installed.
if (requireNamespace("URD", quietly = TRUE)) {
message("URD installed successfully!")
message('You can load it by typing: library("URD")')
message('Try "?URD" for starting tips.')
} else {
message("Something went wrong. It doesn't seem that URD installed correctly.")
}