From 758b6d2280cae6d8ac3acc216c0a51894951d7f0 Mon Sep 17 00:00:00 2001 From: alikhuseynov Date: Mon, 28 Oct 2024 17:53:52 +0100 Subject: [PATCH] minor fix to pass R CMD check on macOS 12.4 Monterey --- man/SpatialFeatureExperiment.Rd | 32 +++++++++++++++++++------------- man/readCosMX.Rd | 7 ++++--- man/readVizgen.Rd | 7 ++++--- man/readXenium.Rd | 7 ++++--- man/reexports.Rd | 19 ++++++++++--------- tests/testthat/test-aggregate.R | 3 ++- tests/testthat/test-read.R | 5 ++--- 7 files changed, 45 insertions(+), 35 deletions(-) diff --git a/man/SpatialFeatureExperiment.Rd b/man/SpatialFeatureExperiment.Rd index 10a1152b..670d1a7e 100644 --- a/man/SpatialFeatureExperiment.Rd +++ b/man/SpatialFeatureExperiment.Rd @@ -22,25 +22,31 @@ SpatialFeatureExperiment( ) } \arguments{ -\item{assays}{A \code{list} or \code{SimpleList} of matrix-like elements, +\item{assays}{ + A \code{list} or \code{SimpleList} of matrix-like elements, or a matrix-like object (e.g. an ordinary matrix, a data frame, a \link[S4Vectors]{DataFrame} object from the \pkg{S4Vectors} package, - a \link[Matrix]{sparseMatrix} derivative from the \pkg{Matrix} package, - a \link[DelayedArray]{DelayedMatrix} object from the \pkg{DelayedArray} - package, etc...). + a \link[SparseArray]{SparseMatrix} derivative from the \pkg{SparseArray} + package, a \link[Matrix]{sparseMatrix} derivative from the \pkg{Matrix} + package, a \link[DelayedArray]{DelayedMatrix} object from the + \pkg{DelayedArray} package, etc...). All elements of the list must have the same dimensions, and dimension names (if present) must be consistent across elements and with the row - names of \code{rowRanges} and \code{colData}.} + names of \code{rowRanges} and \code{colData}. + } -\item{colData}{An optional \link{DataFrame} describing the - samples. Row names, if present, become the column names of the - RangedSummarizedExperiment.} +\item{colData}{ + An optional \link{DataFrame} describing the samples. Row names on + \code{colData}, if present, become the column names of the returned object. + } -\item{rowData}{A \link[S4Vectors]{DataFrame} object describing - the rows. Row names, if present, become the row names of the - SummarizedExperiment object. The number of rows of the - \link[S4Vectors]{DataFrame} must equal the number of rows of the - matrices in \code{assays}.} +\item{rowData}{ + \code{NULL} (the default) or a \link[S4Vectors]{DataFrame} object + describing the rows. Row names, if present, become the row names of + the constructed SummarizedExperiment object. The number of rows of + the \link[S4Vectors]{DataFrame} must equal the number of rows of the + matrices in \code{assays}. + } \item{sample_id}{A \code{character} sample identifier, which matches the \code{sample_id} in \code{\link[SpatialExperiment]{imgData}}. The \code{sample_id} will also diff --git a/man/readCosMX.Rd b/man/readCosMX.Rd index ddae63fb..d7ab18fb 100644 --- a/man/readCosMX.Rd +++ b/man/readCosMX.Rd @@ -8,7 +8,7 @@ readCosMX( data_dir, z = "all", sample_id = "sample01", - min_area = 15, + min_area = NULL, add_molecules = FALSE, split_cell_comps = FALSE, BPPARAM = SerialParam(), @@ -27,8 +27,9 @@ transcript spots.} be stored in a new column in \code{\link[SpatialExperiment]{colData}}, if not already present. Default = \code{sample01}.} -\item{min_area}{Minimum cell area in square microns. Anything smaller will be -considered artifact or debris and removed.} +\item{min_area}{Minimum cell area in square microns or pixel units (eg for CosMX). +Anything smaller will be considered artifact or debris and removed. +Default to `NULL`, ie no filtering of polygons.} \item{add_molecules}{Logical, whether to add transcripts coordinates to an object.} diff --git a/man/readVizgen.Rd b/man/readVizgen.Rd index f67f3053..32139a67 100644 --- a/man/readVizgen.Rd +++ b/man/readVizgen.Rd @@ -8,7 +8,7 @@ readVizgen( data_dir, z = "all", sample_id = "sample01", - min_area = 15, + min_area = NULL, image = c("DAPI", "PolyT", "Cellbound"), flip = c("geometry", "image", "none"), max_flip = "50 MB", @@ -34,8 +34,9 @@ effect the cell segmentatio is only in 2D.} be stored in a new column in \code{\link[SpatialExperiment]{colData}}, if not already present. Default = \code{sample01}.} -\item{min_area}{Minimum cell area in square microns. Anything smaller will be -considered artifact or debris and removed.} +\item{min_area}{Minimum cell area in square microns or pixel units (eg for CosMX). +Anything smaller will be considered artifact or debris and removed. +Default to `NULL`, ie no filtering of polygons.} \item{image}{Which image(s) to load, can be "DAPI", "PolyT", "Cellbound" or any combination of them.} diff --git a/man/readXenium.Rd b/man/readXenium.Rd index e0435a36..99fed55f 100644 --- a/man/readXenium.Rd +++ b/man/readXenium.Rd @@ -7,7 +7,7 @@ readXenium( data_dir, sample_id = "sample01", - min_area = 15, + min_area = NULL, image = c("morphology_focus", "morphology_mip"), segmentations = c("cell", "nucleus"), row.names = c("id", "symbol"), @@ -28,8 +28,9 @@ readXenium( be stored in a new column in \code{\link[SpatialExperiment]{colData}}, if not already present. Default = \code{sample01}.} -\item{min_area}{Minimum cell area in square microns. Anything smaller will be -considered artifact or debris and removed.} +\item{min_area}{Minimum cell area in square microns or pixel units (eg for CosMX). +Anything smaller will be considered artifact or debris and removed. +Default to `NULL`, ie no filtering of polygons.} \item{image}{Which image(s) to load, can be "morphology_mip", "morphology_focus" or both. Note that in Xenium Onboarding Analysis (XOA) diff --git a/man/reexports.Rd b/man/reexports.Rd index a85b7c2a..c07294a8 100644 --- a/man/reexports.Rd +++ b/man/reexports.Rd @@ -42,14 +42,14 @@ reducedDim(x, type, ...) } \arguments{ \item{x}{ - A SummarizedExperiment object. + A SummarizedExperiment object or derivative. } \item{...}{ For \code{assay}, arguments in \code{...} are forwarded to \code{assays}. For \code{rbind}, \code{cbind}, \code{...} contains SummarizedExperiment - objects to be combined. + objects (or derivatives) to be combined. For other accessors, ignored. } @@ -58,13 +58,14 @@ reducedDim(x, type, ...) For \code{rowData}: Like \code{\link[S4Vectors]{mcols}(x)}, by default \code{rowData(x)} propagates the rownames of \code{x} to the returned \link[S4Vectors]{DataFrame} object (note that for a SummarizedExperiment - object, the rownames are also the names i.e. \code{rownames(x)} is - always the same as \code{names(x)}). Setting \code{use.names=FALSE} - suppresses this propagation i.e. it returns a \link[S4Vectors]{DataFrame} - object with no rownames. Use this when \code{rowData(x)} fails, - which can happen when the rownames contain NAs (because the rownames - of a SummarizedExperiment object can contain NAs, but the rownames of - a \link[S4Vectors]{DataFrame} object cannot). + object or derivative, the rownames are also the names i.e. + \code{rownames(x)} is always the same as \code{names(x)}). + Setting \code{use.names=FALSE} suppresses this propagation i.e. it + returns a \link[S4Vectors]{DataFrame} object with no rownames. Use this + when \code{rowData(x)} fails, which can happen when the rownames contain + NAs (because the rownames of a SummarizedExperiment object or derivative + can contain NAs, but the rownames of a \link[S4Vectors]{DataFrame} object + cannot). For \code{combineRows} and \code{combineCols}: See Combining section below. diff --git a/tests/testthat/test-aggregate.R b/tests/testthat/test-aggregate.R index cb6aff94..baf78eb0 100644 --- a/tests/testthat/test-aggregate.R +++ b/tests/testthat/test-aggregate.R @@ -118,7 +118,8 @@ test_that("aggregate for SFE by cells, manually supply `by` argument", { }) test_that("aggregate.SFE use a row* function", { - agg2 <- aggregate(sfe, by = grid2, FUN = rowMedians) + #agg2 <- aggregate(sfe, by = grid2, FUN = rowMedians) # doesn't work MatrixGenerics::rowMedians + agg2 <- aggregate(sfe, by = grid2, FUN = rowMeans2) # works MatrixGenerics::rowMeans2 expect_s4_class(agg2, "SpatialFeatureExperiment") # empty grid cells were removed expect_true(ncol(agg2) <= length(grid2) & ncol(agg2) > 0) diff --git a/tests/testthat/test-read.R b/tests/testthat/test-read.R index 063e888f..98c844ab 100644 --- a/tests/testthat/test-read.R +++ b/tests/testthat/test-read.R @@ -347,8 +347,7 @@ test_that("Deal with multiple pieces, remove pieces that are too small", { dir_use <- VizgenOutput("hdf5", file_path = fp) file.remove(file.path(dir_use, "cell_boundaries.parquet")) suppressWarnings(st_write_parquet(parq2, file.path(dir_use, "cell_boundaries.parquet"))) - - expect_warning(sfe <- readVizgen(dir_use, z = 3L, image = "PolyT"), "The largest piece is kept") + expect_warning(sfe <- readVizgen(dir_use, z = 3L, min_area = 15, image = "PolyT"), "The largest piece is kept") cg <- cellSeg(sfe) expect_equal(st_geometry_type(cg, by_geometry = "FALSE") |> as.character(), "POLYGON") expect_equal(colnames(sfe), as.character(parq2$EntityID[c(1,2,4)])) @@ -371,7 +370,7 @@ test_that("No polygons left", { file.remove(file.path(dir_use, "cell_boundaries.parquet")) suppressWarnings(st_write_parquet(parq2, file.path(dir_use, "cell_boundaries.parquet"))) - expect_error(readVizgen(dir_use, z = 3L, image = "PolyT"), + expect_error(readVizgen(dir_use, z = 3L, min_area = 15, image = "PolyT"), "No polygons left after filtering") unlink(dir_use, recursive = TRUE) })