From f9f2d6e67584fcc40f7ad27de2f3f5fc27d24d4a Mon Sep 17 00:00:00 2001 From: Mootor Date: Mon, 15 Jul 2024 13:00:01 -0700 Subject: [PATCH 1/9] add installer script --- installer.R | 42 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 installer.R diff --git a/installer.R b/installer.R new file mode 100644 index 0000000..f97e95f --- /dev/null +++ b/installer.R @@ -0,0 +1,42 @@ +library(argparse); +library(pkgdepends); + +parser <- ArgumentParser(); + +parser$add_argument( + '-r', + '--repo-name', + help = 'Specify the repo name' + ); +parser$add_argument( + '-av', + '--add-version', + help = 'Specify tool version' + ); + +args <- parser$parse_args(); + +repo <- args$repo_name; +version <- args$add_version; + +if (!(startsWith(version, 'v'))) { + version <- paste('v', version, sep = '') + }; + +tool <- paste(repo, '@' ,version, sep = ''); + +pkg.download.proposal <- new_pkg_download_proposal(tool); +pkg.download.proposal$resolve(); +pkg.download.proposal$download(); + +#Packages and dependencies will be installed in the path below +lib <- '/usr/lib/R/site-library'; +config <- list(library = lib); + +pkg.installation.proposal <- new_pkg_installation_proposal( + tool, + config = list(library = lib) +); +pkg.installation.proposal$solve(); +pkg.installation.proposal$download(); +pkg.installation.proposal$install(); From c362ab174ca6a600136504d031a19b91c1c94949 Mon Sep 17 00:00:00 2001 From: Mootor Date: Wed, 17 Jul 2024 14:53:25 -0700 Subject: [PATCH 2/9] comment lines for testing --- Dockerfile | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/Dockerfile b/Dockerfile index df46e21..02aa6ac 100644 --- a/Dockerfile +++ b/Dockerfile @@ -17,6 +17,8 @@ RUN mamba create -qy -p /usr/local \ FROM ubuntu:20.04 COPY --from=builder /usr/local /usr/local +FROM r-base:latest + ARG DEBIAN_FRONTEND=noninteractive RUN apt-get update && \ @@ -30,17 +32,19 @@ RUN R -q -e 'install.packages("BiocManager")' && \ "gridExtra","doParallel","foreach", "splines", "VariantAnnotation", "copynumber"))' # Install devtools, ASCAT & Battenberg -RUN R -q -e 'install.packages("devtools", dependencies = TRUE)' && \ - R -q -e 'devtools::install_github("Crick-CancerGenomics/ascat/ASCAT@v3.1.2")' && \ - R -q -e 'devtools::install_github("Wedge-Oxford/battenberg@v2.2.9")' +COPY installer.R /usr/local/bin/installer.R +RUN R -q -e 'install.packages(c("argparse", "pkgdepends"), lib = "/usr/lib/R/site-library")' && \ + chmod +x /usr/local/bin/installer.R +#RUN Rscript /usr/local/bin/installer.R -r "Crick-CancerGenomics/ascat/ASCAT" -av "3.1.2" +#RUN Rscript /usr/local/bin/installer.R -r "Wedge-Oxford/battenberg" -av "2.2.9" # Modify paths to reference files -COPY modify_reference_path.sh /usr/local/bin/modify_reference_path.sh -RUN chmod +x /usr/local/bin/modify_reference_path.sh && \ - bash /usr/local/bin/modify_reference_path.sh /usr/local/lib/R/site-library/Battenberg/example/battenberg_wgs.R /usr/local/bin/battenberg_wgs.R +#COPY modify_reference_path.sh /usr/local/bin/modify_reference_path.sh +#RUN chmod +x /usr/local/bin/modify_reference_path.sh && \ +# bash /usr/local/bin/modify_reference_path.sh /usr/local/lib/R/site-library/Battenberg/example/battenberg_wgs.R /usr/local/bin/battenberg_wgs.R -RUN ln -sf /usr/local/lib/R/site-library/Battenberg/example/filter_sv_brass.R /usr/local/bin/filter_sv_brass.R && \ - ln -sf /usr/local/lib/R/site-library/Battenberg/example/battenberg_cleanup.sh /usr/local/bin/battenberg_cleanup.sh +#RUN ln -sf /usr/local/lib/R/site-library/Battenberg/example/filter_sv_brass.R /usr/local/bin/filter_sv_brass.R && \ +# ln -sf /usr/local/lib/R/site-library/Battenberg/example/battenberg_cleanup.sh /usr/local/bin/battenberg_cleanup.sh # Add a new user/group called bldocker RUN groupadd -g 500001 bldocker && \ From 144d0de3fd3fbee0dd3f0a6aecd458ce74b7b44b Mon Sep 17 00:00:00 2001 From: Mootor Date: Mon, 22 Jul 2024 13:20:05 -0700 Subject: [PATCH 3/9] add installer R script that uses pkgdepends --- installer.R | 37 ++++++++++++------------------------- 1 file changed, 12 insertions(+), 25 deletions(-) diff --git a/installer.R b/installer.R index f97e95f..b30c810 100644 --- a/installer.R +++ b/installer.R @@ -4,39 +4,26 @@ library(pkgdepends); parser <- ArgumentParser(); parser$add_argument( - '-r', - '--repo-name', - help = 'Specify the repo name' + '-l', + '--lib', + help = 'Library path to install the tools' ); parser$add_argument( - '-av', - '--add-version', - help = 'Specify tool version' + '-d', + '--dependencies', + nargs = '+', + help = 'List dependencies separated by space' ); args <- parser$parse_args(); -repo <- args$repo_name; -version <- args$add_version; - -if (!(startsWith(version, 'v'))) { - version <- paste('v', version, sep = '') - }; - -tool <- paste(repo, '@' ,version, sep = ''); - -pkg.download.proposal <- new_pkg_download_proposal(tool); -pkg.download.proposal$resolve(); -pkg.download.proposal$download(); - -#Packages and dependencies will be installed in the path below -lib <- '/usr/lib/R/site-library'; -config <- list(library = lib); +tools <- args$dependencies; +lib <- args$lib; pkg.installation.proposal <- new_pkg_installation_proposal( - tool, - config = list(library = lib) -); + tools, + config = list(library = lib) + ); pkg.installation.proposal$solve(); pkg.installation.proposal$download(); pkg.installation.proposal$install(); From 09422044a15fcda6dd6d7431631297de3bc8e15f Mon Sep 17 00:00:00 2001 From: Mootor Date: Mon, 22 Jul 2024 13:21:02 -0700 Subject: [PATCH 4/9] remove redundant dependendencies and use r-base --- Dockerfile | 72 ++++++++++++++++++++++++++---------------------------- 1 file changed, 35 insertions(+), 37 deletions(-) diff --git a/Dockerfile b/Dockerfile index 02aa6ac..42c448f 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,50 +1,48 @@ -ARG MINIFORGE_VERSION=23.1.0-1 - -FROM condaforge/mambaforge:${MINIFORGE_VERSION} AS builder - -# Use mamba to install tools and dependencies into /usr/local -ARG HTSLIB_VERSION=1.16 -ARG ALLELECOUNT_VERSION=4.3.0 -ARG IMPUTE2_VERSION=2.3.2 -RUN mamba create -qy -p /usr/local \ - -c bioconda \ - -c conda-forge \ - htslib==${HTSLIB_VERSION} \ - cancerit-allelecount==${ALLELECOUNT_VERSION} \ - impute2==${IMPUTE2_VERSION} - -# Deploy the target tools into a base image FROM ubuntu:20.04 -COPY --from=builder /usr/local /usr/local +FROM r-base:4.4.1 -FROM r-base:latest +RUN apt-get update \ + && apt-get install -y --no-install-recommends \ + libcurl4-openssl-dev \ + libbz2-dev \ + liblzma-dev \ + libpng-dev \ + libssl-dev \ + libxml2-dev \ + python3 -ARG DEBIAN_FRONTEND=noninteractive +# Main tool version +ARG BATTENBERG_VERSION=2.2.9 -RUN apt-get update && \ - apt-get install -y --no-install-recommends libxml2 libxml2-dev libcurl4-gnutls-dev build-essential \ - libfontconfig1-dev libharfbuzz-dev libfribidi-dev libfreetype6-dev libpng-dev libtiff5-dev libjpeg-dev r-cran-rgl git libssl-dev r-cran-curl && \ - apt-get clean && rm -rf /var/lib/apt/lists/* +# Dependency version or commit ID +ARG ASCAT_VERSION=3.1.3 +ARG COPYNUMBER_VERSION="b404a4d" -RUN R -q -e 'install.packages("BiocManager")' && \ - R -q -e 'BiocManager::install(c("curl","cpp11","lifecycle","readr","ellipsis","vctrs",\ - "GenomicRanges","IRanges","gtools", "optparse", "RColorBrewer","ggplot2",\ - "gridExtra","doParallel","foreach", "splines", "VariantAnnotation", "copynumber"))' +# GitHub repo link +ARG ASCAT="VanLoo-lab/ascat/ASCAT@v${ASCAT_VERSION}" +ARG COPYNUMBER="igordot/copynumber@${COPYNUMBER_VERSION}" +ARG BATTENBERG="Wedge-lab/battenberg@v${BATTENBERG_VERSION}" -# Install devtools, ASCAT & Battenberg +# R library path to install the above packages +ARG LIBRARY="/usr/lib/R/site-library" + +# Install Package Dependency toolkit +RUN library=${LIBRARY} R -e 'install.packages(c("argparse", "pkgdepends"), lib = Sys.getenv("library"))' + +# Install Battenberg COPY installer.R /usr/local/bin/installer.R -RUN R -q -e 'install.packages(c("argparse", "pkgdepends"), lib = "/usr/lib/R/site-library")' && \ - chmod +x /usr/local/bin/installer.R -#RUN Rscript /usr/local/bin/installer.R -r "Crick-CancerGenomics/ascat/ASCAT" -av "3.1.2" -#RUN Rscript /usr/local/bin/installer.R -r "Wedge-Oxford/battenberg" -av "2.2.9" + +RUN chmod +x /usr/local/bin/installer.R + +RUN Rscript /usr/local/bin/installer.R -l ${LIBRARY} -d ${COPYNUMBER} ${ASCAT} ${BATTENBERG} # Modify paths to reference files -#COPY modify_reference_path.sh /usr/local/bin/modify_reference_path.sh -#RUN chmod +x /usr/local/bin/modify_reference_path.sh && \ -# bash /usr/local/bin/modify_reference_path.sh /usr/local/lib/R/site-library/Battenberg/example/battenberg_wgs.R /usr/local/bin/battenberg_wgs.R +COPY modify_reference_path.sh /usr/local/bin/modify_reference_path.sh +RUN chmod +x /usr/local/bin/modify_reference_path.sh && \ + bash /usr/local/bin/modify_reference_path.sh /usr/local/lib/R/site-library/Battenberg/example/battenberg_wgs.R /usr/local/bin/battenberg_wgs.R -#RUN ln -sf /usr/local/lib/R/site-library/Battenberg/example/filter_sv_brass.R /usr/local/bin/filter_sv_brass.R && \ -# ln -sf /usr/local/lib/R/site-library/Battenberg/example/battenberg_cleanup.sh /usr/local/bin/battenberg_cleanup.sh +RUN ln -sf /usr/local/lib/R/site-library/Battenberg/example/filter_sv_brass.R /usr/local/bin/filter_sv_brass.R && \ + ln -sf /usr/local/lib/R/site-library/Battenberg/example/battenberg_cleanup.sh /usr/local/bin/battenberg_cleanup.sh # Add a new user/group called bldocker RUN groupadd -g 500001 bldocker && \ From a11e0097c7374059a3550dc7d9296dcf8036adbc Mon Sep 17 00:00:00 2001 From: Mootor Date: Mon, 22 Jul 2024 13:52:32 -0700 Subject: [PATCH 5/9] fix file path for battenberg_wgs.R --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 42c448f..2cc3f0d 100644 --- a/Dockerfile +++ b/Dockerfile @@ -39,7 +39,7 @@ RUN Rscript /usr/local/bin/installer.R -l ${LIBRARY} -d ${COPYNUMBER} ${ASCAT} $ # Modify paths to reference files COPY modify_reference_path.sh /usr/local/bin/modify_reference_path.sh RUN chmod +x /usr/local/bin/modify_reference_path.sh && \ - bash /usr/local/bin/modify_reference_path.sh /usr/local/lib/R/site-library/Battenberg/example/battenberg_wgs.R /usr/local/bin/battenberg_wgs.R + bash /usr/local/bin/modify_reference_path.sh /usr/lib/R/site-library/Battenberg/example/battenberg_wgs.R /usr/local/bin/battenberg_wgs.R RUN ln -sf /usr/local/lib/R/site-library/Battenberg/example/filter_sv_brass.R /usr/local/bin/filter_sv_brass.R && \ ln -sf /usr/local/lib/R/site-library/Battenberg/example/battenberg_cleanup.sh /usr/local/bin/battenberg_cleanup.sh From ad2dd1f02ac3cb16364fa12a81e7a089f9c91914 Mon Sep 17 00:00:00 2001 From: Mootor Date: Fri, 26 Jul 2024 16:49:45 -0700 Subject: [PATCH 6/9] add dependencies using conda --- Dockerfile | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/Dockerfile b/Dockerfile index 2cc3f0d..87535d9 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,5 +1,21 @@ +ARG MINIFORGE_VERSION=23.1.0-1 + +FROM condaforge/mambaforge:${MINIFORGE_VERSION} AS builder + +# Use mamba to install tools and dependencies into /usr/local +ARG HTSLIB_VERSION=1.16 +ARG ALLELECOUNT_VERSION=4.3.0 +ARG IMPUTE2_VERSION=2.3.2 +RUN mamba create -qy -p /usr/local \ + -c bioconda \ + -c conda-forge \ + htslib==${HTSLIB_VERSION} \ + cancerit-allelecount==${ALLELECOUNT_VERSION} \ + impute2==${IMPUTE2_VERSION} + FROM ubuntu:20.04 FROM r-base:4.4.1 +COPY --from=builder /usr/local /usr/local RUN apt-get update \ && apt-get install -y --no-install-recommends \ @@ -12,7 +28,7 @@ RUN apt-get update \ python3 # Main tool version -ARG BATTENBERG_VERSION=2.2.9 +ARG BATTENBERG_VERSION="2.2.9" # Dependency version or commit ID ARG ASCAT_VERSION=3.1.3 @@ -27,11 +43,11 @@ ARG BATTENBERG="Wedge-lab/battenberg@v${BATTENBERG_VERSION}" ARG LIBRARY="/usr/lib/R/site-library" # Install Package Dependency toolkit -RUN library=${LIBRARY} R -e 'install.packages(c("argparse", "pkgdepends"), lib = Sys.getenv("library"))' +RUN library=${LIBRARY} R -e 'install.packages(c("argparse", "BiocManager", "pkgdepends", "optparse"), lib = Sys.getenv("library"))' &&\ + R -q -e 'BiocManager::install(c("ellipsis", "splines", "VariantAnnotation"))' # Install Battenberg COPY installer.R /usr/local/bin/installer.R - RUN chmod +x /usr/local/bin/installer.R RUN Rscript /usr/local/bin/installer.R -l ${LIBRARY} -d ${COPYNUMBER} ${ASCAT} ${BATTENBERG} From 6fd9f484e8e79ed1712ef6e6991936613d0d3ac4 Mon Sep 17 00:00:00 2001 From: Mootor Date: Fri, 26 Jul 2024 16:52:42 -0700 Subject: [PATCH 7/9] Update CHANGELOG.md --- CHANGELOG.md | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index b122cfa..5374755 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,15 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +--- +## Unreleased +### Chanded +- Use the official `r-base:4.4.1` docker image +- Replace GitHub package installation with `pkgdepends` + +### Added +- Add installer.R that uses `pkgdepends` + --- ## [2.2.9] - 2023-06-27 From bd078317d3657aa5dd35ba1e48294a984f912e8d Mon Sep 17 00:00:00 2001 From: Mootor Date: Fri, 26 Jul 2024 17:07:34 -0700 Subject: [PATCH 8/9] add apt-get list removal --- Dockerfile | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 87535d9..f171335 100644 --- a/Dockerfile +++ b/Dockerfile @@ -25,7 +25,8 @@ RUN apt-get update \ libpng-dev \ libssl-dev \ libxml2-dev \ - python3 + python3 \ + && apt-get clean && rm -rf /var/lib/apt/lists/* # Main tool version ARG BATTENBERG_VERSION="2.2.9" From 8728e1c2ede40f42aeaeb25a928eb9ad942cc1ae Mon Sep 17 00:00:00 2001 From: Mootor Date: Tue, 30 Jul 2024 12:05:11 -0700 Subject: [PATCH 9/9] add space --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index f171335..4f368ad 100644 --- a/Dockerfile +++ b/Dockerfile @@ -44,7 +44,7 @@ ARG BATTENBERG="Wedge-lab/battenberg@v${BATTENBERG_VERSION}" ARG LIBRARY="/usr/lib/R/site-library" # Install Package Dependency toolkit -RUN library=${LIBRARY} R -e 'install.packages(c("argparse", "BiocManager", "pkgdepends", "optparse"), lib = Sys.getenv("library"))' &&\ +RUN library=${LIBRARY} R -e 'install.packages(c("argparse", "BiocManager", "pkgdepends", "optparse"), lib = Sys.getenv("library"))' && \ R -q -e 'BiocManager::install(c("ellipsis", "splines", "VariantAnnotation"))' # Install Battenberg