-
Notifications
You must be signed in to change notification settings - Fork 8
Expand file tree
/
Copy pathplot2DO_setup.R
More file actions
63 lines (56 loc) · 1.98 KB
/
plot2DO_setup.R
File metadata and controls
63 lines (56 loc) · 1.98 KB
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
# Libraries that are required:
# CRAN:
# c("colorRamps", "doParallel", "foreach", "ggplot2", "gridExtra", "optparse", "pracma", "reshape2", "yaml")
# Bioconductor:
# c("AnnotationHub", "biomaRt", "GenomicFeatures", "GenomicRanges", "GenomeInfoDb", "IRanges", "Rsamtools", "rtracklayer")
# R core libraries (do not need installation):
# c("grid", "parallel", "tools")
noError = TRUE
# Install CRAN packages
cat("Checking and installing missing CRAN packages:\n")
cranLibraries <- c("colorRamps", "doParallel", "foreach", "ggplot2", "gridExtra", "optparse", "pracma", "reshape2", "xml2", "yaml")
foo <- sapply(cranLibraries, function(x) {
if (requireNamespace(x, quietly = TRUE)){
result <- "was already available."
} else {
install.packages(x, repos="http://cloud.r-project.org")
success <- requireNamespace(x, quietly = TRUE)
if(success) {
result <- "was successfully installed."
} else {
result <- "error: not available and cannot install!"
noError = FALSE
}
}
cat(" >", paste(x, result, sep = "....."))
cat("\n")
})
# Install Bioconductor packages
cat("\n")
cat("Checking and installing missing Bioconductor packages:\n")
bioconductorLibraries <- c("AnnotationHub", "biomaRt", "GenomicFeatures", "GenomicRanges", "GenomeInfoDb", "IRanges", "Rsamtools", "rtracklayer")
if (!requireNamespace("BiocManager", quietly = TRUE)){
install.packages("BiocManager")
}
foo <- sapply(bioconductorLibraries, function(x) {
if (requireNamespace(x, quietly = TRUE)){
result <- "was already available."
} else {
BiocManager::install(x)
success <- requireNamespace(x, quietly = TRUE)
if(success) {
result <- "was successfully installed."
} else {
result <- "error: not available and cannot install!"
noError = FALSE
}
}
cat(" >", paste(x, result, sep = "....."))
cat("\n")
})
cat("\nDone!")
if (noError) {
cat(" All the required packages are available now.\n")
} else {
cat(" Error(s) found! See above.\n")
}