diff --git a/DESCRIPTION b/DESCRIPTION index c5fa68b..e3bfaa4 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,7 +1,7 @@ Package: velociraptor Title: Toolkit for Single-Cell Velocity -Version: 1.15.10 -Date: 2024-09-11 +Version: 1.15.11 +Date: 2024-09-12 Authors@R: c(person("Kevin", "Rue-Albrecht", role = c("aut", "cre"), email = "kevinrue67@gmail.com", comment = c(ORCID = "0000-0003-3899-3872")), person("Aaron", "Lun", role="aut", email="infinite.monkeys.with.keyboards@gmail.com", comment = c(ORCID = '0000-0002-3564-4813')), person("Charlotte", "Soneson", role="aut", email="charlottesoneson@gmail.com", comment = c(ORCID = '0000-0003-3833-2169')), diff --git a/NEWS.md b/NEWS.md index 2901a2a..5cb0603 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,3 +1,7 @@ +# velociraptor 1.15.11 + +* Re-enable `plotVelocityStream()` with a warning. + # velociraptor 1.15.10 * Temporarily disable `plotVelocityStream()` due to unexplained issue related to diff --git a/R/plotVelocityStream.R b/R/plotVelocityStream.R index 70958c6..74967b7 100644 --- a/R/plotVelocityStream.R +++ b/R/plotVelocityStream.R @@ -67,7 +67,9 @@ #' #' em <- embedVelocity(reducedDim(out, 1), out)[,1:2] #' -#' \dontrun{ +#' # https://github.com/kevinrue/velociraptor/issues/90 +#' +#' if (!basilisk.utils::isMacOSX()){ #' plotVelocityStream(out, em) #' plotVelocityStream(out, em, color.streamlines = TRUE) #' } @@ -92,10 +94,14 @@ plotVelocityStream <- function( "#22A884", "#43BF71", "#7AD151", "#BBDF27", "#FDE725"), arrow.angle = 8, arrow.length = 0.8) { - stop( - "This function is temporarily unavailable while we investigate an issue ", - "related to metR::geom_streamline()" - ) + if (basilisk.utils::isMacOSX()){ # both Intel and Arm + warning( + "This function has been observed to run indefinitely on macOS. ", + "The issue is related to the metR::geom_streamline() layer but unsolved yet. ", + "Use with caution and consider terminating R if rendering the plot freezes your session.", + immediate. = TRUE + ) + } if (!identical(ncol(sce), nrow(embedded))) { stop("'sce' and 'embedded' do not have consistent dimensions.") diff --git a/man/plotVelocityStream.Rd b/man/plotVelocityStream.Rd index 34d20f7..9da1134 100644 --- a/man/plotVelocityStream.Rd +++ b/man/plotVelocityStream.Rd @@ -105,7 +105,9 @@ out <- scvelo(datlist, mode = "dynamical") em <- embedVelocity(reducedDim(out, 1), out)[,1:2] -\dontrun{ +# https://github.com/kevinrue/velociraptor/issues/90 + +if (!basilisk.utils::isMacOSX()){ plotVelocityStream(out, em) plotVelocityStream(out, em, color.streamlines = TRUE) } diff --git a/tests/testthat/test-plotting.R b/tests/testthat/test-plotting.R index 2511678..80614ff 100644 --- a/tests/testthat/test-plotting.R +++ b/tests/testthat/test-plotting.R @@ -66,37 +66,30 @@ test_that("plotVelocity runs", { unlink(tf) }) -test_that("plotVelocityStream throws an error", { - - expect_error( - plotVelocityStream(out2, em2), - "temporarily" - ) - +test_that("plotVelocityStream runs", { + # metR::geom_streamline() layer causes timeouts on macOS + if (!basilisk.utils::isMacOSX()) { + skip_if_not_installed("ggplot2") + skip_if_not_installed("metR") + + expect_error(plotVelocityStream("error", em2)) + expect_error(plotVelocityStream(out2, "error")) + expect_error(plotVelocityStream(out2, em2[1:10, ])) + expect_error(plotVelocityStream(out2, em2, use.dimred = "error")) + expect_error(plotVelocityStream(out2, em2, use.dimred = FALSE)) + expect_error(plotVelocityStream(out2, em2, color_by = "error")) + expect_error(plotVelocityStream(out2, em2, grid.resolution = "error")) + expect_error(plotVelocityStream(out2, em2, scale = "error")) + expect_error(plotVelocityStream(out2, em2, color.streamlines = "error")) + + tf <- tempfile(fileext = ".png") + png(tf) + expect_warning(print(plotVelocityStream(out2, em2, color_by = "#44444422"))) + print(plotVelocityStream(out2, em2)) + print(plotVelocityStream(out3, em2, color_by = "type")) + print(plotVelocityStream(out2, em2, color.streamlines = TRUE)) + dev.off() + expect_true(file.exists(tf)) + unlink(tf) + } }) - -# test_that("plotVelocityStream runs", { -# -# skip_if_not_installed("ggplot2") -# skip_if_not_installed("metR") -# -# expect_error(plotVelocityStream("error", em2)) -# expect_error(plotVelocityStream(out2, "error")) -# expect_error(plotVelocityStream(out2, em2[1:10, ])) -# expect_error(plotVelocityStream(out2, em2, use.dimred = "error")) -# expect_error(plotVelocityStream(out2, em2, use.dimred = FALSE)) -# expect_error(plotVelocityStream(out2, em2, color_by = "error")) -# expect_error(plotVelocityStream(out2, em2, grid.resolution = "error")) -# expect_error(plotVelocityStream(out2, em2, scale = "error")) -# expect_error(plotVelocityStream(out2, em2, color.streamlines = "error")) -# -# tf <- tempfile(fileext = ".png") -# png(tf) -# expect_warning(print(plotVelocityStream(out2, em2, color_by = "#44444422"))) -# print(plotVelocityStream(out2, em2)) -# print(plotVelocityStream(out3, em2, color_by = "type")) -# print(plotVelocityStream(out2, em2, color.streamlines = TRUE)) -# dev.off() -# expect_true(file.exists(tf)) -# unlink(tf) -# })