From 6b81364e4970b802b9cef28bf5657bdd0b178686 Mon Sep 17 00:00:00 2001 From: pdiakumis Date: Tue, 12 Dec 2023 18:52:50 +1100 Subject: [PATCH 1/3] remove tso_rmd (moved to cttsor) --- .Rbuildignore | 1 + NAMESPACE | 1 - R/rmd.R | 39 ------------------- man/tso_rmd.Rd | 33 ---------------- .../test-roxytest-testexamples-dragen.R | 2 +- 5 files changed, 2 insertions(+), 74 deletions(-) delete mode 100644 R/rmd.R delete mode 100644 man/tso_rmd.Rd diff --git a/.Rbuildignore b/.Rbuildignore index 2b8b141..9a6a3bf 100644 --- a/.Rbuildignore +++ b/.Rbuildignore @@ -31,3 +31,4 @@ CODE_OF_CONDUCT.md inst/rmd/umccr_portal/html inst/rmd/umccr_workflows/umccrise/html inst/rmd/umccr_workflows/bcl_convert/html +inst/rmd/umccr_workflows/alignment_qc/html diff --git a/NAMESPACE b/NAMESPACE index 2962a0c..27bac68 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -79,7 +79,6 @@ export(s3_files_list_filter_relevant) export(s3_search) export(session_info_kable) export(time_metrics_process) -export(tso_rmd) export(umccr_tidy) importFrom(R6,R6Class) importFrom(ggplot2,ggplot) diff --git a/R/rmd.R b/R/rmd.R deleted file mode 100644 index 70b58f2..0000000 --- a/R/rmd.R +++ /dev/null @@ -1,39 +0,0 @@ -#' Generate TSO Report -#' -#' Generates a HTML report with results from the UMCCR TSO500 ctDNA workflow. -#' @param tidy_rds Path to RDS object output from `tso_tidy`. -#' @param out_dir Output directory. -#' @param prefix Prefix of output file(s). -#' @param quiet Suppress warning and other messages. -#' -#' @return Path to rendered HTML report. -#' @examples -#' \dontrun{ -#' tidy_rds <- "~/tmp/tso/SBJ02858.rds" -#' tso_tidy(...) |> saveRDS(tidy_rds) -#' quiet <- TRUE -#' out_dir <- file.path("~/tmp/tso/out2") -#' prefix <- "SBJ02858" -#' tso_rmd(tidy_rds = tidy_rds, out_dir = out_dir, prefix = prefix, quiet = quiet) -#' } -#' @export -tso_rmd <- function(tidy_rds, out_dir, prefix, quiet = FALSE) { - e <- emojifont::emoji - assertthat::assert_that( - rlang::is_logical(quiet), file.exists(tidy_rds), fs::path_ext(tidy_rds) == "rds" - ) - tmp_dir <- tempdir() - rmd_dir <- system.file("rmd/tso", package = "dracarys") - fs::dir_copy(rmd_dir, tmp_dir, overwrite = TRUE) - rmd_file <- file.path(tmp_dir, "tso.Rmd") - fs::dir_create(out_dir) - out_html <- glue("{prefix}_tso_dracarys_report.html") - # suppress DT large size warning - options(DT.warn.size = FALSE) - rmarkdown::render( - input = rmd_file, output_dir = out_dir, output_file = I(out_html), - params = list(rds = tidy_rds), quiet = quiet - ) - html_path <- file.path(out_dir, out_html) - cli::cli_alert_success("{date_log()} {e('sparkles')} {.emph {prefix}}: TSO HTML reportr at: {.file {html_path}}") -} diff --git a/man/tso_rmd.Rd b/man/tso_rmd.Rd deleted file mode 100644 index 3932fad..0000000 --- a/man/tso_rmd.Rd +++ /dev/null @@ -1,33 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/rmd.R -\name{tso_rmd} -\alias{tso_rmd} -\title{Generate TSO Report} -\usage{ -tso_rmd(tidy_rds, out_dir, prefix, quiet = FALSE) -} -\arguments{ -\item{tidy_rds}{Path to RDS object output from \code{tso_tidy}.} - -\item{out_dir}{Output directory.} - -\item{prefix}{Prefix of output file(s).} - -\item{quiet}{Suppress warning and other messages.} -} -\value{ -Path to rendered HTML report. -} -\description{ -Generates a HTML report with results from the UMCCR TSO500 ctDNA workflow. -} -\examples{ -\dontrun{ -tidy_rds <- "~/tmp/tso/SBJ02858.rds" -tso_tidy(...) |> saveRDS(tidy_rds) -quiet <- TRUE -out_dir <- file.path("~/tmp/tso/out2") -prefix <- "SBJ02858" -tso_rmd(tidy_rds = tidy_rds, out_dir = out_dir, prefix = prefix, quiet = quiet) -} -} diff --git a/tests/testthat/test-roxytest-testexamples-dragen.R b/tests/testthat/test-roxytest-testexamples-dragen.R index 1bcbf66..1caa4ee 100644 --- a/tests/testthat/test-roxytest-testexamples-dragen.R +++ b/tests/testthat/test-roxytest-testexamples-dragen.R @@ -2,7 +2,7 @@ # File R/dragen.R: @testexamples -test_that("Function time_metrics_process() @ L771", { +test_that("Function time_metrics_process() @ L789", { p <- system.file("extdata/wgs/SEQC-II.time_metrics.csv.gz", package = "dracarys") x <- TimeMetricsFile$new(p) From fb51c85d5513fdeb1e488c140115c660e8b4cb3c Mon Sep 17 00:00:00 2001 From: pdiakumis Date: Tue, 12 Dec 2023 18:53:27 +1100 Subject: [PATCH 2/3] multiqc: handle empty fastqc_adapter_content_plot (fixes #104) --- R/multiqc.R | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/R/multiqc.R b/R/multiqc.R index 3b499f3..b522662 100644 --- a/R/multiqc.R +++ b/R/multiqc.R @@ -373,6 +373,10 @@ multiqc_parse_xyline_plot <- function(dat) { if (dat[["config"]][["id"]] %in% c("dragen_coverage_per_contig", "dragen_coverage_per_non_main_contig")) { return(multiqc_parse_xyline_plot_contig_cvg(dat)) } + # some empty fastqc_adapter_content_plot - see https://github.com/umccr/dracarys/issues/104 + if (length(dat[["datasets"]][[1]]) == 0) { + return(NULL) + } dat[["datasets"]][[1]] |> purrr::map( function(nm_data) { From c08c42095269316f55e6f99e956c28773fb058c8 Mon Sep 17 00:00:00 2001 From: pdiakumis Date: Tue, 12 Dec 2023 19:59:59 +1100 Subject: [PATCH 3/3] GHA: update actions, use 2-step conda-lock --- .github/workflows/conda_deploy.yaml | 25 +++++++++++-------------- Dockerfile | 10 +++++----- 2 files changed, 16 insertions(+), 19 deletions(-) diff --git a/.github/workflows/conda_deploy.yaml b/.github/workflows/conda_deploy.yaml index f25267e..ec2a211 100644 --- a/.github/workflows/conda_deploy.yaml +++ b/.github/workflows/conda_deploy.yaml @@ -24,26 +24,23 @@ jobs: steps: - name: Code checkout - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Micromamba setup uses: mamba-org/setup-micromamba@v1 with: - micromamba-version: '1.4.9-0' environment-file: ${{ env.env_yaml_path }}/condabuild.yaml - name: 🐍 Conda pkg build and upload run: | dvc pull ls -l inst/extdata/* - conda mambabuild --R 4.2 ${recipe_path} --token ${atoken} + conda mambabuild --R 4.2 ${recipe_path} -c conda-forge --token ${atoken} - name: 🔒 Conda lock run: | - conda-lock --file ${env_yaml_path}/dracarys.yaml --platform linux-64 - mv conda-lock.yml ${env_lock_path}/conda-lock.yml + conda-lock lock --file ${env_yaml_path}/dracarys.yaml -p linux-64 + conda-lock render --kind explicit -p linux-64 conda-lock.yml --filename-template 'dracarys-{platform}.lock' && rm conda-lock.yml + mv dracarys-*.lock ${env_lock_path}/ - name: 💾 Commit lockfile run: | - # TODO: the version bumping guarantees there will be changes, - # but during testing this can be problematic - need to - # commit only if changes exist. git status git config --local user.email "actions@github.com" git config --local user.name "GitHub Actions" @@ -67,7 +64,7 @@ jobs: LATEST_COMMIT_HASH="$(git --no-pager log -1 --format='%H')" echo "latest_commit_hash=${LATEST_COMMIT_HASH}" >> $GITHUB_OUTPUT - name: 🔖 Create tag - uses: actions/github-script@v6 + uses: actions/github-script@v7 env: LATEST_COMMIT_HASH: ${{ steps.pull_lock_commit.outputs.latest_commit_hash }} with: @@ -83,26 +80,26 @@ jobs: # work with tag from above - name: Code checkout - uses: actions/checkout@v3 + uses: actions/checkout@v4 with: ref: v${{ env.VERSION }} - name: 🏰 QEMU setup - uses: docker/setup-qemu-action@v2 + uses: docker/setup-qemu-action@v3 - name: 🏯 Buildx setup - uses: docker/setup-buildx-action@v2 + uses: docker/setup-buildx-action@v3 with: install: true config-inline: | [worker.oci] max-parallelism = 2 - name: 🐙 GitHub CR login - uses: docker/login-action@v2 + uses: docker/login-action@v3 with: registry: ghcr.io username: ${{ github.actor }} password: ${{ secrets.GITHUB_TOKEN }} - name: 🐳 Docker img build and push - uses: docker/build-push-action@v4 + uses: docker/build-push-action@v5 with: tags: ghcr.io/${{ github.repository }}:${{ env.VERSION }} context: . # yes, dot diff --git a/Dockerfile b/Dockerfile index 958f05d..6cdbebe 100644 --- a/Dockerfile +++ b/Dockerfile @@ -8,14 +8,14 @@ RUN mamba config \ mamba install \ -c conda-forge \ -c nodefaults \ - conda-lock==1.3.0 && \ + conda-lock && \ mamba clean --all --force-pkgs-dirs +ARG DRACARYS_LOCK="dracarys-linux-64.lock" ARG ENV_NAME="dracarys_env" -COPY ./conda/env/lock/conda-lock.yml . -RUN conda-lock install --name ${ENV_NAME} conda-lock.yml && \ - mamba clean --all --force-pkgs-dirs && \ - rm conda-lock.yml +COPY ./conda/env/lock/${DRACARYS_LOCK} . +RUN conda-lock install --name ${ENV_NAME} --file ${DRACARYS_LOCK} && \ + mamba clean --all --force-pkgs-dirs ARG MAMBA_PREFIX="/opt/conda" ENV PATH="${MAMBA_PREFIX}/envs/${ENV_NAME}/bin:${PATH}"