-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathinstall_dependencies.R
52 lines (49 loc) · 1.6 KB
/
install_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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
#Universal Bioconductor package installation function
install.bioc <- function(pkg){
vers <- getRversion()
if (vers >= "3.6"){
if (!requireNamespace("BiocManager", quietly = TRUE)) {
install.packages("BiocManager")
}
BiocManager::install(pkg)
}else{
if (!requireNamespace("BiocInstaller", quietly = TRUE)){
source("https://bioconductor.org/biocLite.R")
biocLite(pkg, suppressUpdates=TRUE)
}else{
BiocInstaller::biocLite(pkg, suppressUpdates=TRUE)
}
}
}
#Install CRAN dependencies
cran_pkgs <- c(
"DT", "RColorBrewer", "V8", "cellranger", "devtools", "gProfileR", "ggplot2",
"ggplotify", "grid", "gridExtra", "gtable", "gtools", "igraph", "randomcoloR",
"readxl", "reshape", "scales", "shiny", "shinyBS", "shinycssloaders",
"shinyjs", "tibble", "tidyverse", "tidyverse", "xlsx"
)
cran_pkgs.inst <- cran_pkgs[!(cran_pkgs %in% rownames(installed.packages()))]
if(length(cran_pkgs.inst)>0){
print(paste0("Missing ", length(cran_pkgs.inst), " CRAN Packages:"))
for(pkg in cran_pkgs.inst){
print(paste0("Installing Package:'", pkg, "'..."))
install.packages(
pkg, repo="http://cran.rstudio.org", dependencies=TRUE
)
print("Installed!!!")
}
}
#Install Bioconductor dependencies
bioc_pkgs <- c(
"GOSim", "KEGG.db", "org.Hs.eg.db", "org.Mm.eg.db", "org.Rn.eg.db",
"reactome.db"
)
bioc_pkgs.inst <- bioc_pkgs[!(bioc_pkgs %in% rownames(installed.packages()))]
if(length(bioc_pkgs.inst)>0){
print(paste0("Missing ", length(bioc_pkgs.inst), " Bioconductor Packages:"))
for(pkg in bioc_pkgs.inst){
print(paste0("Installing Package:'", pkg, "'..."))
install.bioc(pkg)
print("Installed!!!")
}
}