Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use pkgdepends #20

Merged
merged 9 commits into from
Jul 30, 2024
Merged
Show file tree
Hide file tree
Changes from 8 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
49 changes: 34 additions & 15 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -13,31 +13,50 @@
cancerit-allelecount==${ALLELECOUNT_VERSION} \
impute2==${IMPUTE2_VERSION}

# Deploy the target tools into a base image
FROM ubuntu:20.04
FROM r-base:4.4.1

Check notice on line 17 in Dockerfile

View check run for this annotation

Wiz Inc. (8da00b022c) / Wiz IaC Scanner

Healthcheck Instruction Missing

Rule ID: b0f1f03a-461a-4b7b-8daf-a61ca12d86da Severity: Low Resource: FROM={{r-base:4.4.1}} Ensure that HEALTHCHECK is being used. The HEALTHCHECK instruction tells Docker how to test a container to check that it is still working
Raw output
Expected: Dockerfile should contain instruction 'HEALTHCHECK'
Found: Dockerfile doesn't contain instruction 'HEALTHCHECK'
COPY --from=builder /usr/local /usr/local

ARG DEBIAN_FRONTEND=noninteractive
RUN apt-get update \

Check warning on line 20 in Dockerfile

View check run for this annotation

Wiz Inc. (8da00b022c) / Wiz IaC Scanner

Apt Get Install Pin Version Not Defined

Rule ID: fd057dc6-f93a-4b30-87e8-68e1d9ff61c9 Severity: Medium Resource: FROM={{r-base:4.4.1}}.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 && apt-get clean && rm -rf /var/lib/apt/lists/*}} When installing a package, its pin version should be defined
Raw output
Expected: Package 'python3' has version defined
Found: Package 'python3' does not have version defined

Check warning on line 20 in Dockerfile

View check run for this annotation

Wiz Inc. (8da00b022c) / Wiz IaC Scanner

Apt Get Install Pin Version Not Defined

Rule ID: fd057dc6-f93a-4b30-87e8-68e1d9ff61c9 Severity: Medium Resource: FROM={{r-base:4.4.1}}.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 && apt-get clean && rm -rf /var/lib/apt/lists/*}} When installing a package, its pin version should be defined
Raw output
Expected: Package 'libbz2-dev' has version defined
Found: Package 'libbz2-dev' does not have version defined

Check warning on line 20 in Dockerfile

View check run for this annotation

Wiz Inc. (8da00b022c) / Wiz IaC Scanner

Apt Get Install Pin Version Not Defined

Rule ID: fd057dc6-f93a-4b30-87e8-68e1d9ff61c9 Severity: Medium Resource: FROM={{r-base:4.4.1}}.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 && apt-get clean && rm -rf /var/lib/apt/lists/*}} When installing a package, its pin version should be defined
Raw output
Expected: Package 'libcurl4-openssl-dev' has version defined
Found: Package 'libcurl4-openssl-dev' does not have version defined

Check warning on line 20 in Dockerfile

View check run for this annotation

Wiz Inc. (8da00b022c) / Wiz IaC Scanner

Apt Get Install Pin Version Not Defined

Rule ID: fd057dc6-f93a-4b30-87e8-68e1d9ff61c9 Severity: Medium Resource: FROM={{r-base:4.4.1}}.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 && apt-get clean && rm -rf /var/lib/apt/lists/*}} When installing a package, its pin version should be defined
Raw output
Expected: Package 'liblzma-dev' has version defined
Found: Package 'liblzma-dev' does not have version defined

Check warning on line 20 in Dockerfile

View check run for this annotation

Wiz Inc. (8da00b022c) / Wiz IaC Scanner

Apt Get Install Pin Version Not Defined

Rule ID: fd057dc6-f93a-4b30-87e8-68e1d9ff61c9 Severity: Medium Resource: FROM={{r-base:4.4.1}}.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 && apt-get clean && rm -rf /var/lib/apt/lists/*}} When installing a package, its pin version should be defined
Raw output
Expected: Package 'libpng-dev' has version defined
Found: Package 'libpng-dev' does not have version defined

Check warning on line 20 in Dockerfile

View check run for this annotation

Wiz Inc. (8da00b022c) / Wiz IaC Scanner

Apt Get Install Pin Version Not Defined

Rule ID: fd057dc6-f93a-4b30-87e8-68e1d9ff61c9 Severity: Medium Resource: FROM={{r-base:4.4.1}}.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 && apt-get clean && rm -rf /var/lib/apt/lists/*}} When installing a package, its pin version should be defined
Raw output
Expected: Package 'libssl-dev' has version defined
Found: Package 'libssl-dev' does not have version defined

Check warning on line 20 in Dockerfile

View check run for this annotation

Wiz Inc. (8da00b022c) / Wiz IaC Scanner

Apt Get Install Pin Version Not Defined

Rule ID: fd057dc6-f93a-4b30-87e8-68e1d9ff61c9 Severity: Medium Resource: FROM={{r-base:4.4.1}}.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 && apt-get clean && rm -rf /var/lib/apt/lists/*}} When installing a package, its pin version should be defined
Raw output
Expected: Package 'libxml2-dev' has version defined
Found: Package 'libxml2-dev' does not have version defined
&& apt-get install -y --no-install-recommends \
libcurl4-openssl-dev \
libbz2-dev \
liblzma-dev \
libpng-dev \
libssl-dev \
libxml2-dev \
python3 \
&& apt-get clean && rm -rf /var/lib/apt/lists/*

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/*
# Main tool version
ARG BATTENBERG_VERSION="2.2.9"

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"))'
# Dependency version or commit ID
ARG ASCAT_VERSION=3.1.3
ARG COPYNUMBER_VERSION="b404a4d"

# Install devtools, ASCAT & Battenberg
RUN R -q -e 'install.packages("devtools", dependencies = TRUE)' && \
R -q -e 'devtools::install_github("Crick-CancerGenomics/ascat/[email protected]")' && \
R -q -e 'devtools::install_github("Wedge-Oxford/[email protected]")'
# 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}"

# 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", "BiocManager", "pkgdepends", "optparse"), lib = Sys.getenv("library"))' &&\
Faizal-Eeman marked this conversation as resolved.
Show resolved Hide resolved
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}

# 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
Expand Down
29 changes: 29 additions & 0 deletions installer.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
library(argparse);
library(pkgdepends);

parser <- ArgumentParser();

parser$add_argument(
'-l',
'--lib',
help = 'Library path to install the tools'
);
parser$add_argument(
'-d',
'--dependencies',
nargs = '+',
help = 'List dependencies separated by space'
);

args <- parser$parse_args();

tools <- args$dependencies;
lib <- args$lib;

pkg.installation.proposal <- new_pkg_installation_proposal(
tools,
config = list(library = lib)
);
pkg.installation.proposal$solve();
pkg.installation.proposal$download();
pkg.installation.proposal$install();
Loading