From 8b50a2e6a784db81a7dd9cf91e2530f37eaa80b4 Mon Sep 17 00:00:00 2001 From: Muluh <127390183+0xMuluh@users.noreply.github.com> Date: Fri, 10 Jul 2026 08:09:04 +0000 Subject: [PATCH 1/4] #869 - fix failing build Signed-off-by: Muluh <127390183+0xMuluh@users.noreply.github.com> --- DESCRIPTION | 1 + Dockerfile | 9 +++++++-- inst/pages/multiassay_ordination.qmd | 2 +- install_packages.R | 12 +----------- oma_packages/oma_packages.csv | 1 + 5 files changed, 11 insertions(+), 14 deletions(-) diff --git a/DESCRIPTION b/DESCRIPTION index c9819b232..4e2b60e16 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -43,6 +43,7 @@ Suggests: glue, gt, knitr, + Maaslin2, maaslin3, mediation, mia, diff --git a/Dockerfile b/Dockerfile index 9e9a30860..aa3443e51 100644 --- a/Dockerfile +++ b/Dockerfile @@ -2,8 +2,13 @@ ARG BIOC_VERSION FROM bioconductor/bioconductor_docker:${BIOC_VERSION} COPY . /opt/pkg -# Install book package -RUN Rscript -e 'repos <- BiocManager::repositories() ; remotes::install_local(path = "/opt/pkg/", repos=repos, dependencies=TRUE, build_vignettes=FALSE, upgrade=TRUE) ; sessioninfo::session_info(installed.packages()[,"Package"], include_base = TRUE)' +# Install system Python, pip, and venv via Ubuntu's package manager – needed by mofa and book packages +RUN apt-get update && apt-get install -y python3.12 python3.12-venv python3-pip && Rscript -e 'if(!requireNamespace("remotes", quietly=TRUE)) install.packages("remotes", repos="https://cloud.r-project.org"); remotes::install_local(path = "/opt/pkg/", dependencies=TRUE, build_vignettes=FALSE, upgrade=TRUE)' && rm -rf /var/lib/apt/lists/* + +RUN pip3 install mofapy2==0.7.3 --break-system-packages + +# Force R/reticulate to use this specific Python installation +ENV RETICULATE_PYTHON="/usr/bin/python3.12" ## Build/install using same approach than BBS RUN R CMD INSTALL /opt/pkg diff --git a/inst/pages/multiassay_ordination.qmd b/inst/pages/multiassay_ordination.qmd index a80e6b6d5..00b096400 100644 --- a/inst/pages/multiassay_ordination.qmd +++ b/inst/pages/multiassay_ordination.qmd @@ -139,7 +139,7 @@ model <- prepare_mofa( # Some systems may require the specification `use_basilisk = TRUE` # so it has been added to the following code -model <- run_mofa(model, use_basilisk = TRUE) +model <- run_mofa(model, use_basilisk = FALSE) ``` The explained variance is visualized with the `plot_variance_explained()` diff --git a/install_packages.R b/install_packages.R index 7e638c225..1e7b6c723 100644 --- a/install_packages.R +++ b/install_packages.R @@ -68,18 +68,9 @@ if(!requireNamespace("magrittr", quietly = TRUE)) { ## list of packages required for each chapters pkgs_all <- read.table(packages)[,1] -# This will be installed manually later in this script -# since it requires the latest devel update -pkgs_all <- setdiff(pkgs_all, "Maaslin2") - # Customization # Github packages must be installed separately -pkgs_github <- c("miaTime", "ggord") -pkgs_nongithub <- setdiff(pkgs_all, pkgs_github) - -# Maaslin2 needs an update, see -# https://forum.biobakery.org/t/xtfrm-error-with-maaslin2-default-example-in-r/5216/3 -remotes::install_github("biobakery/Maaslin2") +pkgs_github <- c("ggord") # --------------------------- @@ -100,7 +91,6 @@ for(i in seq_along(chapter_pkgs)) { } # Github packages -devtools::install_github("microbiome/miaTime") devtools::install_github("fawda123/ggord") ## report packages no installed diff --git a/oma_packages/oma_packages.csv b/oma_packages/oma_packages.csv index 55e5a8a53..39566a820 100644 --- a/oma_packages/oma_packages.csv +++ b/oma_packages/oma_packages.csv @@ -17,6 +17,7 @@ ggtree glue gt knitr +Maaslin2 maaslin3 mediation mia From e0f8aec08c927ce7ff112b3c2469eb0adcdfd317 Mon Sep 17 00:00:00 2001 From: 0xMuluh <127390183+0xMuluh@users.noreply.github.com> Date: Fri, 10 Jul 2026 08:26:34 +0000 Subject: [PATCH 2/4] Style R code with styler --- install_packages.R | 98 +++++++++++++++++++++++++++------------------- 1 file changed, 57 insertions(+), 41 deletions(-) diff --git a/install_packages.R b/install_packages.R index 1e7b6c723..f6b987c0c 100644 --- a/install_packages.R +++ b/install_packages.R @@ -1,72 +1,84 @@ -# The code adapted from Huber et al. 2023 +# The code adapted from Huber et al. 2023 # https://www.huber.embl.de/msmb/install_packages.R # Source location for the up-to-date package list: packages <- url("https://raw.githubusercontent.com/microbiome/OMA/devel/oma_packages/oma_packages.csv") -#packages <- "oma_packages.csv" +# packages <- "oma_packages.csv" # ------------------------------------------------------------------------------------------- options(install.packages.check.source = "no") options(install.packages.compile.from.source = "never") Sys.setenv(R_REMOTES_UPGRADE = "never") -pkg_type <- switch (Sys.info()["sysname"], - "Linux" = "source", - "both") +pkg_type <- switch(Sys.info()["sysname"], + "Linux" = "source", + "both" +) ## Function to install packages one at a time with indication of time left ## Overall probably slower than install.packages if everything works ## but doesn't require downloading all packages first before trying to install any installer_with_progress <- function(pkgs) { - - if(length(pkgs) == 0) { invisible(return(NULL)) } - + if (length(pkgs) == 0) { + invisible(return(NULL)) + } + toInstall <- pkgs - bp <- progress::progress_bar$new(total = length(toInstall), - format = "Installed :current of :total (:percent ) - current package: :package", - show_after = 0, - clear = FALSE) - + bp <- progress::progress_bar$new( + total = length(toInstall), + format = "Installed :current of :total (:percent ) - current package: :package", + show_after = 0, + clear = FALSE + ) + length_prev <- length(toInstall) fail <- NULL - while(length(toInstall)) { + while (length(toInstall)) { pkg <- toInstall[1] - bp$tick(length_prev - length(toInstall), tokens = list(package = pkg)) + bp$tick(length_prev - length(toInstall), tokens = list(package = pkg)) length_prev <- length(toInstall) tryCatch( - suppressMessages( BiocManager::install(pkg, quiet = TRUE, update = FALSE, ask = FALSE, type = "binary") ), - error = function(e) { fail <<- c(fail, pkg) }, - warning = function(w) { fail <<- c(fail, pkg) }, + suppressMessages(BiocManager::install(pkg, quiet = TRUE, update = FALSE, ask = FALSE, type = "binary")), + error = function(e) { + fail <<- c(fail, pkg) + }, + warning = function(w) { + fail <<- c(fail, pkg) + }, ## remove current package, otherwise we loop in event of failure ## update the list to reflect any dependencies that are now installed - finally = { toInstall <- setdiff(toInstall, installed.packages()[, "Package"]) } + finally = { + toInstall <- setdiff(toInstall, installed.packages()[, "Package"]) + } ) } - bp$tick(length_prev - length(toInstall), tokens = list(package = "DONE!")) - + bp$tick(length_prev - length(toInstall), tokens = list(package = "DONE!")) + return(fail) } ## these packages are needed prior to the installation -if(!requireNamespace("BiocManager", quietly = TRUE)) { - install.packages(c('BiocManager'), repos = "https://cloud.r-project.org", - quiet = TRUE, update = FALSE, ask = FALSE, type = pkg_type) +if (!requireNamespace("BiocManager", quietly = TRUE)) { + install.packages(c("BiocManager"), + repos = "https://cloud.r-project.org", + quiet = TRUE, update = FALSE, ask = FALSE, type = pkg_type + ) } ## update any existing packages BiocManager::install(update = TRUE, ask = FALSE) -if(!requireNamespace("remotes", quietly = TRUE)) { - install.packages(c('remotes'), quiet = TRUE, update = FALSE, ask = FALSE, type = pkg_type) +if (!requireNamespace("remotes", quietly = TRUE)) { + install.packages(c("remotes"), quiet = TRUE, update = FALSE, ask = FALSE, type = pkg_type) } -if(!requireNamespace("magrittr", quietly = TRUE)) { - BiocManager::install('magrittr', quiet = TRUE, update = FALSE, ask = FALSE, type = pkg_type) +if (!requireNamespace("magrittr", quietly = TRUE)) { + BiocManager::install("magrittr", quiet = TRUE, update = FALSE, ask = FALSE, type = pkg_type) } # --------------------------- ## list of packages required for each chapters -pkgs_all <- read.table(packages)[,1] +pkgs_all <- read.table(packages)[, 1] # Customization # Github packages must be installed separately @@ -75,15 +87,15 @@ pkgs_github <- c("ggord") # --------------------------- # pkgs <- readRDS("oma_packages.rds") # Just do all at once -chapter_pkgs <- list(all=pkgs_all) +chapter_pkgs <- list(all = pkgs_all) # Can check later how packages can be splitted by chapter -#chapter_pkgs <- split(pkgs$packages, pkgs$chapter) +# chapter_pkgs <- split(pkgs$packages, pkgs$chapter) ### subset a selection of chapters if specified -#if(exists('chapter_index') && is.numeric(chapter_index)) { +# if(exists('chapter_index') && is.numeric(chapter_index)) { # chapter_pkgs <- chapter_pkgs[ chapter_index ] -#} +# } -for(i in seq_along(chapter_pkgs)) { +for (i in seq_along(chapter_pkgs)) { message("### CHAPTER: ", i, " ###") pkgsAvailable <- installed.packages()[, "Package"] pkgsToInstall <- setdiff(chapter_pkgs[[i]], c(pkgsAvailable, pkgs_github)) @@ -98,13 +110,17 @@ devtools::install_github("fawda123/ggord") pkgsAvailable <- installed.packages()[, "Package"] pkgsNeeded <- unique(unlist(chapter_pkgs)) pkgsToInstall <- setdiff(pkgsNeeded, pkgsAvailable) -if(length(pkgsToInstall)) { - message("The following packages failed to install: \n", - paste(pkgsToInstall, collapse = ", ")) - message("You can try re-running this installation script.\n", - "It will only try to install the missing packages.\n", - "This may make it easier to see the information R gives about why the installation failed.\n", - "Please contact microbiome@utu.fi for additional help.") +if (length(pkgsToInstall)) { + message( + "The following packages failed to install: \n", + paste(pkgsToInstall, collapse = ", ") + ) + message( + "You can try re-running this installation script.\n", + "It will only try to install the missing packages.\n", + "This may make it easier to see the information R gives about why the installation failed.\n", + "Please contact microbiome@utu.fi for additional help." + ) } Sys.unsetenv("R_REMOTES_UPGRADE") From 07a42481c2121ad680d5e2a1aae90ea4cc7318e0 Mon Sep 17 00:00:00 2001 From: Muluh <127390183+0xMuluh@users.noreply.github.com> Date: Fri, 10 Jul 2026 08:27:03 +0000 Subject: [PATCH 3/4] up Signed-off-by: Muluh <127390183+0xMuluh@users.noreply.github.com> --- DESCRIPTION | 1 - install_packages.R | 12 +++++++++++- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/DESCRIPTION b/DESCRIPTION index 4e2b60e16..c9819b232 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -43,7 +43,6 @@ Suggests: glue, gt, knitr, - Maaslin2, maaslin3, mediation, mia, diff --git a/install_packages.R b/install_packages.R index f6b987c0c..b5adcd920 100644 --- a/install_packages.R +++ b/install_packages.R @@ -80,9 +80,18 @@ if (!requireNamespace("magrittr", quietly = TRUE)) { ## list of packages required for each chapters pkgs_all <- read.table(packages)[, 1] +# This will be installed manually later in this script +# since it requires the latest devel update +pkgs_all <- setdiff(pkgs_all, "Maaslin2") + # Customization # Github packages must be installed separately -pkgs_github <- c("ggord") +pkgs_github <- c("miaTime", "ggord") +pkgs_nongithub <- setdiff(pkgs_all, pkgs_github) + +# Maaslin2 needs an update, see +# https://forum.biobakery.org/t/xtfrm-error-with-maaslin2-default-example-in-r/5216/3 +remotes::install_github("biobakery/Maaslin2") # --------------------------- @@ -103,6 +112,7 @@ for (i in seq_along(chapter_pkgs)) { } # Github packages +devtools::install_github("microbiome/miaTime") devtools::install_github("fawda123/ggord") ## report packages no installed From c6f7cedceccbcdc7dc5374977d3493fc51ea1176 Mon Sep 17 00:00:00 2001 From: 0xMuluh <127390183+0xMuluh@users.noreply.github.com> Date: Fri, 10 Jul 2026 08:56:51 +0000 Subject: [PATCH 4/4] Style R code with styler --- install_packages.R | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/install_packages.R b/install_packages.R index b5adcd920..494cbab2d 100644 --- a/install_packages.R +++ b/install_packages.R @@ -82,7 +82,7 @@ pkgs_all <- read.table(packages)[, 1] # This will be installed manually later in this script # since it requires the latest devel update -pkgs_all <- setdiff(pkgs_all, "Maaslin2") +pkgs_all <- setdiff(pkgs_all, "Maaslin2") # Customization # Github packages must be installed separately