forked from gagneurlab/FRASER
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsetupEnv.R
52 lines (44 loc) · 1.71 KB
/
setupEnv.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
BTYPE <- "both"
NCPUS <- 6
print_log <- function(...){
hash_line <- paste0(rep("#", 10), collapse="")
message(paste0("\n", hash_line, "\n### ", date(), ": ", ..., "\n", hash_line, "\n"))
}
installIfReq <- function(p, type=BTYPE, Ncpus=NCPUS, ...){
for(j in p){
if(!requireNamespace(j, quietly=TRUE)){
print_log("Install ", j)
INSTALL(j, type=type, Ncpus=Ncpus, ...)
}
}
}
if(!requireNamespace("BiocManager", quietly=TRUE)){
print_log("Install BiocManager")
install.packages("BiocManager", Ncpus=NCPUS)
}
INSTALL <- BiocManager::install
# because of https://github.com/r-windows/rtools-installer/issues/3
if("windows" == .Platform$OS.type){
print_log("Install XML on windows ...")
BTYPE <- "win.binary"
installIfReq(p=c("XML", "xml2", "RSQLite", "progress", "AnnotationDbi", "BiocCheck"))
print_log("Install source packages only for windows ...")
INSTALL(c("GenomeInfoDbData", "org.Hs.eg.db", "TxDb.Hsapiens.UCSC.hg19.knownGene"), type="both")
} else {
BTYPE <- "source"
}
# install needed packages
# add testthat to pre installation dependencies due to: https://github.com/r-lib/pkgload/issues/89
for(p in c("XML", "xml2", "testthat", "devtools", "covr", "roxygen2", "BiocCheck", "R.utils",
"GenomeInfoDbData", "rtracklayer", "hms")){
installIfReq(p=p, type=BTYPE, Ncpus=NCPUS)
}
# install package with its dependencies with a timeout due to travis 50 min
R.utils::withTimeout(timeout=2400, {
try({
print_log("Update packages")
INSTALL(ask=FALSE, type=BTYPE, Ncpus=NCPUS)
print_log("Install dev package")
devtools::install(".", dependencies=TRUE, upgrade=TRUE, type=BTYPE, Ncpus=NCPUS)
})
})