From 41fc2d4e45f5ead50f732f8f687119f073d3b470 Mon Sep 17 00:00:00 2001 From: Lambda Moses Date: Thu, 24 Oct 2024 22:27:54 -0400 Subject: [PATCH] Deal with more R CMD check issues on CI --- R/read.R | 4 ++-- man/readVisiumHD.Rd | 5 ++++- tests/testthat/test-coerce.R | 2 +- tests/testthat/test-geometry_operation.R | 2 +- tests/testthat/test-image.R | 6 ++++-- 5 files changed, 12 insertions(+), 7 deletions(-) diff --git a/R/read.R b/R/read.R index bc4ee0c..ff46333 100644 --- a/R/read.R +++ b/R/read.R @@ -308,10 +308,10 @@ read10xVisiumSFE <- function(samples = "", #' \code{\link{read10xVisiumSFE}}, the centroids geometry is also added #' because it will greatly facilitate plotting when there are many spots when #' not zooming in. See the \code{scattermore} argument in -#' \code{\link{Voyager::plotSpatialFeature}}. +#' \code{\link[Voyager]{plotSpatialFeature}}. #' @export #' @examples -#' +#' # readVisiumHD <- function(data_dir, bin_size = c(2L, 8L, 16L), sample_id = NULL, type = c("HDF5", "sparse"), diff --git a/man/readVisiumHD.Rd b/man/readVisiumHD.Rd index 66093f1..d2ce965 100644 --- a/man/readVisiumHD.Rd +++ b/man/readVisiumHD.Rd @@ -79,8 +79,11 @@ An SFE object if `length(bin_size) == 1L`, otherwise a list of SFE \code{\link{read10xVisiumSFE}}, the centroids geometry is also added because it will greatly facilitate plotting when there are many spots when not zooming in. See the \code{scattermore} argument in - \code{\link{Voyager::plotSpatialFeature}}. + \code{\link[Voyager]{plotSpatialFeature}}. } \description{ This function reads Visium HD Space Ranger output into R. } +\examples{ +# +} diff --git a/tests/testthat/test-coerce.R b/tests/testthat/test-coerce.R index e9c2d1d..6663ef9 100644 --- a/tests/testthat/test-coerce.R +++ b/tests/testthat/test-coerce.R @@ -19,7 +19,7 @@ test_that("Convert SPE and SCE to SFE, no images", { colData(sce) <- cbind(colData(sce), coords[,c("pxl_col_in_fullres", "pxl_row_in_fullres")]) sfe4 <- toSpatialFeatureExperiment(sce, spatialCoordsNames = c("pxl_col_in_fullres", "pxl_row_in_fullres")) - sfe <- read10xVisiumSFE(dir, type = "sparse", data = "filtered") + sfe <- read10xVisiumSFE(dir, type = "sparse", data = "filtered", flip = "image") centroids_check <- st_centroid(st_geometry(spotPoly(sfe))) expect_s4_class(sfe1, "SpatialFeatureExperiment") diff --git a/tests/testthat/test-geometry_operation.R b/tests/testthat/test-geometry_operation.R index 4bd1115..20f1c0c 100644 --- a/tests/testthat/test-geometry_operation.R +++ b/tests/testthat/test-geometry_operation.R @@ -879,7 +879,7 @@ test_that("Transpose SFE object with BioFormatsImage", { # outside the nucleus. So I use nuclei centroids v <- terra::extract(spi, st_centroid(nucSeg(sfe2)$geometry) |> vect()) expect_true(mean(v$lyr.1, na.rm = TRUE) > 0.9) # NA's from cells that don't have nuclei - + cat("Actual mean: ", mean(v$lyr.1, na.rm = TRUE)) bbox_cg_orig <- st_bbox(cellSeg(sfe)) bbox_img_orig <- ext(getImg(sfe)) bbox_cg <- st_bbox(cellSeg(sfe2)) diff --git a/tests/testthat/test-image.R b/tests/testthat/test-image.R index 14d392e..5cd5826 100644 --- a/tests/testthat/test-image.R +++ b/tests/testthat/test-image.R @@ -197,7 +197,8 @@ test_that("mirrorImg, SpatRasterImage method", { img_m2 <- mirrorImg(img, maxcell = 100) expect_equal(dim(img_m2), c(13,8,3)) # check content - expect_equal(imgRaster(img_m2)[4,3,2][[1]], 190) + if (packageVersion('terra') >= as.package_version("1.7.83")) + expect_equal(imgRaster(img_m2)[4,3,2][[1]], 190) # Use filename fn <- normalizePath(file.path(getwd(), "foo.tif"), mustWork = FALSE) @@ -242,7 +243,8 @@ test_that("scaleImg, SpatRasterImage method, EBI behind the scene", { test_that("affineImg, SpatRasterImage method, EBI behind the scene", { suppressWarnings(spi <- SpatRasterImage(rast(img_path))) - spi <- mirrorImg(spi, "vertical") + if (packageVersion('terra') >= as.package_version("1.7.83")) + spi <- mirrorImg(spi, "vertical") # Should rotate clockwise somewhat, squished to be flatter, shear to the right M <- matrix(c(0.6, -0.2, 0.2, 0.3), nrow = 2) v <- c(0, 300)