-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinstall_packages.R
More file actions
87 lines (77 loc) · 2.54 KB
/
install_packages.R
File metadata and controls
87 lines (77 loc) · 2.54 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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
#!/usr/bin/env Rscript
# Installation script for Dengue Variant Tracker Dashboard
# Run this once to install all required R packages
cat("==========================================\n")
cat("Installing R Packages for Dengue Tracker\n")
cat("==========================================\n\n")
# Function to check and install packages
install_if_missing <- function(pkg, from = "CRAN") {
if (!require(pkg, character.only = TRUE, quietly = TRUE)) {
cat(sprintf("Installing %s from %s...\n", pkg, from))
if (from == "CRAN") {
install.packages(pkg, repos = "https://cloud.r-project.org/")
} else if (from == "Bioconductor") {
if (!require("BiocManager", quietly = TRUE)) {
install.packages("BiocManager", repos = "https://cloud.r-project.org/")
}
BiocManager::install(pkg, update = FALSE, ask = FALSE)
}
cat(sprintf("✓ %s installed successfully\n\n", pkg))
} else {
cat(sprintf("✓ %s already installed\n", pkg))
}
}
# Install CRAN packages
cat("\n[1/2] Installing CRAN packages...\n")
cat("------------------------------------\n")
cran_packages <- c(
"shiny",
"shinydashboard",
"ggplot2",
"dplyr",
"tidyr",
"plotly",
"DT"
)
for (pkg in cran_packages) {
install_if_missing(pkg, "CRAN")
}
# Install Bioconductor packages
cat("\n[2/2] Installing Bioconductor packages...\n")
cat("------------------------------------\n")
bioc_packages <- c(
"Biostrings",
"ShortRead",
"BSgenome"
)
for (pkg in bioc_packages) {
install_if_missing(pkg, "Bioconductor")
}
# Verify installation
cat("\n==========================================\n")
cat("Verifying Installation...\n")
cat("==========================================\n")
all_packages <- c(cran_packages, bioc_packages)
missing <- character(0)
for (pkg in all_packages) {
if (!require(pkg, character.only = TRUE, quietly = TRUE)) {
missing <- c(missing, pkg)
cat(sprintf("✗ %s - NOT FOUND\n", pkg))
} else {
cat(sprintf("✓ %s - OK\n", pkg))
}
}
cat("\n==========================================\n")
if (length(missing) == 0) {
cat("SUCCESS! All packages installed correctly.\n")
cat("\nNext steps:\n")
cat(" 1. Run: ./download_data.sh\n")
cat(" 2. Run: Rscript qc_analysis.R\n")
cat(" 3. Run: Rscript -e \"shiny::runApp('app.R')\"\n")
} else {
cat("WARNING: Some packages failed to install:\n")
cat(paste(" -", missing, collapse = "\n"))
cat("\n\nPlease install them manually:\n")
cat(" install.packages(c('", paste(missing, collapse = "', '"), "'))\n", sep = "")
}
cat("==========================================\n")