-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathpreinstall.R
More file actions
77 lines (66 loc) · 2.52 KB
/
preinstall.R
File metadata and controls
77 lines (66 loc) · 2.52 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
# Pre-installation script for Posit Connect
# This ensures all Bioconductor packages are properly installed
# Set up BiocManager
if (!requireNamespace("BiocManager", quietly = TRUE)) {
install.packages("BiocManager")
}
# Configure repositories
options(repos = BiocManager::repositories())
# Get the correct library path for packrat
lib_path <- .libPaths()[1]
message("Installing to library: ", lib_path)
# Force installation to the packrat library only
.libPaths(lib_path)
# Install dependencies directly from Bioconductor URLs
# This bypasses any system library issues
# S4Vectors 0.44.0
tryCatch({
install.packages("https://bioconductor.org/packages/3.20/bioc/src/contrib/S4Vectors_0.44.0.tar.gz",
repos = NULL,
type = "source",
lib = lib_path)
}, error = function(e) {
message("S4Vectors installation failed: ", e$message)
})
# IRanges
tryCatch({
install.packages("https://bioconductor.org/packages/3.20/bioc/src/contrib/IRanges_2.40.1.tar.gz",
repos = NULL,
type = "source",
lib = lib_path)
}, error = function(e) {
message("IRanges installation failed: ", e$message)
})
# XVector
tryCatch({
install.packages("https://bioconductor.org/packages/3.20/bioc/src/contrib/XVector_0.46.0.tar.gz",
repos = NULL,
type = "source",
lib = lib_path)
}, error = function(e) {
message("XVector installation failed: ", e$message)
})
# S4Arrays
tryCatch({
install.packages("https://bioconductor.org/packages/3.20/bioc/src/contrib/S4Arrays_1.6.0.tar.gz",
repos = NULL,
type = "source",
lib = lib_path)
}, error = function(e) {
message("S4Arrays installation failed: ", e$message)
})
# Set environment variable to use correct include paths
Sys.setenv(PKG_CPPFLAGS = paste0("-I'", file.path(lib_path, "S4Vectors/include"), "' ",
"-I'", file.path(lib_path, "IRanges/include"), "' ",
"-I'", file.path(lib_path, "XVector/include"), "'"))
# Now install SparseArray
tryCatch({
install.packages("https://bioconductor.org/packages/3.20/bioc/src/contrib/SparseArray_1.6.2.tar.gz",
repos = NULL,
type = "source",
lib = lib_path)
}, error = function(e) {
message("SparseArray installation failed: ", e$message)
# If it fails, try with BiocManager
BiocManager::install("SparseArray", lib = lib_path, force = TRUE)
})