From de934aebee5a3f1d4929f5374fa686934e84cd89 Mon Sep 17 00:00:00 2001 From: Daniel Sabanes Bove Date: Tue, 4 Jul 2023 21:02:03 +0200 Subject: [PATCH] fix snapshots --- ...hermesdatadiffexpr-with-custom-options.svg | 5162 ----------------- .../draw-barplot-with-duplicate-labels.svg | 22 +- .../draw-boxplot-with-duplicate-labels.svg | 8 +- ...w-heatmap-with-one-col-data-annotation.svg | 44 +- ...draw-scatterplot-with-duplicate-labels.svg | 6 +- ...draw-genes-barplot-with-custom-options.svg | 12 +- ...raw-genes-barplot-with-default-options.svg | 108 +- ...raw-libsize-densities-with-default-log.svg | 80 +- .../draw-libsize-hist-with-10-blue-bins.svg | 20 +- ...aw-nonzero-boxplot-with-custom-options.svg | 4 +- ...w-nonzero-boxplot-with-default-options.svg | 4 +- ...hermesdatatopgenes-with-custom-options.svg | 20 +- ...ermesdatatopgenes-with-default-options.svg | 20 +- tests/testthat/test-differential.R | 23 +- tests/testthat/test-draw_heatmap.R | 1 + 15 files changed, 193 insertions(+), 5341 deletions(-) delete mode 100644 tests/testthat/_snaps/differential/autoplot-for-hermesdatadiffexpr-with-custom-options.svg diff --git a/tests/testthat/_snaps/differential/autoplot-for-hermesdatadiffexpr-with-custom-options.svg b/tests/testthat/_snaps/differential/autoplot-for-hermesdatadiffexpr-with-custom-options.svg deleted file mode 100644 index 7ff5c7fa..00000000 --- a/tests/testthat/_snaps/differential/autoplot-for-hermesdatadiffexpr-with-custom-options.svg +++ /dev/null @@ -1,5162 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -GeneID:151242 -GeneID:390084 -GeneID:9834 -GeneID:7980 -GeneID:2262 -GeneID:6328 -GeneID:149998 - - - - - - -0.00 -0.01 -0.02 -0.03 -0.04 - - - - - - - - - --2 -0 -2 -4 -log2 fold change --log10 adjusted p-value - -Difference - - - - - - -DOWN -NO -UP -autoplot for HermesDataDiffExpr with custom options - - diff --git a/tests/testthat/_snaps/draw_barplot/draw-barplot-with-duplicate-labels.svg b/tests/testthat/_snaps/draw_barplot/draw-barplot-with-duplicate-labels.svg index 0726d7ef..7fc20bc9 100644 --- a/tests/testthat/_snaps/draw_barplot/draw-barplot-with-duplicate-labels.svg +++ b/tests/testthat/_snaps/draw_barplot/draw-barplot-with-duplicate-labels.svg @@ -27,12 +27,12 @@ - - - - - - + + + + + + @@ -44,9 +44,9 @@ - - - + + + @@ -97,9 +97,9 @@ AGE18 - + - + < 18 >= 18 draw_barplot with duplicate labels diff --git a/tests/testthat/_snaps/draw_boxplot/draw-boxplot-with-duplicate-labels.svg b/tests/testthat/_snaps/draw_boxplot/draw-boxplot-with-duplicate-labels.svg index e038051c..4ec6078b 100644 --- a/tests/testthat/_snaps/draw_boxplot/draw-boxplot-with-duplicate-labels.svg +++ b/tests/testthat/_snaps/draw_boxplot/draw-boxplot-with-duplicate-labels.svg @@ -27,11 +27,11 @@ - + - + @@ -92,10 +92,10 @@ Gene - + - + A (GeneID:10677) A (GeneID:11185) diff --git a/tests/testthat/_snaps/draw_heatmap/draw-heatmap-with-one-col-data-annotation.svg b/tests/testthat/_snaps/draw_heatmap/draw-heatmap-with-one-col-data-annotation.svg index 76786dda..cdaadc1c 100644 --- a/tests/testthat/_snaps/draw_heatmap/draw-heatmap-with-one-col-data-annotation.svg +++ b/tests/testthat/_snaps/draw_heatmap/draw-heatmap-with-one-col-data-annotation.svg @@ -521,26 +521,26 @@ 06520099B0017R 06520015C0016R 06520019C0023R - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + SEX counts 0 @@ -660,7 +660,7 @@ SEX F M - - + + diff --git a/tests/testthat/_snaps/draw_scatterplot/draw-scatterplot-with-duplicate-labels.svg b/tests/testthat/_snaps/draw_scatterplot/draw-scatterplot-with-duplicate-labels.svg index aa5f1ef3..dda764b7 100644 --- a/tests/testthat/_snaps/draw_scatterplot/draw-scatterplot-with-duplicate-labels.svg +++ b/tests/testthat/_snaps/draw_scatterplot/draw-scatterplot-with-duplicate-labels.svg @@ -47,9 +47,9 @@ - - - + + + diff --git a/tests/testthat/_snaps/graphs/draw-genes-barplot-with-custom-options.svg b/tests/testthat/_snaps/graphs/draw-genes-barplot-with-custom-options.svg index 254bfa11..b7399012 100644 --- a/tests/testthat/_snaps/graphs/draw-genes-barplot-with-custom-options.svg +++ b/tests/testthat/_snaps/graphs/draw-genes-barplot-with-custom-options.svg @@ -27,10 +27,10 @@ - - - - + + + + @@ -51,9 +51,9 @@ Low Expression - + - + FALSE TRUE Stacked Barplot of Filtered Genes by Chromosome diff --git a/tests/testthat/_snaps/graphs/draw-genes-barplot-with-default-options.svg b/tests/testthat/_snaps/graphs/draw-genes-barplot-with-default-options.svg index 99f60a92..66b93994 100644 --- a/tests/testthat/_snaps/graphs/draw-genes-barplot-with-default-options.svg +++ b/tests/testthat/_snaps/graphs/draw-genes-barplot-with-default-options.svg @@ -27,58 +27,58 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -151,9 +151,9 @@ Low Expression - + - + FALSE TRUE Stacked Barplot of Filtered Genes by Chromosome diff --git a/tests/testthat/_snaps/graphs/draw-libsize-densities-with-default-log.svg b/tests/testthat/_snaps/graphs/draw-libsize-densities-with-default-log.svg index 8a062614..c555fae6 100644 --- a/tests/testthat/_snaps/graphs/draw-libsize-densities-with-default-log.svg +++ b/tests/testthat/_snaps/graphs/draw-libsize-densities-with-default-log.svg @@ -27,46 +27,46 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tests/testthat/_snaps/graphs/draw-libsize-hist-with-10-blue-bins.svg b/tests/testthat/_snaps/graphs/draw-libsize-hist-with-10-blue-bins.svg index e115f634..638d434d 100644 --- a/tests/testthat/_snaps/graphs/draw-libsize-hist-with-10-blue-bins.svg +++ b/tests/testthat/_snaps/graphs/draw-libsize-hist-with-10-blue-bins.svg @@ -27,16 +27,16 @@ - - - - - - - - - - + + + + + + + + + + 3 4 3 diff --git a/tests/testthat/_snaps/graphs/draw-nonzero-boxplot-with-custom-options.svg b/tests/testthat/_snaps/graphs/draw-nonzero-boxplot-with-custom-options.svg index b9c13d18..5fb1e947 100644 --- a/tests/testthat/_snaps/graphs/draw-nonzero-boxplot-with-custom-options.svg +++ b/tests/testthat/_snaps/graphs/draw-nonzero-boxplot-with-custom-options.svg @@ -29,8 +29,8 @@ - - + + diff --git a/tests/testthat/_snaps/graphs/draw-nonzero-boxplot-with-default-options.svg b/tests/testthat/_snaps/graphs/draw-nonzero-boxplot-with-default-options.svg index 9814dc63..da756215 100644 --- a/tests/testthat/_snaps/graphs/draw-nonzero-boxplot-with-default-options.svg +++ b/tests/testthat/_snaps/graphs/draw-nonzero-boxplot-with-default-options.svg @@ -29,8 +29,8 @@ - - + + diff --git a/tests/testthat/_snaps/top_genes/autoplot-for-hermesdatatopgenes-with-custom-options.svg b/tests/testthat/_snaps/top_genes/autoplot-for-hermesdatatopgenes-with-custom-options.svg index 74212af7..f706e325 100644 --- a/tests/testthat/_snaps/top_genes/autoplot-for-hermesdatatopgenes-with-custom-options.svg +++ b/tests/testthat/_snaps/top_genes/autoplot-for-hermesdatatopgenes-with-custom-options.svg @@ -46,16 +46,16 @@ - - - - - - - - - - + + + + + + + + + + 0e+00 diff --git a/tests/testthat/_snaps/top_genes/autoplot-for-hermesdatatopgenes-with-default-options.svg b/tests/testthat/_snaps/top_genes/autoplot-for-hermesdatatopgenes-with-default-options.svg index 8903ed88..a97bfc69 100644 --- a/tests/testthat/_snaps/top_genes/autoplot-for-hermesdatatopgenes-with-default-options.svg +++ b/tests/testthat/_snaps/top_genes/autoplot-for-hermesdatatopgenes-with-default-options.svg @@ -46,16 +46,16 @@ - - - - - - - - - - + + + + + + + + + + 0e+00 diff --git a/tests/testthat/test-differential.R b/tests/testthat/test-differential.R index 36750a7b..5f5a43fa 100644 --- a/tests/testthat/test-differential.R +++ b/tests/testthat/test-differential.R @@ -115,17 +115,30 @@ test_that("diff_expression fails as expected with inappropriate inputs", { # autoplot-HermesDataDiffExpr ---- test_that("autoplot for HermesDataDiffExpr works as expected with default options", { - colData(hermes_data) <- df_cols_to_factor(colData(hermes_data)) - object <- diff_expression(hermes_data, "SEX", "voom") + dat <- hermes_data + colData(dat) <- df_cols_to_factor(colData(dat)) + object <- diff_expression(dat, "SEX", "voom") result <- autoplot(object) + set.seed(123) vdiffr::expect_doppelganger("autoplot for HermesDataDiffExpr with default options", result) }) test_that("autoplot for HermesDataDiffExpr works as expected with custom options", { - colData(hermes_data) <- df_cols_to_factor(colData(hermes_data)) - object <- diff_expression(hermes_data, "SEX", "voom") + dat <- hermes_data + colData(dat) <- df_cols_to_factor(colData(dat)) + object <- diff_expression(dat, "SEX", "voom") result <- autoplot(object, adj_p_val_thresh = 0.92, log2_fc_thresh = 3) - vdiffr::expect_doppelganger("autoplot for HermesDataDiffExpr with custom options", result) + x <- layer_data(result, 1) + x <- x[!is.na(x$label), ] + expect_equal(x$x, c(-3.44, -3.19, 3.39, 3.21, 3.8, 3.12, -3.13), tolerance = 1e-2) + expect_equal(x$y, rep(0.04008, 7), tolerance = 1e-2) + expect_identical( + x$label, + c( + "GeneID:151242", "GeneID:390084", "GeneID:9834", "GeneID:7980", + "GeneID:2262", "GeneID:6328", "GeneID:149998" + ) + ) }) diff --git a/tests/testthat/test-draw_heatmap.R b/tests/testthat/test-draw_heatmap.R index de184853..3cee5bba 100644 --- a/tests/testthat/test-draw_heatmap.R +++ b/tests/testthat/test-draw_heatmap.R @@ -1,4 +1,5 @@ test_that("draw_heatmap works as expected", { + set.seed(123) result <- draw_heatmap( hermes_data[1:20], assay_name = "counts",