-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathload_package.R
More file actions
96 lines (86 loc) · 1.91 KB
/
Copy pathload_package.R
File metadata and controls
96 lines (86 loc) · 1.91 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
88
89
90
91
92
93
94
95
96
## load_package.R
## Install and load packages used across the simulation, HNSC, and ADNI scripts.
cran_pkgs <- c(
"dplyr",
"tidyr",
"ggplot2",
"ggrepel",
"patchwork",
"cowplot",
"survival",
"survminer",
"glmnet",
"openxlsx",
"mclust",
"magick",
"ggvenn",
"remotes",
"readr",
"readxl",
"SNFtool",
"RGCCA",
"IntNMF",
"OmicsPLS",
"InterSIM",
"msigdbr"
)
bioc_pkgs <- c(
"SummarizedExperiment",
"TCGAbiolinks",
"cBioPortalData",
"MOFA2",
"iClusterPlus",
"r.jive",
"minfi",
"sesame",
"missMethyl",
"GSVA",
"clusterProfiler",
"org.Hs.eg.db",
"reactome.db",
"multiMiR",
"miRBaseConverter",
"IlluminaHumanMethylationEPICmanifest",
"IlluminaHumanMethylationEPICanno.ilm10b4.hg19",
"IlluminaHumanMethylation450kanno.ilmn12.hg19",
"estimate"
)
install_if_missing <- function(pkgs, installer) {
missing_pkgs <- pkgs[!vapply(pkgs, requireNamespace, logical(1), quietly = TRUE)]
if (length(missing_pkgs)) {
installer(missing_pkgs)
}
}
install_if_missing(
cran_pkgs,
function(pkgs) install.packages(pkgs, repos = "https://cloud.r-project.org")
)
if (!requireNamespace("BiocManager", quietly = TRUE)) {
install.packages("BiocManager", repos = "https://cloud.r-project.org")
}
install_if_missing(
bioc_pkgs,
function(pkgs) BiocManager::install(pkgs, ask = FALSE, update = FALSE)
)
if (!requireNamespace("multiRF", quietly = TRUE)) {
remotes::install_github("novawz/multiRF")
}
optional_github_pkgs <- list(
xCell = "dviraran/xCell"
)
for (pkg in names(optional_github_pkgs)) {
if (!requireNamespace(pkg, quietly = TRUE)) {
message(
sprintf(
"Optional package '%s' is not installed. If you need the related analyses, install it with remotes::install_github('%s').",
pkg,
optional_github_pkgs[[pkg]]
)
)
}
}
invisible(lapply(
c("dplyr", "tidyr", "ggplot2", "survival"),
require,
character.only = TRUE
))