From 16e457aebd6ef6a5afa4c23d9e8536df3a3cc5aa Mon Sep 17 00:00:00 2001 From: Joshua Shapiro Date: Fri, 5 Jun 2026 15:29:41 -0400 Subject: [PATCH 1/4] Add script to patch RStudio in Docker --- Dockerfile | 4 ++++ scripts/patch-rstudio.sh | 36 ++++++++++++++++++++++++++++++++++++ 2 files changed, 40 insertions(+) create mode 100644 scripts/patch-rstudio.sh diff --git a/Dockerfile b/Dockerfile index 9ea9cdc85..a17f89835 100644 --- a/Dockerfile +++ b/Dockerfile @@ -129,5 +129,9 @@ RUN python3 ${template_dir}/scripts/setup-skel.py \ --skel-dir /etc/skel \ --module-file ${template_dir}/current-modules.json +# patch RStudio for serialization hanging bug. +COPY scripts/patch-rstudio.sh patch-rstudio.sh +RUN chmod +x patch-rstudio.sh && ./patch-rstudio.sh + WORKDIR /home/rstudio diff --git a/scripts/patch-rstudio.sh b/scripts/patch-rstudio.sh new file mode 100644 index 000000000..0e63da16b --- /dev/null +++ b/scripts/patch-rstudio.sh @@ -0,0 +1,36 @@ +#!/bin/bash + +# This script is to patch the RStudio server in the Docker image to fix hangs +# when dealing with large SCE files (hopefully) +# +# We will be patching a line from the function isSerializableImpl() in the file SessionEnvironment.R +# isSerializableImpl() in the file SessionEnvironment.R: +# This function has previously been implicated in a similar pegged CPU bug to the one we +# have encountered, which was fixed with the addition of igraph in the chunk below: +# +# # Check for 'known-safe' object classes. +# if (inherits(value, c("data.frame", "igraph"))) +# return(TRUE) +# +# There is only one instance of this line in the file, so we can be confident that we have patched the correct line. +# If the file changes, then we will fail on the MD5sum check. + +set -euo pipefail + +# Check that the file exists and has the expected hash +FILE="/usr/lib/rstudio-server/R/modules/SessionEnvironment.R" +MD5="69d4d879c71d13daf6ab4996288921ef" + +if [[ ! -f "$FILE" ]]; then + echo "Error: $FILE does not exist." + exit 1 +fi +if [[ "$(md5sum "$FILE" | awk '{print $1}')" != "$MD5" ]]; then + echo "Error: $FILE has an unexpected hash." + exit 1 +fi + +# Patch the file to add SummarizedExperiment (includes SingleCellExperiment) and Matrix +# to this list of types known to be serializable + +sed -i.bak 's/inherits(value, c("data.frame", "igraph"))/inherits(value, c("data.frame", "igraph", "SummarizedExperiment", "Matrix"))/' "$FILE" From 629a1321471ff80dd5b37df198d739a5194d4b3f Mon Sep 17 00:00:00 2001 From: Joshua Shapiro Date: Fri, 5 Jun 2026 16:24:52 -0400 Subject: [PATCH 2/4] update renv --- Dockerfile | 1 - renv.lock | 60 +++++++++++++++------------------------- renv/activate.R | 27 +++++++++++++++--- scripts/patch-rstudio.sh | 1 + 4 files changed, 46 insertions(+), 43 deletions(-) diff --git a/Dockerfile b/Dockerfile index a17f89835..7ac43fffc 100644 --- a/Dockerfile +++ b/Dockerfile @@ -91,7 +91,6 @@ RUN --mount=type=secret,id=GITHUB_TOKEN,env=GITHUB_PAT,required=false \ # Some challenges with multi-arch builds and Bioconductor binaries mean we # want to be sure to set up repos manually here, lest the ones recorded in the # renv.lock file cause failures. -arch <- R.version[['arch']] # set up repos for both BioC and CRAN repos <- c( BioCsoft = 'https://bioconductor.org/packages/3.22/bioc', diff --git a/renv.lock b/renv.lock index e1049432a..66dc6456f 100644 --- a/renv.lock +++ b/renv.lock @@ -306,8 +306,8 @@ }, "Banksy": { "Package": "Banksy", - "Version": "1.9.1", - "Source": "GitHub", + "Version": "1.6.0", + "Source": "Bioconductor", "Title": "Spatial transcriptomic clustering", "Authors@R": "c( person(given = \"Vipul\", family = \"Singhal\", role = c(\"aut\")), person(given = \"Joseph\", family = \"Lee\", role = c(\"aut\", \"cre\"), email = \"joseph.lee@u.nus.edu\", comment = c(ORCID=\"0000-0002-4983-4714\")) )", "Description": "Banksy is an R package that incorporates spatial information to cluster cells in a feature space (e.g. gene expression). To incorporate spatial information, BANKSY computes the mean neighborhood expression and azimuthal Gabor filters that capture gene expression gradients. These features are combined with the cell's own expression to embed cells in a neighbor-augmented product space which can then be clustered, allowing for accurate and spatially-aware cell typing and tissue domain segmentation.", @@ -359,14 +359,14 @@ "VignetteBuilder": "knitr", "Config/testthat/edition": "3", "biocViews": "Clustering, Spatial, SingleCell, GeneExpression, DimensionReduction", + "git_url": "https://git.bioconductor.org/packages/Banksy", + "git_branch": "RELEASE_3_22", + "git_last_commit": "6847ab5", + "git_last_commit_date": "2025-10-29", + "Repository": "Bioconductor 3.22", + "NeedsCompilation": "no", "Author": "Vipul Singhal [aut], Joseph Lee [aut, cre] (ORCID: )", - "Maintainer": "Joseph Lee ", - "RemoteType": "github", - "RemoteHost": "api.github.com", - "RemoteUsername": "bioc", - "RemoteRepo": "Banksy", - "RemoteRef": "devel", - "RemoteSha": "5157d9cf8020ec49c99f18d833b143b69a496762" + "Maintainer": "Joseph Lee " }, "Biobase": { "Package": "Biobase", @@ -617,7 +617,7 @@ "NeedsCompilation": "no", "Author": "Martin Morgan [aut] (ORCID: ), Marcel Ramos [aut, cre] (ORCID: )", "Maintainer": "Marcel Ramos ", - "Repository": "CRAN" + "Repository": "https://p3m.dev/cran/latest" }, "BiocNeighbors": { "Package": "BiocNeighbors", @@ -9398,12 +9398,6 @@ "biocViews": "Alignment, Annotation, Clustering, DataImport, MultipleSequenceAlignment, Phylogenetics, ReproducibleResearch, Software, Visualization", "RoxygenNote": "7.3.3", "Roxygen": "list(markdown = TRUE)", - "git_url": "https://git.bioconductor.org/packages/ggtree", - "git_branch": "RELEASE_3_22", - "git_last_commit": "8e25254", - "git_last_commit_date": "2026-01-04", - "Repository": "Bioconductor 3.22", - "NeedsCompilation": "no", "Author": "Guangchuang Yu [aut, cre, cph] (ORCID: ), Tommy Tsan-Yuk Lam [aut, ths], Shuangbin Xu [aut] (ORCID: ), Lin Li [ctb], Bradley Jones [ctb], Justin Silverman [ctb], Watal M. Iwasaki [ctb], Yonghe Xia [ctb], Ruizhu Huang [ctb]", "RemoteType": "bioconductor", "RemoteUrl": "https://github.com/bioc/ggtree", @@ -11050,7 +11044,7 @@ }, "leidenAlg": { "Package": "leidenAlg", - "Version": "1.1.7", + "Version": "1.1.8", "Source": "Repository", "Type": "Package", "Title": "Implements the Leiden Algorithm via an R Interface", @@ -13386,7 +13380,7 @@ }, "renv": { "Package": "renv", - "Version": "1.1.7", + "Version": "1.2.3", "Source": "Repository", "Type": "Package", "Title": "Project Environments", @@ -13437,7 +13431,7 @@ "NeedsCompilation": "no", "Author": "Kevin Ushey [aut, cre] (ORCID: ), Hadley Wickham [aut] (ORCID: ), Posit Software, PBC [cph, fnd]", "Maintainer": "Kevin Ushey ", - "Repository": "CRAN" + "Repository": "https://p3m.dev/cran/latest" }, "reprex": { "Package": "reprex", @@ -15554,10 +15548,10 @@ }, "stringfish": { "Package": "stringfish", - "Version": "0.17.0", - "Source": "GitHub", + "Version": "0.19.0", + "Source": "Repository", "Title": "Alt String Implementation", - "Date": "2025-07-12", + "Date": "2026-04-18", "Authors@R": "c( person(\"Travers\", \"Ching\", email = \"traversc@gmail.com\", role = c(\"aut\", \"cre\", \"cph\")), person(\"Phillip\", \"Hazel\", role = c(\"ctb\"), comment = \"Bundled PCRE2 code\"), person(\"Zoltan\", \"Herczeg\", role = c(\"ctb\", \"cph\"), comment = \"Bundled PCRE2 code\"), person(\"University of Cambridge\", role = c(\"cph\"), comment = \"Bundled PCRE2 code\"), person(\"Tilera Corporation\", role = c(\"cph\"), comment = \"Stack-less Just-In-Time compiler bundled with PCRE2\"), person(\"Yann\", \"Collet\", role = c(\"ctb\", \"cph\"), comment = \"Yann Collet is the author of the bundled xxHash code\"))", "Maintainer": "Travers Ching ", "Description": "Provides an extendable, performant and multithreaded 'alt-string' implementation backed by 'C++' vectors and strings.", @@ -15567,7 +15561,7 @@ "Depends": [ "R (>= 3.6.0)" ], - "SystemRequirements": "GNU make", + "SystemRequirements": "GNU make, C++17", "LinkingTo": [ "Rcpp (>= 0.12.18.3)", "RcppParallel (>= 5.1.4)" @@ -15577,27 +15571,17 @@ "RcppParallel" ], "Suggests": [ - "qs2", - "qs", "knitr", - "rmarkdown", - "usethis", - "dplyr", - "stringr", - "rlang" + "rmarkdown" ], "VignetteBuilder": "knitr", - "RoxygenNote": "7.3.2", - "Copyright": "Copyright for the bundled 'PCRE2' library is held by University of Cambridge, Zoltan Herczeg and Tilera Coporation (Stack-less Just-In-Time compiler); Copyright for the bundled 'xxHash' code is held by Yann Collet.", + "RoxygenNote": "7.3.3", + "Copyright": "Copyright for the bundled 'PCRE2' library is held by University of Cambridge, Zoltan Herczeg and Tilera Corporation (Stack-less Just-In-Time compiler); Copyright for the bundled 'xxHash' code is held by Yann Collet.", "URL": "https://github.com/traversc/stringfish", "BugReports": "https://github.com/traversc/stringfish/issues", + "NeedsCompilation": "yes", "Author": "Travers Ching [aut, cre, cph], Phillip Hazel [ctb] (Bundled PCRE2 code), Zoltan Herczeg [ctb, cph] (Bundled PCRE2 code), University of Cambridge [cph] (Bundled PCRE2 code), Tilera Corporation [cph] (Stack-less Just-In-Time compiler bundled with PCRE2), Yann Collet [ctb, cph] (Yann Collet is the author of the bundled xxHash code)", - "RemoteType": "github", - "RemoteHost": "api.github.com", - "RemoteUsername": "traversc", - "RemoteRepo": "stringfish", - "RemoteRef": "f3a44d26d77b4980c829481363bc3aa6d2a2bc3f", - "RemoteSha": "f3a44d26d77b4980c829481363bc3aa6d2a2bc3f" + "Repository": "CRAN" }, "stringi": { "Package": "stringi", diff --git a/renv/activate.R b/renv/activate.R index ef25ef839..20ffd442c 100644 --- a/renv/activate.R +++ b/renv/activate.R @@ -2,8 +2,8 @@ local({ # the requested version of renv - version <- "1.1.7" - attr(version, "md5") <- "dd5d60f155dadff4c88c2fc6680504b4" + version <- "1.2.3" + attr(version, "md5") <- "1bd9f58e1cfe27ce035933937c6f03de" attr(version, "sha") <- NULL # the project directory @@ -226,13 +226,17 @@ local({ section <- header(sprintf("Bootstrapping renv %s", friendly)) catf(section) + # ensure the target library path exists; required for file.copy(..., recursive = TRUE) + dir.create(library, showWarnings = FALSE, recursive = TRUE) + # try to install renv from cache md5 <- attr(version, "md5", exact = TRUE) if (length(md5)) { pkgpath <- renv_bootstrap_find(version) if (length(pkgpath) && file.exists(pkgpath)) { - file.copy(pkgpath, library, recursive = TRUE) - return(invisible()) + ok <- file.copy(pkgpath, library, recursive = TRUE) + if (isTRUE(ok)) + return(invisible()) } } @@ -1231,6 +1235,21 @@ local({ } renv_bootstrap_run <- function(project, libpath, version) { + tryCatch( + renv_bootstrap_run_impl(project, libpath, version), + error = function(e) { + msg <- paste( + "failed to bootstrap renv: the project will not be loaded.", + paste("Reason:", conditionMessage(e)), + "Use `renv::activate()` to re-initialize the project.", + sep = "\n" + ) + warning(msg, call. = FALSE) + } + ) + } + + renv_bootstrap_run_impl <- function(project, libpath, version) { # perform bootstrap bootstrap(version, libpath) diff --git a/scripts/patch-rstudio.sh b/scripts/patch-rstudio.sh index 0e63da16b..88f3b705e 100644 --- a/scripts/patch-rstudio.sh +++ b/scripts/patch-rstudio.sh @@ -34,3 +34,4 @@ fi # to this list of types known to be serializable sed -i.bak 's/inherits(value, c("data.frame", "igraph"))/inherits(value, c("data.frame", "igraph", "SummarizedExperiment", "Matrix"))/' "$FILE" + From c71f617f072484f778fa8ac4064ba7fd59f904b9 Mon Sep 17 00:00:00 2001 From: Joshua Shapiro Date: Fri, 5 Jun 2026 18:06:07 -0400 Subject: [PATCH 3/4] get qs from the last available version, not github --- renv.lock | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/renv.lock b/renv.lock index 66dc6456f..e8d31cf30 100644 --- a/renv.lock +++ b/renv.lock @@ -12959,10 +12959,10 @@ "qs": { "Package": "qs", "Version": "0.27.3", - "Source": "GitHub", + "Source": "Repository", "Type": "Package", "Title": "Quick Serialization of R Objects", - "Date": "2025-3-6", + "Date": "2025-3-7", "Authors@R": "c( person(\"Travers\", \"Ching\", email = \"traversc@gmail.com\", role = c(\"aut\", \"cre\", \"cph\")), person(\"Yann\", \"Collet\", role = c(\"ctb\", \"cph\"), comment = \"Yann Collet is the author of the bundled zstd, lz4 and xxHash code\"), person(\"Facebook, Inc.\", role = \"cph\", comment = \"Facebook is the copyright holder of the bundled zstd code\"), person(\"Reichardt\", \"Tino\", role = c(\"ctb\", \"cph\"), comment = \"Contributor/copyright holder of zstd bundled code\"), person(\"Skibinski\", \"Przemyslaw\", role = c(\"ctb\", \"cph\"), comment = \"Contributor/copyright holder of zstd bundled code\"), person(\"Mori\", \"Yuta\", role = c(\"ctb\", \"cph\"), comment = \"Contributor/copyright holder of zstd bundled code\"), person(\"Romain\", \"Francois\", role = c(\"ctb\", \"cph\"), comment = \"Derived example/tutorials for ALTREP structures\"), person(\"Francesc\", \"Alted\", role = c(\"ctb\", \"cph\"), comment = \"Shuffling routines derived from Blosc library\"), person(\"Bryce\", \"Chamberlain\", email = \"superchordate@gmail.com\", role = c(\"ctb\"), comment = \"qsavem and qload functions\"), person(\"Salim\", \"Brüggemann\", email = \"salim-b@pm.me\", role = c(\"ctb\"), comment = \"Contributing to documentation (ORCID:0000-0002-5329-5987)\"))", "Maintainer": "Travers Ching ", "Description": "Provides functions for quickly writing and reading any R object to and from disk.", @@ -12984,7 +12984,6 @@ "BH" ], "Encoding": "UTF-8", - "Roxygen": "list(markdown = TRUE)", "RoxygenNote": "7.3.2", "Suggests": [ "knitr", @@ -12997,13 +12996,9 @@ "Copyright": "This package includes code from the 'zstd' library owned by Facebook, Inc. and created by Yann Collet; the 'lz4' library created and owned by Yann Collet; xxHash library created and owned by Yann Collet; and code derived from the 'Blosc' library created and owned by Francesc Alted.", "URL": "https://github.com/qsbase/qs", "BugReports": "https://github.com/qsbase/qs/issues", + "NeedsCompilation": "yes", "Author": "Travers Ching [aut, cre, cph], Yann Collet [ctb, cph] (Yann Collet is the author of the bundled zstd, lz4 and xxHash code), Facebook, Inc. [cph] (Facebook is the copyright holder of the bundled zstd code), Reichardt Tino [ctb, cph] (Contributor/copyright holder of zstd bundled code), Skibinski Przemyslaw [ctb, cph] (Contributor/copyright holder of zstd bundled code), Mori Yuta [ctb, cph] (Contributor/copyright holder of zstd bundled code), Romain Francois [ctb, cph] (Derived example/tutorials for ALTREP structures), Francesc Alted [ctb, cph] (Shuffling routines derived from Blosc library), Bryce Chamberlain [ctb] (qsavem and qload functions), Salim Brüggemann [ctb] (Contributing to documentation (ORCID:0000-0002-5329-5987))", - "RemoteType": "github", - "RemoteHost": "api.github.com", - "RemoteUsername": "qsbase", - "RemoteRepo": "qs", - "RemoteRef": "master", - "RemoteSha": "eca241e1bc5f65fcec28b516ed3e4e9ccb05487f" + "Repository": "RSPM" }, "quadprog": { "Package": "quadprog", From d18cf5ec7e39a3fa41f8b43a585ed601fb31e400 Mon Sep 17 00:00:00 2001 From: Joshua Shapiro Date: Mon, 8 Jun 2026 17:32:08 -0400 Subject: [PATCH 4/4] Revert "Add script to patch RStudio in Docker" This reverts commit 16e457aebd6ef6a5afa4c23d9e8536df3a3cc5aa. --- Dockerfile | 4 ---- scripts/patch-rstudio.sh | 37 ------------------------------------- 2 files changed, 41 deletions(-) delete mode 100644 scripts/patch-rstudio.sh diff --git a/Dockerfile b/Dockerfile index 7ac43fffc..43488ba7a 100644 --- a/Dockerfile +++ b/Dockerfile @@ -128,9 +128,5 @@ RUN python3 ${template_dir}/scripts/setup-skel.py \ --skel-dir /etc/skel \ --module-file ${template_dir}/current-modules.json -# patch RStudio for serialization hanging bug. -COPY scripts/patch-rstudio.sh patch-rstudio.sh -RUN chmod +x patch-rstudio.sh && ./patch-rstudio.sh - WORKDIR /home/rstudio diff --git a/scripts/patch-rstudio.sh b/scripts/patch-rstudio.sh deleted file mode 100644 index 88f3b705e..000000000 --- a/scripts/patch-rstudio.sh +++ /dev/null @@ -1,37 +0,0 @@ -#!/bin/bash - -# This script is to patch the RStudio server in the Docker image to fix hangs -# when dealing with large SCE files (hopefully) -# -# We will be patching a line from the function isSerializableImpl() in the file SessionEnvironment.R -# isSerializableImpl() in the file SessionEnvironment.R: -# This function has previously been implicated in a similar pegged CPU bug to the one we -# have encountered, which was fixed with the addition of igraph in the chunk below: -# -# # Check for 'known-safe' object classes. -# if (inherits(value, c("data.frame", "igraph"))) -# return(TRUE) -# -# There is only one instance of this line in the file, so we can be confident that we have patched the correct line. -# If the file changes, then we will fail on the MD5sum check. - -set -euo pipefail - -# Check that the file exists and has the expected hash -FILE="/usr/lib/rstudio-server/R/modules/SessionEnvironment.R" -MD5="69d4d879c71d13daf6ab4996288921ef" - -if [[ ! -f "$FILE" ]]; then - echo "Error: $FILE does not exist." - exit 1 -fi -if [[ "$(md5sum "$FILE" | awk '{print $1}')" != "$MD5" ]]; then - echo "Error: $FILE has an unexpected hash." - exit 1 -fi - -# Patch the file to add SummarizedExperiment (includes SingleCellExperiment) and Matrix -# to this list of types known to be serializable - -sed -i.bak 's/inherits(value, c("data.frame", "igraph"))/inherits(value, c("data.frame", "igraph", "SummarizedExperiment", "Matrix"))/' "$FILE" -