Skip to content

Commit

Permalink
Cleaned up warnings from the visualization tests (#277).
Browse files Browse the repository at this point in the history
  • Loading branch information
dtm2451 authored Sep 17, 2024
1 parent f06e975 commit 8b0b5ea
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 6 deletions.
4 changes: 2 additions & 2 deletions R/plotDeltaDistribution.R
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ plotDeltaDistribution <- function(
aes.jit <- NULL
if (!is.null(pruned)) {
df$pruned <- pruned
aes.jit <- ggplot2::aes_string(color = "pruned")
aes.jit <- ggplot2::aes(color = .data$pruned)
}

# Trim dataframe by labels:
Expand All @@ -180,7 +180,7 @@ plotDeltaDistribution <- function(
}

# Making the violin plots.
p <- ggplot2::ggplot(data = df, ggplot2::aes_string(x="x", y="values")) +
p <- ggplot2::ggplot(data = df, ggplot2::aes(x=.data$x, y=.data$values)) +
ggplot2::xlab("")

if (!is.null(pruned)) {
Expand Down
2 changes: 1 addition & 1 deletion R/plotScoreDistribution.R
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ plotScoreDistribution <- function(

# Making the violin plots.
p <- ggplot2::ggplot(data = df,
ggplot2::aes_string(x = "cell.calls", y = "values", fill = "cell.calls")) +
ggplot2::aes(x = .data$cell.calls, y = .data$values, fill = .data$cell.calls)) +
ggplot2::scale_fill_manual(
name = labels.title,
breaks = c("assigned", "pruned", "other"),
Expand Down
2 changes: 2 additions & 0 deletions R/utils.R
Original file line number Diff line number Diff line change
Expand Up @@ -84,3 +84,5 @@
as.matrix(x)
}
}

utils::globalVariables(".data")
8 changes: 5 additions & 3 deletions tests/testthat/test-heatmap.R
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ test_that("heatmap is adjusted properly when 'labels.use' yields 1 or 0 labels",
paste0("disabling normalization"))

expect_equal(
suppressMessages(plotScoreHeatmap(results = pred, silent = TRUE,
suppressWarnings(plotScoreHeatmap(results = pred, silent = TRUE,
labels.use = c("A"),
color = colorRampPalette(c("red", "blue"))(33), # proximal to normalization being turned off
return.data = TRUE)$color),
Expand All @@ -124,7 +124,7 @@ test_that("heatmap is adjusted properly when 'labels.use' yields 1 or 0 labels",
paste0("ignoring 'labels.use'"))

expect_equal(
nrow(suppressMessages(plotScoreHeatmap(results = pred, silent = TRUE,
nrow(suppressWarnings(plotScoreHeatmap(results = pred, silent = TRUE,
labels.use = c("a"),
return.data = TRUE)$mat)),
5)
Expand Down Expand Up @@ -349,8 +349,10 @@ test_that("heatmap multi-ref - Other typical adjustments throw no unexpected err
expect_s3_class(plotScoreHeatmap(results = combined,
normalize = FALSE),
"gtable")
expect_s3_class(plotScoreHeatmap(results = combined,
expect_warning(out <- plotScoreHeatmap(results = combined,
labels.use = c("A", "a")),
"disabling normalization")
expect_s3_class(out,
"gtable")
expect_s3_class(plotScoreHeatmap(results = combined,
max.labels = 3),
Expand Down

0 comments on commit 8b0b5ea

Please sign in to comment.