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

360 [Bug]: unexpected reinitialization #362

Merged
merged 6 commits into from
Feb 21, 2024
Merged
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
2 changes: 1 addition & 1 deletion R/experimentSpec.R
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ experimentSpecInput <- function(inputId, # nolint
assert_string(inputId)
assert_string(mae_name, min.chars = 1L)
assert_string(label_experiments, min.chars = 1L)
mae <- data()[[mae_name]]
mae <- shiny::isolate(data()[[mae_name]])
name_choices <- names(mae)

ns <- NS(inputId)
Expand Down
Binary file modified tests/testthat/_snaps/windows-4.3/barplot/barplot-001.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified tests/testthat/_snaps/windows-4.3/boxplot/boxplot-001.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified tests/testthat/_snaps/windows-4.3/forest/forest_tte-001.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified tests/testthat/_snaps/windows-4.3/km/km-001.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified tests/testthat/_snaps/windows-4.3/pca/pca-001.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified tests/testthat/_snaps/windows-4.3/pca/pca-002.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified tests/testthat/_snaps/windows-4.3/pca/pca-003.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified tests/testthat/_snaps/windows-4.3/pca/pca-004.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified tests/testthat/_snaps/windows-4.3/pca/pca-005.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified tests/testthat/_snaps/windows-4.3/pca/pca-007.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified tests/testthat/_snaps/windows-4.3/pca/pca-008.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified tests/testthat/_snaps/windows-4.3/pca/pca-009.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified tests/testthat/_snaps/windows-4.3/pca/pca-010.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified tests/testthat/_snaps/windows-4.3/quality/quality-001.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified tests/testthat/_snaps/windows-4.3/quality/quality-002.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified tests/testthat/_snaps/windows-4.3/quality/quality-003.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified tests/testthat/_snaps/windows-4.3/scatterplot/scatterplot-001.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified tests/testthat/_snaps/windows-4.3/volcanoplot/volcanoplot-001.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified tests/testthat/_snaps/windows-4.3/volcanoplot/volcanoplot-002.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions tests/testthat/test-barplot.R
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ test_that("barplot module works as expected in the test app", {
!!ns("facet-sample_var") := "AGE18"
)

app$wait_for_idle()
app$expect_select_screenshot(ns("plot-plot_out_main"))
})

Expand Down
14 changes: 10 additions & 4 deletions tests/testthat/test-experimentSpec.R
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,10 @@ test_that("experimentSpec module works as expected in the test app", {
app$set_inputs(!!ns2("active-MAE-subjects-MAE_SEX-inputs-selection") := character())
app$wait_for_idle()

# Experiment selection is not affected by filtering
res <- app$get_value(input = ns("my_experiment-name"))
expect_identical(res, "hd2")

res <- app$get_value(output = ns("summary"))
expect_match(res$message, "No genes or samples included in this experiment, please adjust filters")
app$click(ns2("active-MAE-remove_filters"))
Expand All @@ -174,8 +178,9 @@ test_that("experimentSpec module works as expected in the test app", {
)
app$wait_for_idle()

app$set_inputs(!!ns("my_experiment-name") := "hd2")
app$wait_for_idle()
# Experiment selection is not affected by filtering
res <- app$get_value(input = ns("my_experiment-name"))
expect_identical(res, "hd2")

res <- app$get_value(output = ns("summary"))
expect_match(res$message, "No genes or samples included in this experiment, please adjust filters")
Expand All @@ -184,8 +189,9 @@ test_that("experimentSpec module works as expected in the test app", {
app$click(ns2("active-MAE-remove_filters"))
app$wait_for_idle()

app$set_inputs(!!ns("my_experiment-name") := "hd2")
app$wait_for_idle()
# Experiment selection is not affected by removing filters
res <- app$get_value(input = ns("my_experiment-name"))
expect_identical(res, "hd2")

res <- app$get_value(output = ns("summary"))
expect_match(res, "HermesData object with 9 samples of 2500 genes")
Expand Down
52 changes: 23 additions & 29 deletions tests/testthat/test-pca.R
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ test_that("pca module works as expected in the test app", {
res <- app$get_value(input = ns("show_matrix"))
expect_true(res)

app$expect_select_screenshot(ns("plot_pca-plot_main"))
app$expect_select_screenshot(ns("plot_pca-plot_main")) # 1

# Add a gene filter and deselect everything and check that it does not crash.
app$set_inputs(!!ns2("add-MAE-hd1-row_to_add") := "symbol")
Expand Down Expand Up @@ -88,31 +88,27 @@ test_that("pca module works as expected in the test app", {
res <- app$get_value(input = ns("show_matrix"))
expect_true(res)

app$expect_select_screenshot(ns("plot_cor-plot_main"))
app$expect_select_screenshot(ns("table_cor"))
app$expect_select_screenshot(ns("plot_cor-plot_main")) # 2
app$expect_select_screenshot(ns("table_cor")) # 3

# Now update experiment name, assay name, cluster & matrix option on correlation tab.
app$set_inputs(
!!ns("experiment-name") := "hd2",
!!ns("assay-name") := "voom",
!!ns("cluster_columns") := TRUE,
!!ns("show_matrix") := FALSE
)
app$set_inputs(!!ns("experiment-name") := "hd2")
app$set_inputs(!!ns("assay-name") := "voom")
app$set_inputs(!!ns("cluster_columns") := TRUE)
app$set_inputs(!!ns("show_matrix") := FALSE)

app$wait_for_idle()
app$expect_select_screenshot(ns("plot_cor-plot_main"))
app$expect_select_screenshot(ns("plot_cor-plot_main")) # 4

# Now go back to pca tab and update experiment, assay name, variance % option,
# label option and matrix option.
app$set_inputs(
!!ns("tab_selected") := "PCA",
!!ns("assay-name") := "rpkm",
!!ns("x_var") := "3",
!!ns("y_var") := "4",
!!ns("var_pct") := FALSE,
!!ns("label") := FALSE,
!!ns("show_matrix") := FALSE
)
app$set_inputs(!!ns("tab_selected") := "PCA")
app$set_inputs(!!ns("assay-name") := "rpkm")
app$set_inputs(!!ns("x_var") := "3")
app$set_inputs(!!ns("y_var") := "4")
app$set_inputs(!!ns("var_pct") := FALSE)
app$set_inputs(!!ns("label") := FALSE)
app$set_inputs(!!ns("show_matrix") := FALSE)

app$wait_for_idle()
app$expect_select_screenshot(ns("plot_pca-plot_main"))
Expand Down Expand Up @@ -153,16 +149,14 @@ test_that("pca module works as expected in the test app", {
expect_identical(res$message, "please select two different principal components")

# Update the inputs to PCA tab, hd1, counts, PC3, PC4, and add filters.
app$set_inputs(
!!ns("tab_selected") := "PCA",
!!ns("experiment-name") := "hd1",
!!ns("assay-name") := "counts",
!!ns("x_var") := "3",
!!ns("y_var") := "4",
!!ns("var_pct") := TRUE,
!!ns("label") := TRUE,
!!ns("show_matrix") := TRUE
)
app$set_inputs(!!ns("tab_selected") := "PCA")
app$set_inputs(!!ns("experiment-name") := "hd1")
app$set_inputs(!!ns("assay-name") := "counts")
app$set_inputs(!!ns("x_var") := "3")
app$set_inputs(!!ns("y_var") := "4")
app$set_inputs(!!ns("var_pct") := TRUE)
app$set_inputs(!!ns("label") := TRUE)
app$set_inputs(!!ns("show_matrix") := TRUE)

app$set_inputs(!!ns2("add-MAE-subjects-var_to_add") := "SEX")
app$wait_for_idle()
Expand Down
31 changes: 19 additions & 12 deletions tests/testthat/test-scatterplot.R
Original file line number Diff line number Diff line change
Expand Up @@ -59,13 +59,22 @@ test_that("scatterplot module works as expected in the test app", {
expect_identical(res$message, "please select at least one gene")

# Set one gene each.
app$set_inputs(
!!ns("x_spec-genes") := "GeneID:503538",
!!ns("y_spec-genes") := "GeneID:8086"
)
app$set_inputs(!!ns("x_spec-genes") := "GeneID:503538")
app$set_inputs(!!ns("y_spec-genes") := "GeneID:8086")

app$wait_for_idle()

# Change the sample filter and confirm that genes are not updated.
app$set_inputs(!!ns2("add-MAE-subjects-add_filter") := "ARM")
app$set_inputs(!!ns2("add-MAE-subjects-var_to_add") := "SEX")
app$set_inputs(!!ns2("active-MAE-subjects-MAE_SEX-inputs-selection") := "F")

res <- app$get_value(input = ns("x_spec-genes"))
expect_identical(res, "GeneID:503538")
res <- app$wait_for_value(input = ns("y_spec-genes"))
expect_identical(res, "GeneID:8086")

# Remove sample filter
app$click(ns2("active-MAE-subjects-MAE_SEX-remove"))
app$wait_for_idle()

res <- app$get_value(input = ns("x_spec-genes"))
Expand All @@ -74,13 +83,11 @@ test_that("scatterplot module works as expected in the test app", {
expect_identical(res, "GeneID:8086")

# Now change the experiment_name, genes, method.
app$set_inputs(
!!ns("experiment-name") := "hd2",
!!ns("x_spec-genes") := "GeneID:441376",
!!ns("y_spec-genes") := "GeneID:79963",
!!ns("smooth_method") := "loess",
!!ns("facet_var-sample_var") := "AGE18"
)
app$set_inputs(!!ns("experiment-name") := "hd2")
app$set_inputs(!!ns("x_spec-genes") := "GeneID:441376")
app$set_inputs(!!ns("y_spec-genes") := "GeneID:79963")
app$set_inputs(!!ns("smooth_method") := "loess")
app$set_inputs(!!ns("facet_var-sample_var") := "AGE18")

app$wait_for_idle()
app$expect_select_screenshot(ns("plot-plot_out_main"))
Expand Down
Loading