diff --git a/.syncweaver-lock.json b/.syncweaver-lock.json index 4b0eee8..673b63a 100644 --- a/.syncweaver-lock.json +++ b/.syncweaver-lock.json @@ -4,8 +4,8 @@ "sources": { "code/MOSuite": { "repo_url": "https://github.com/CCBR/MOSuite", - "ref": "main", - "git_sha": "c09ee39f9b282237f13d88dcf4cdfed965209c68", + "ref": "v0.3.2", + "git_sha": "f4465c58a7d04f5feb41d4455a019ca4946a4ca8", "installed_by": [ "syncweaver" ] diff --git a/code/MOSuite/.github/package-versions.txt b/code/MOSuite/.github/package-versions.txt deleted file mode 100644 index 8d99fc0..0000000 --- a/code/MOSuite/.github/package-versions.txt +++ /dev/null @@ -1 +0,0 @@ -any::ggplot2@3.5.2 diff --git a/code/MOSuite/.github/requirements.txt b/code/MOSuite/.github/requirements.txt new file mode 100644 index 0000000..e69de29 diff --git a/code/MOSuite/.github/workflows/R-CMD-check.yaml b/code/MOSuite/.github/workflows/R-CMD-check.yaml index 97d3f32..e4a69e6 100644 --- a/code/MOSuite/.github/workflows/R-CMD-check.yaml +++ b/code/MOSuite/.github/workflows/R-CMD-check.yaml @@ -32,13 +32,15 @@ jobs: R_KEEP_PKG_SOURCE: yes steps: - uses: actions/checkout@v6 - - uses: CCBR/actions/install-r-pak@main + - uses: r-lib/actions/setup-r@v2 with: - versions-file: .github/package-versions.txt - extra-packages: local::. - needs: dev r-version: ${{ matrix.config.r }} http-user-agent: ${{ matrix.config.http-user-agent }} + use-public-rspm: true + - uses: r-lib/actions/setup-r-dependencies@v2 + with: + extra-packages: local::. + needs: dev - uses: r-lib/actions/check-r-package@v2 with: upload-snapshots: true @@ -47,10 +49,12 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v6 - - uses: CCBR/actions/install-r-pak@main + - uses: r-lib/actions/setup-r@v2 + with: + r-version: '4.5' + use-public-rspm: true + - uses: r-lib/actions/setup-r-dependencies@v2 with: - r-version: 4.5 - versions-file: .github/package-versions.txt needs: dev - name: Lint shell: Rscript {0} diff --git a/code/MOSuite/.github/workflows/auto-format.yml b/code/MOSuite/.github/workflows/auto-format.yml index bc5d53b..758c5ba 100644 --- a/code/MOSuite/.github/workflows/auto-format.yml +++ b/code/MOSuite/.github/workflows/auto-format.yml @@ -38,10 +38,13 @@ jobs: git config --global user.name "CCBR-bot" git config --global user.email "258092125+ccbr-bot@users.noreply.github.com" - - uses: CCBR/actions/install-r-pak@main + - uses: r-lib/actions/setup-r@v2 + with: + r-version: '4.5' + use-public-rspm: true + + - uses: r-lib/actions/setup-r-dependencies@v2 with: - r-version: 4.5 - versions-file: .github/package-versions.txt extra-packages: local::. needs: dev diff --git a/code/MOSuite/.github/workflows/draft-release.yml b/code/MOSuite/.github/workflows/draft-release.yml new file mode 100644 index 0000000..3b847ca --- /dev/null +++ b/code/MOSuite/.github/workflows/draft-release.yml @@ -0,0 +1,31 @@ +name: draft-release + +on: + workflow_dispatch: + inputs: + version-tag: + description: | + Semantic version tag for next release. + If not provided, it will be determined based on conventional commit history. + Example: v2.5.11 + required: false + type: string + default: "" + +permissions: + contents: write + pull-requests: write + actions: write + +jobs: + draft-release: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v6 + with: + fetch-depth: 0 # required to include tags + - uses: CCBR/actions/draft-release@latest + with: + github-token: ${{ github.token }} + version-tag: ${{ github.event.inputs.version-tag }} + ccbr-actions-version: latest diff --git a/code/MOSuite/.github/workflows/pkgdown.yaml b/code/MOSuite/.github/workflows/pkgdown.yaml index ac57479..12ff76a 100644 --- a/code/MOSuite/.github/workflows/pkgdown.yaml +++ b/code/MOSuite/.github/workflows/pkgdown.yaml @@ -27,10 +27,13 @@ jobs: steps: - uses: actions/checkout@v6 - - uses: CCBR/actions/install-r-pak@main + - uses: r-lib/actions/setup-r@v2 + with: + r-version: '4.5' + use-public-rspm: true + + - uses: r-lib/actions/setup-r-dependencies@v2 with: - r-version: 4.5 - versions-file: .github/package-versions.txt extra-packages: local::. needs: dev diff --git a/code/MOSuite/.github/workflows/post-release.yml b/code/MOSuite/.github/workflows/post-release.yml new file mode 100644 index 0000000..81ac73f --- /dev/null +++ b/code/MOSuite/.github/workflows/post-release.yml @@ -0,0 +1,24 @@ +name: post-release + +on: + release: + types: + - published + +permissions: + contents: write + pull-requests: write + actions: write + +jobs: + cleanup: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v6 + with: + fetch-depth: 0 + - uses: CCBR/actions/post-release@latest + with: + github-token: ${{ github.token }} + update-sliding-tags: false + ccbr-actions-version: latest diff --git a/code/MOSuite/.github/workflows/test-coverage.yaml b/code/MOSuite/.github/workflows/test-coverage.yaml index 6531d6f..26f3f0a 100644 --- a/code/MOSuite/.github/workflows/test-coverage.yaml +++ b/code/MOSuite/.github/workflows/test-coverage.yaml @@ -35,10 +35,13 @@ jobs: steps: - uses: actions/checkout@v4 - - uses: CCBR/actions/install-r-pak@main + - uses: r-lib/actions/setup-r@v2 + with: + r-version: '4.5' + use-public-rspm: true + + - uses: r-lib/actions/setup-r-dependencies@v2 with: - r-version: 4.5 - versions-file: .github/package-versions.txt needs: dev - name: Test coverage diff --git a/code/MOSuite/.pre-commit-config.yaml b/code/MOSuite/.pre-commit-config.yaml index 7331cb1..a09d9f3 100644 --- a/code/MOSuite/.pre-commit-config.yaml +++ b/code/MOSuite/.pre-commit-config.yaml @@ -30,7 +30,7 @@ repos: hooks: - id: air-format - repo: https://github.com/lorenzwalthert/precommit - rev: v0.4.3.9021 + rev: v0.4.3.9025 hooks: - id: parsable-R - id: readme-rmd-rendered diff --git a/code/MOSuite/CITATION.cff b/code/MOSuite/CITATION.cff index 541c136..9768535 100644 --- a/code/MOSuite/CITATION.cff +++ b/code/MOSuite/CITATION.cff @@ -1,14 +1,14 @@ -# -------------------------------------------- -# CITATION file created with {cffr} R package +# ------------------------------------------------ +# CITATION.cff file created with {cffr} R package # See also: https://docs.ropensci.org/cffr/ -# -------------------------------------------- +# ------------------------------------------------ cff-version: 1.2.0 message: 'To cite package "MOSuite" in publications use:' type: software license: MIT title: 'MOSuite: R package for differential multi-omics analysis' -version: 0.3.1 +version: 0.3.2 doi: 10.5281/zenodo.16371580 identifiers: - description: Archived snapshots of all versions @@ -71,10 +71,13 @@ references: url: https://www.R-project.org/ authors: - name: R Core Team + website: https://ror.org/02zz1nj61 institution: name: R Foundation for Statistical Computing + website: https://ror.org/05qewa988 address: Vienna, Austria year: '2026' + doi: 10.32614/R.manuals version: '>= 4.0.0' - type: software title: assertthat @@ -215,7 +218,6 @@ references: orcid: https://orcid.org/0000-0002-9335-7468 year: '2026' doi: 10.32614/CRAN.package.ggplot2 - version: < 4.0.0 - type: software title: glue abstract: 'glue: Interpreted String Literals' @@ -278,51 +280,8 @@ references: authors: - family-names: Smyth given-names: Gordon - - family-names: Hu - given-names: Yifang - - family-names: Ritchie - given-names: Matthew - - family-names: Silver - given-names: Jeremy - - family-names: Wettenhall - given-names: James - - family-names: McCarthy - given-names: Davis - - family-names: Wu - given-names: Di - - family-names: Shi - given-names: Wei - - family-names: Phipson - given-names: Belinda - - family-names: Lun - given-names: Aaron - - family-names: Thorne - given-names: Natalie - - family-names: Oshlack - given-names: Alicia - - family-names: Graaf - given-names: Carolyn - name-particle: de - - family-names: Chen - given-names: Yunshun - - family-names: Giner - given-names: Goknur - - family-names: Langaas - given-names: Mette - - family-names: Ferkingstad - given-names: Egil - - family-names: Davy - given-names: Marcus - - family-names: Pepin - given-names: Francois - - family-names: Choi - given-names: Dongseok - - family-names: Law - given-names: Charity - - family-names: Li - given-names: Mengbo - - family-names: Chen - given-names: Lizhong + email: smyth@wehi.edu.au + orcid: https://orcid.org/0000-0001-9221-2892 year: '2026' doi: 10.18129/B9.bioc.limma - type: software @@ -344,10 +303,13 @@ references: notes: Imports authors: - name: R Core Team + website: https://ror.org/02zz1nj61 institution: name: R Foundation for Statistical Computing + website: https://ror.org/05qewa988 address: Vienna, Austria year: '2026' + doi: 10.32614/R.manuals - type: software title: options abstract: 'options: Simple, Consistent Package Options' @@ -470,10 +432,13 @@ references: notes: Imports authors: - name: R Core Team + website: https://ror.org/02zz1nj61 institution: name: R Foundation for Statistical Computing + website: https://ror.org/05qewa988 address: Vienna, Austria year: '2026' + doi: 10.32614/R.manuals - type: software title: stringr abstract: 'stringr: Simple, Consistent Wrappers for Common String Operations' @@ -584,7 +549,7 @@ references: doi: 10.32614/CRAN.package.broom - type: software title: cffr - abstract: 'cffr: Generate Citation File Format (''cff'') Metadata for R Packages' + abstract: 'cffr: Generate Citation File Format (''CFF'') Metadata for R Packages' notes: Suggests url: https://docs.ropensci.org/cffr/ repository: https://CRAN.R-project.org/package=cffr @@ -961,9 +926,12 @@ references: abstract: 'UpSetR: A More Scalable Alternative to Venn and Euler Diagrams for Visualizing Intersecting Sets' notes: Suggests - url: http://github.com/hms-dbmi/UpSetR + url: https://github.com/hms-dbmi/UpSetR repository: https://CRAN.R-project.org/package=UpSetR authors: + - family-names: Conway + given-names: Jake + email: jake.conway@pathai.com - family-names: Gehlenborg given-names: Nils email: nils@hms.harvard.edu diff --git a/code/MOSuite/DESCRIPTION b/code/MOSuite/DESCRIPTION index 9f48d10..8f728ed 100644 --- a/code/MOSuite/DESCRIPTION +++ b/code/MOSuite/DESCRIPTION @@ -1,6 +1,6 @@ Package: MOSuite Title: R package for differential multi-omics analysis -Version: 0.3.1 +Version: 0.3.2 Authors@R: c( person("Kelly", "Sovacool", , "kelly.sovacool@nih.gov", role = c("aut", "cre"), comment = c(ORCID = "0000-0003-3283-829X")), @@ -29,7 +29,7 @@ Imports: DESeq2, dplyr, edgeR, - ggplot2 (< 4.0.0), + ggplot2, glue, htmlwidgets, jsonlite, diff --git a/code/MOSuite/NEWS.md b/code/MOSuite/NEWS.md index 24d05da..a1c1f01 100644 --- a/code/MOSuite/NEWS.md +++ b/code/MOSuite/NEWS.md @@ -1,8 +1,12 @@ +## 0.3.2 + +- Support ggplot2 v4.0.0 for correlation heatmap plots in `filter_counts()`, `normalize_counts()`, and `batch_correct_counts()`. (#205, @copilot, @kelly-sovacool) + ## MOSuite 0.3.1 - Fix recursion error in `plot_venn_diagram()`. (#188, @kelly-sovacool) - Fix S7 dispatch argument mismatch in `plot_read_depth()` and `plot_histogram()`. (#200, @copilot, @kelly-sovacool) -- Fix crash in `remove_low_count_genes()` when `use_group_based_filtering = TRUE`. (#200, @copilot, @kelly-sovacool) +- Fix bug in `remove_low_count_genes()` when `use_group_based_filtering = TRUE`. (#200, @copilot, @kelly-sovacool) - Fix color palette selection to fall back to random colors with a message when the number of categories exceeds the palette maximum. (#204, @copilot, @kelly-sovacool) - Update S7 class, generic, and method documentation to use roxygen2 v8.0.0. (#206, #212, @copilot, @kelly-sovacool) - A docker container with only MOSuite's dependencies, not MOSuite itself, is now available: . (#209, @kelly-sovacool) diff --git a/code/MOSuite/R/batch-correction.R b/code/MOSuite/R/batch-correction.R index 7e18183..bcbf63e 100644 --- a/code/MOSuite/R/batch-correction.R +++ b/code/MOSuite/R/batch-correction.R @@ -158,6 +158,7 @@ batch_correct_counts <- function( group_colname = batch_colname, label_colname = label_colname, color_values = colors_for_plots, + print_plots = FALSE, save_plots = FALSE ) + ggplot2::labs(caption = "batch-corrected counts") @@ -181,8 +182,7 @@ batch_correct_counts <- function( group_colname = batch_colname, label_colname = label_colname, color_values = colors_for_plots - ) + - ggplot2::labs(caption = "batch-corrected counts") + ) print_or_save_plot( pca_plot, @@ -200,7 +200,8 @@ batch_correct_counts <- function( corHM_plot, filename = file.path(plots_subdir, "corr_heatmap.png"), print_plots = print_plots, - save_plots = save_plots + save_plots = save_plots, + caption = "batch-corrected counts" ) } diff --git a/code/MOSuite/R/filter.R b/code/MOSuite/R/filter.R index 7e0625f..b520ef1 100644 --- a/code/MOSuite/R/filter.R +++ b/code/MOSuite/R/filter.R @@ -216,6 +216,7 @@ filter_counts <- function( label_font_size = label_font_size, label_offset_y_ = label_offset_y_, label_offset_x_ = label_offset_x_, + print_plots = FALSE, save_plots = FALSE ) + ggplot2::labs(caption = "filtered counts") @@ -246,13 +247,13 @@ filter_counts <- function( label_colname = label_colname, group_colname = group_colname, color_values = colors_for_plots - ) + - ggplot2::labs(caption = "filtered counts") + ) print_or_save_plot( corHM, filename = file.path(plots_subdir, "corr_heatmap.png"), print_plots = print_plots, - save_plots = save_plots + save_plots = save_plots, + caption = "filtered counts" ) } diff --git a/code/MOSuite/R/normalize.R b/code/MOSuite/R/normalize.R index e6ebd76..4823217 100644 --- a/code/MOSuite/R/normalize.R +++ b/code/MOSuite/R/normalize.R @@ -129,6 +129,7 @@ normalize_counts <- function( label_font_size = label_font_size, label_offset_y_ = label_offset_y_, label_offset_x_ = label_offset_x_, + print_plots = FALSE, save_plots = FALSE ) + ggplot2::labs(caption = "normalized counts") @@ -156,13 +157,13 @@ normalize_counts <- function( group_colname = group_colname, label_colname = label_colname, color_values = colors_for_plots - ) + - ggplot2::labs(caption = "normalized counts") + ) print_or_save_plot( corHM_plot, filename = file.path(plots_subdir, "corr_heatmap.png"), print_plots = print_plots, - save_plots = save_plots + save_plots = save_plots, + caption = "normalized counts" ) } diff --git a/code/MOSuite/R/plots.R b/code/MOSuite/R/plots.R index c814b78..1d5770e 100644 --- a/code/MOSuite/R/plots.R +++ b/code/MOSuite/R/plots.R @@ -3,12 +3,15 @@ #' If `save_plots` is `TRUE`, the plot will be saved as an image to the path at #' `file.path(plots_dir, filename)`. #' If `plot_obj` is a ggplot, `ggplot2::ggsave()` is used to save the image. -#' Otherwise, `graphics_device` is used (`grDevice::png()` by default). +#' Otherwise, `graphics_device` is used (`grDevices::png()` by default). #' #' @inheritParams option_params #' @param plot_obj plot object (e.g. ggplot, ComplexHeatmap...) #' @param filename name of the output file. will be joined with the `plots_dir` option. -#' @param graphics_device Default: `grDevice::png()`. Only used if the plot is not a ggplot. +#' @param graphics_device Default: `grDevices::png()`. Only used if the plot is not a ggplot. +#' @param caption optional caption text to add to the plot. For ggplot objects, this is +#' added via `ggplot2::labs(caption = caption)`. For `ComplexHeatmap` objects, the +#' caption is rendered at the bottom of the graphics device using `grid::grid.text()`. #' @param ... arguments forwarded to `ggplot2::ggsave()` #' #' @return invisibly returns the path where the plot image was saved to the disk @@ -22,10 +25,30 @@ print_or_save_plot <- function( save_plots = options::opt("save_plots"), plots_dir = options::opt("plots_dir"), graphics_device = grDevices::png, + caption = NULL, ... ) { + draw_heatmap_with_caption <- function(hm) { + ComplexHeatmap::draw(hm) + if (!is.null(caption)) { + grid::grid.text( + caption, + x = grid::unit(0.5, "npc"), + y = grid::unit(2, "mm"), + just = "bottom", + gp = grid::gpar(fontsize = 9, col = "grey40") + ) + } + } + if (!is.null(caption) && inherits(plot_obj, "ggplot")) { + plot_obj <- plot_obj + ggplot2::labs(caption = caption) + } if (isTRUE(print_plots)) { - print(plot_obj) + if (inherits(plot_obj, c("Heatmap", "HeatmapList"))) { + draw_heatmap_with_caption(plot_obj) + } else { + print(plot_obj) + } } if (isTRUE(save_plots)) { # create output directory if it doesn't exist @@ -42,10 +65,14 @@ print_or_save_plot <- function( ggplot2::ggsave(filename = filename, plot = plot_obj, ...) } else if (inherits(plot_obj, "htmlwidget")) { htmlwidgets::saveWidget(plot_obj, filename, ...) + } else if (inherits(plot_obj, c("Heatmap", "HeatmapList"))) { + graphics_device(file = filename) + on.exit(grDevices::dev.off(), add = TRUE) + draw_heatmap_with_caption(plot_obj) } else { graphics_device(file = filename) + on.exit(grDevices::dev.off(), add = TRUE) plot(plot_obj) - grDevices::dev.off() } } return(invisible(filename)) diff --git a/code/MOSuite/codemeta.json b/code/MOSuite/codemeta.json index cb4a191..5cf8660 100644 --- a/code/MOSuite/codemeta.json +++ b/code/MOSuite/codemeta.json @@ -32,5 +32,5 @@ "license": "https://spdx.org/licenses/MIT", "name": "MOSuite: R package for differential multi-omics analysis", "url": "https://ccbr.github.io/MOSuite/", - "version": "0.3.1" + "version": "0.3.1.9001" } diff --git a/code/MOSuite/docker/Dockerfile b/code/MOSuite/docker/Dockerfile index a97d70b..73385eb 100644 --- a/code/MOSuite/docker/Dockerfile +++ b/code/MOSuite/docker/Dockerfile @@ -21,8 +21,8 @@ RUN mamba install -y -c conda-forge \ r-colorspace \ r-dendextend \ r-devtools \ + r-ggplot2 \ r-dplyr \ - "r-ggplot2 <4.0.0" \ r-ggrepel \ r-gridExtra \ r-here \ diff --git a/code/MOSuite/docker/Dockerfile_minimal b/code/MOSuite/docker/Dockerfile_minimal index eb91b2c..014755d 100644 --- a/code/MOSuite/docker/Dockerfile_minimal +++ b/code/MOSuite/docker/Dockerfile_minimal @@ -21,8 +21,8 @@ RUN mamba install -y -c conda-forge \ r-colorspace \ r-dendextend \ r-devtools \ + r-ggplot2 \ r-dplyr \ - "r-ggplot2 <4.0.0" \ r-ggrepel \ r-gridExtra \ r-here \ diff --git a/code/MOSuite/man/print_or_save_plot.Rd b/code/MOSuite/man/print_or_save_plot.Rd index 4d22ef1..450ea1d 100644 --- a/code/MOSuite/man/print_or_save_plot.Rd +++ b/code/MOSuite/man/print_or_save_plot.Rd @@ -11,6 +11,7 @@ print_or_save_plot( save_plots = options::opt("save_plots"), plots_dir = options::opt("plots_dir"), graphics_device = grDevices::png, + caption = NULL, ... ) } @@ -25,7 +26,11 @@ print_or_save_plot( \item{plots_dir}{Path where plots are saved when \code{moo_save_plots} is \code{TRUE} (Defaults to \code{"figures/"}, overwritable using option 'moo_plots_dir' or environment variable 'MOO_PLOTS_DIR')} -\item{graphics_device}{Default: \code{grDevice::png()}. Only used if the plot is not a ggplot.} +\item{graphics_device}{Default: \code{grDevices::png()}. Only used if the plot is not a ggplot.} + +\item{caption}{optional caption text to add to the plot. For ggplot objects, this is +added via \code{ggplot2::labs(caption = caption)}. For \code{ComplexHeatmap} objects, the +caption is rendered at the bottom of the graphics device using \code{grid::grid.text()}.} \item{...}{arguments forwarded to \code{ggplot2::ggsave()}} } @@ -36,7 +41,7 @@ invisibly returns the path where the plot image was saved to the disk If \code{save_plots} is \code{TRUE}, the plot will be saved as an image to the path at \code{file.path(plots_dir, filename)}. If \code{plot_obj} is a ggplot, \code{ggplot2::ggsave()} is used to save the image. -Otherwise, \code{graphics_device} is used (\code{grDevice::png()} by default). +Otherwise, \code{graphics_device} is used (\code{grDevices::png()} by default). } \seealso{ Other plotters: diff --git a/code/MOSuite/tests/testthat/test-plot_volcano_enhanced.R b/code/MOSuite/tests/testthat/test-plot_volcano_enhanced.R index 6f351ca..a115797 100644 --- a/code/MOSuite/tests/testthat/test-plot_volcano_enhanced.R +++ b/code/MOSuite/tests/testthat/test-plot_volcano_enhanced.R @@ -1,4 +1,5 @@ test_that("plot_volcano_enhanced works on nidap dataset", { + skip_on_ci() expect_snapshot( df_volc_enh <- plot_volcano_enhanced( nidap_deg_analysis, diff --git a/code/MOSuite/tests/testthat/test-plots.R b/code/MOSuite/tests/testthat/test-plots.R index 43ada4f..bb965f3 100644 --- a/code/MOSuite/tests/testthat/test-plots.R +++ b/code/MOSuite/tests/testthat/test-plots.R @@ -1,6 +1,7 @@ set.seed(20250225) -test_that("save_or_print_plot works for ComplexHeatmap", { - p <- plot_corr_heatmap( + +corr_heatmap_fixture <- function() { + plot_corr_heatmap( nidap_filtered_counts |> as.data.frame(), sample_metadata = as.data.frame(nidap_sample_metadata), @@ -23,7 +24,59 @@ test_that("save_or_print_plot works for ComplexHeatmap", { "#878500" ) ) - skip() +} + +test_that("print_or_save_plot saves ComplexHeatmap to disk without error", { + p <- corr_heatmap_fixture() + outfile <- tempfile(fileext = ".png") + result <- print_or_save_plot( + p, + filename = outfile, + print_plots = FALSE, + save_plots = TRUE, + plots_dir = "", + caption = "filtered counts" + ) + expect_equal(result, outfile) + expect_true(file.exists(outfile)) + expect_gt(file.size(outfile), 0) +}) + +test_that("print_or_save_plot saves ggplot without error", { + p <- plot_read_depth(nidap_clean_raw_counts) + outfile <- tempfile(fileext = ".png") + result <- print_or_save_plot( + p, + filename = outfile, + print_plots = FALSE, + save_plots = TRUE, + plots_dir = "", + caption = "normalized counts" + ) + expect_equal(result, outfile) + expect_true(file.exists(outfile)) + expect_gt(file.size(outfile), 0) +}) + +test_that("print_or_save_plot prints ComplexHeatmap with caption without error", { + p <- corr_heatmap_fixture() + outfile <- tempfile(fileext = ".png") + withr::with_png(outfile, { + result <- print_or_save_plot( + p, + filename = outfile, + print_plots = TRUE, + save_plots = FALSE, + plots_dir = "", + caption = "batch-corrected counts" + ) + }) + expect_equal(result, outfile) +}) + +test_that("save_or_print_plot works for ComplexHeatmap", { + p <- corr_heatmap_fixture() + skip_on_ci() expect_snapshot_file( print_or_save_plot( p, @@ -37,7 +90,7 @@ test_that("save_or_print_plot works for ComplexHeatmap", { }) test_that("save_or_print_plot works for ggplot", { p <- plot_read_depth(nidap_clean_raw_counts) - skip() + skip_on_ci() expect_snapshot_file( print_or_save_plot( p, diff --git a/code/main.R b/code/main.R index 9ce2ad5..c99b0fe 100644 --- a/code/main.R +++ b/code/main.R @@ -32,8 +32,8 @@ parser$add_argument( args <- parser$parse_args() # find input files -regex_count = args$regex_count -regex_sample = args$regex_sample +regex_count <- args$regex_count +regex_sample <- args$regex_sample data_dir <- "../data" data_files <- list.files( file.path(data_dir),