From eefc56e630c915f308dc82b78b97835b195ea5bf Mon Sep 17 00:00:00 2001 From: phoman14 Date: Mon, 3 Aug 2026 22:10:51 -0400 Subject: [PATCH 1/5] fix: derive norm count subtype internally --- .codeocean/app-panel.json | 9 --------- code/main.R | 9 ++------- 2 files changed, 2 insertions(+), 16 deletions(-) diff --git a/.codeocean/app-panel.json b/.codeocean/app-panel.json index 22c1eab..06cd004 100644 --- a/.codeocean/app-panel.json +++ b/.codeocean/app-panel.json @@ -77,15 +77,6 @@ "batch" ] }, - { - "id": "sub_count_type_id", - "category": "FvI4Z2eb9sjL47Jt", - "name": "Sub count type", - "param_name": "sub_count_type", - "description": "Used if count_type is a list in the counts slot. This must be a name in moo@counts[[count_type]].", - "type": "text", - "value_type": "string" - }, { "id": "sample_id_colname_id", "category": "FvI4Z2eb9sjL47Jt", diff --git a/code/main.R b/code/main.R index a3eee69..c84e82d 100644 --- a/code/main.R +++ b/code/main.R @@ -14,12 +14,6 @@ setup_capsule_environment() parser <- ArgumentParser() parser$add_argument("--count_type", type = "character", default = "filt") -parser$add_argument( - "--sub_count_type", - type = "character", - default = NULL, - help = "Sub count type if count_type is a list" -) parser$add_argument( "--sample_id_colname", type = "character", @@ -262,6 +256,7 @@ parser$add_argument( ) args <- parser$parse_args() +sub_count_type <- if (identical(args$count_type, "norm")) "voom" else NULL # load multiOmicDataSet from data directory moo <- load_moo_from_data_dir() @@ -270,7 +265,7 @@ moo <- load_moo_from_data_dir() plot_expr_heatmap( moo, count_type = args$count_type, - sub_count_type = args$sub_count_type, + sub_count_type = sub_count_type, sample_id_colname = args$sample_id_colname, feature_id_colname = args$feature_id_colname, group_colname = args$group_colname, From 382f569a056547a54cee6704dd8039cb3da2d6aa Mon Sep 17 00:00:00 2001 From: phoman14 Date: Mon, 3 Aug 2026 22:21:16 -0400 Subject: [PATCH 2/5] test: cover supported count types --- tests/testthat/helper-cli.R | 28 ++++++++++++++++++++++++++++ tests/testthat/test-main.R | 6 ++++++ 2 files changed, 34 insertions(+) diff --git a/tests/testthat/helper-cli.R b/tests/testthat/helper-cli.R index 658b2b5..259d2ef 100644 --- a/tests/testthat/helper-cli.R +++ b/tests/testthat/helper-cli.R @@ -73,3 +73,31 @@ common_cli_args <- c( "--display_gene_names=FALSE", "--display_sample_names=TRUE" ) + +expect_main_runs_with_count_type <- function(count_type) { + setup <- setup_cli_workspace( + paste0("mosuite_plot_expr_heatmap_", count_type, "_test_") + ) + on.exit(unlink(setup$workspace, recursive = TRUE), add = TRUE) + + old_wd <- getwd() + setwd(setup$code_dir) + on.exit(setwd(old_wd), add = TRUE) + + exit_code <- system2( + "Rscript", + args = c( + "main.R", + sprintf("--count_type=%s", count_type), + "--display_gene_names=FALSE", + "--display_sample_names=TRUE" + ) + ) + expect_equal( + exit_code, + 0, + info = paste("main.R should plot", count_type, "counts") + ) + + expect_plot_created(setup$results_dir) +} diff --git a/tests/testthat/test-main.R b/tests/testthat/test-main.R index 5b25f8d..ba87fc6 100644 --- a/tests/testthat/test-main.R +++ b/tests/testthat/test-main.R @@ -12,6 +12,12 @@ test_that("main.R CLI creates expression heatmap plot", { expect_plot_created(setup$results_dir) }) +test_that("main.R CLI plots supported count types", { + for (count_type in c("raw", "filt", "norm", "batch")) { + expect_main_runs_with_count_type(count_type) + } +}) + test_that("run wrapper executes and creates expression heatmap plot", { setup <- setup_cli_workspace("mosuite_plot_expr_heatmap_run_test_") on.exit(unlink(setup$workspace, recursive = TRUE), add = TRUE) From a0698f46fb9f62a8b52c9005033bedaa1a9d2fb2 Mon Sep 17 00:00:00 2001 From: phoman14 Date: Mon, 3 Aug 2026 22:52:28 -0400 Subject: [PATCH 3/5] docs: update changelog for sub-count behavior --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 19e033d..62b9fce 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,7 @@ ## development version +- Hide the count subtype parameter and automatically use the `voom` subtype when plotting normalized counts (#11, @phoman14). - Sync Code Ocean app panel parameter descriptions with MOSuite package documentation for MOSuite v0.4.1 (#7, @phoman14). - Improved the Code Ocean parameter UI for the plot expr heatmap capsule (#4, @phoman14). - Use MOSuite v0.3.2. (#1, @kelly-sovacool) From 9281e89125a6ba721d4a5075910a708301dde146 Mon Sep 17 00:00:00 2001 From: Kelly Sovacool Date: Tue, 4 Aug 2026 10:14:05 -0400 Subject: [PATCH 4/5] fix: forward args to function --- code/main.R | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/code/main.R b/code/main.R index c84e82d..697a1a7 100644 --- a/code/main.R +++ b/code/main.R @@ -303,5 +303,14 @@ plot_expr_heatmap( assign_color_to_sample_groups = parse_optional_vector( args$assign_color_to_sample_groups ), - group_colors = parse_optional_vector(args$group_colors) + group_colors = parse_optional_vector(args$group_colors), + heatmap_color_scheme = args$heatmap_color_scheme, + autoscale_heatmap_color = args$autoscale_heatmap_color, + set_min_heatmap_color = args$set_min_heatmap_color, + set_max_heatmap_color = args$set_max_heatmap_color, + aspect_ratio = args$aspect_ratio, + legend_font_size = args$legend_font_size, + gene_name_font_size = args$gene_name_font_size, + sample_name_font_size = args$sample_name_font_size, + display_numbers = args$display_numbers ) From b6957a67d5a1926da3541e229e69e861175e572d Mon Sep 17 00:00:00 2001 From: Kelly Sovacool Date: Tue, 4 Aug 2026 10:19:36 -0400 Subject: [PATCH 5/5] test: app-panel contract --- tests/testthat/test-main.R | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/tests/testthat/test-main.R b/tests/testthat/test-main.R index ba87fc6..e76bcb4 100644 --- a/tests/testthat/test-main.R +++ b/tests/testthat/test-main.R @@ -1,3 +1,33 @@ +test_that("every app panel parameter is accepted and used by main.R", { + repo_root <- normalizePath( + file.path(testthat::test_path(), "..", ".."), + mustWork = TRUE + ) + panel <- jsonlite::fromJSON( + file.path(repo_root, ".codeocean", "app-panel.json") + ) + main_text <- paste( + readLines(file.path(repo_root, "code", "main.R"), warn = FALSE), + collapse = "\n" + ) + param_names <- panel$parameters$param_name + expect_true(length(param_names) > 0) + for (param_name in param_names) { + expect_match( + main_text, + sprintf('"--%s"', param_name), + fixed = TRUE, + info = sprintf("main.R should define a --%s CLI argument", param_name) + ) + expect_match( + main_text, + sprintf("args$%s", param_name), + fixed = TRUE, + info = sprintf("main.R should read args$%s", param_name) + ) + } +}) + test_that("main.R CLI creates expression heatmap plot", { setup <- setup_cli_workspace("mosuite_plot_expr_heatmap_test_") on.exit(unlink(setup$workspace, recursive = TRUE), add = TRUE)