Skip to content

Commit

Permalink
Add tests
Browse files Browse the repository at this point in the history
  • Loading branch information
alanocallaghan committed Feb 11, 2025
1 parent 891e12c commit 5ecbd6c
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
3 changes: 2 additions & 1 deletion R/plotHighestExprs.R
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,8 @@ plotHighestExprs <- function(object, n = 50, colour_cells_by = color_cells_by,
## Create the plot and annotations.
plot_most_expressed <- ggplot(df_exprs_by_cell_long, aes_to_use) + geom_point(alpha = 0.6, shape = 124)
plot_most_expressed <- plot_most_expressed + labs(x=assay.type, y="Feature") + theme_bw(8) +
theme(legend.position = c(1, 0), legend.justification = c(1, 0),
theme(legend.position.inside = c(1, 0),
legend.justification = c(1, 0),
axis.text.x = element_text(colour = "gray35"),
axis.text.y = element_text(colour = "gray35"),
axis.title.x = element_text(colour = "gray35"),
Expand Down
13 changes: 13 additions & 0 deletions tests/testthat/test-plot-dimred.R
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,19 @@ test_that("we can produce PCA scatterplots", {
expect_ggplot(plotPCA(example_sce, bins = 10, colour_by = "Gene_0001"))
expect_ggplot(plotPCA(example_sce, bins = 10, colour_by = "Gene_0001",
hex = TRUE))

# truncating color scale
expect_ggplot(plotPCA(example_sce, min.value = 1))
expect_ggplot(plotPCA(example_sce, min.value = "1"))
expect_ggplot(plotPCA(example_sce, min.value = factor(1)))
expect_ggplot(plotPCA(example_sce, min.value = factor("q1")))
expect_ggplot(plotPCA(example_sce, min.value = "q1"))

expect_ggplot(plotPCA(example_sce, max.value = 2))
expect_ggplot(plotPCA(example_sce, max.value = "2"))
expect_ggplot(plotPCA(example_sce, max.value = factor(2)))
expect_ggplot(plotPCA(example_sce, max.value = factor("q90")))
expect_ggplot(plotPCA(example_sce, max.value = "q90"))
})

test_that("we can produce PCA pairplots", {
Expand Down

0 comments on commit 5ecbd6c

Please sign in to comment.