-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinstall_libraries.R
209 lines (197 loc) · 5.17 KB
/
install_libraries.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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
#SET THE NUMBER OF CPUs TO USE FOR PACKAGE INSTALLATION
cpus=8
# Step 0: setup environmental values. ####
#0.1 Set CRAN mirror: This is required if you want to run the script in the CMD/terminal with Rscript, instead of R-studio
local({r <- getOption("repos")
r["CRAN"] <- "http://cran.r-project.org"
options(repos=r)
})
#0.2 Set number of cpus for compilation. This uses the 'cpus' variable defined above
local({options(Ncpus=cpus)})
# Step 1: check if RCurl remotes, devtools, BiocManager and reticulate are available. If not, install them, and load them with require ####
if ("RCurl" %in% rownames(installed.packages()))
{
print(sprintf("RCurl is already installed."))
} else {
install.packages("RCurl")
}
if("remotes" %in% rownames(installed.packages()))
{
require(remotes)
} else {
install.packages("remotes")
require(remotes)
}
if("devtools" %in% rownames(installed.packages()))
{
require(devtools)
} else {
install.packages("devtools")
require(devtools)
}
if("BiocManager" %in% rownames(installed.packages()))
{
require(BiocManager)
} else {
install.packages("BiocManager")
require(BiocManager)
}
if("reticulate" %in% rownames(installed.packages()))
{
require(BiocManager)
} else {
install.packages("reticulate")
require(reticulate)
}
# Step 2: Check and install (if required) standard libraries (i.e. libraries that can be installed through CRAN without any other dependencies) ####
libraries_CRAN <- c(
"shiny",
"shinyjs",
"shinydashboard",
"shinycssloaders",
"shinyalert",
"bsplus",
"tidyverse",
"DT",
"ggplot2",
"ggpubr",
"plotly",
"igraph",
"rgl",
"RColorBrewer",
"colorspace",
"dplyr",
"visNetwork",
"gprofiler2",
"heatmaply",
"Seurat",
"SeuratObject",
"readr",
"stringr",
"pheatmap",
"hdf5r",
"missMDA",
"dismo"
)
for (i in 1:length(libraries_CRAN))
{
if (libraries_CRAN[i] %in% rownames(installed.packages()))
{
print(sprintf("%s is already installed.", libraries_CRAN[i]))
}
else
{
install.packages(libraries_CRAN[i])
}
}
# Step 3: Check and install (if required) libraries that need to be installed from GitHub with remotes or devtools ####
if("chromVARmotifs" %in% rownames(installed.packages()))
{
print("chromVARmotifs is installed")
} else {
devtools::install_github("GreenleafLab/chromVARmotifs", upgrade = c("never"))
}
if("SCopeLoomR" %in% rownames(installed.packages()))
{
print("SCopeLoomR is installed")
} else {
devtools::install_github("aertslab/SCopeLoomR", upgrade=c("never"))
}
if("CIPR" %in% rownames(installed.packages()))
{
print("CIPR is installed")
} else {
devtools::install_github("atakanekiz/CIPR-Package", build_vignettes = F, upgrade=c("never"))
}
if("mrlMBO" %in% rownames(installed.packages()))
{
print("mrlMBO is installed")
} else {
remotes::install_github("mlr-org/mlrMBO", upgrade=c("never"))
}
if("nichenetr" %in% rownames(installed.packages()))
{
print("nichenetr is installed")
} else {
devtools::install_github("saeyslab/nichenetr", build_vignettes = F, upgrade=c("never"))
}
if("destiny" %in% rownames(installed.packages()))
{
print("destiny is installed")
} else {
remotes::install_github("theislab/destiny", upgrade=c("never"))
}
if("UCell" %in% rownames(installed.packages()))
{
print("UCell is installed")
} else {
remotes::install_github("carmonalab/UCell", upgrade=c("never"))
}
#
# Step 4: Check and install (if required) libraries from BioConductor through BiocManager
libraries_bioconductor <- c(
"DirichletMultinomial",
"TFBSTools",
"motifmatchr",
"limma",
"AUCell",
"RcisTarget",
"GENIE3",
"GSEABase",
"RcisTarget",
"dittoSeq",
"slingshot",
"JASPAR2020",
"JASPAR2018",
"JASPAR2016",
"MAST",
"BSgenome.Mmusculus.UCSC.mm9",
"BSgenome.Mmusculus.UCSC.mm10",
"BSgenome.Hsapiens.UCSC.hg19",
"BSgenome.Hsapiens.UCSC.hg38"
)
for (i in 1:length(libraries_bioconductor))
{
if (libraries_bioconductor[i] %in% rownames(installed.packages()))
{
print(sprintf("%s is already installed.", libraries_bioconductor[i]))
}
else
{
BiocManager::install(libraries_bioconductor[i], update=F)
}
}
# Step 5: Install ArchR, SCENIC and other very specific ones ####
# 5.1 SCENIC ####
if("SCENIC" %in% rownames(installed.packages()))
{
print("SCENIC is installed")
} else {
bmv = BiocManager::version() #first, get the bioconductor version
#if bioconductor 4 or newer
if(unlist(bmv)[1] >= 4)
{
devtools::install_github("aertslab/SCENIC", upgrade = c("never"))
}
else
{
devtools::install_github("aertslab/[email protected]", upgrade = c("never"))
}
}
# 5.2 PhateR
if("PhateR" %in% rownames(installed.packages()))
{
print("PhateR is installed")
} else {
#reticulate::py_install("phate", pip=TRUE) #uncomment this if you don't already have phate installed
devtools::install_github("KrishnaswamyLab/phateR", upgrade=c("never"))
devtools::install_github("scottgigante/seurat", ref="patch/add-PHATE-again", upgrade=c("never"))
}
# 5.3 ArchR ####
if("ArchR" %in% rownames(installed.packages()))
{
print("ArchR is installed")
} else { devtools::install_github("GreenleafLab/ArchR", ref="master", repos = BiocManager::repositories(), upgrade = c("never"))
library(ArchR)
ArchR::installExtraPackages()
}