Skip to content
Closed
Show file tree
Hide file tree
Changes from all 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: 0 additions & 9 deletions .codeocean/app-panel.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
9 changes: 2 additions & 7 deletions code/main.R
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -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()
Expand All @@ -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,
Expand Down
28 changes: 28 additions & 0 deletions tests/testthat/helper-cli.R
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
6 changes: 6 additions & 0 deletions tests/testthat/test-main.R
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
Loading