Skip to content

Commit

Permalink
deprecated Rs
Browse files Browse the repository at this point in the history
  • Loading branch information
shreyarajeshrao committed Nov 22, 2024
1 parent 1b87dce commit 4bca7bf
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 12 deletions.
3 changes: 3 additions & 0 deletions NEWS.txt
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,9 @@ DEPRECATED ARGUMENTS
o `spatialCoordCols` argument deprecated for both getPairwise() and spicy(), replaced
with `spatialCoords`.

o `Rs` argument deprecated for both getPairwise() and spicy(), replaced
with `r`.

* Deprecation warnings have been added to guide users to the new argument names.


Expand Down
16 changes: 10 additions & 6 deletions R/spicy.R
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
#' @param imageID The name of the imageID column if using a SingleCellExperiment or SpatialExperiment.
#' @param cellType The name of the cellType column if using a SingleCellExperiment or SpatialExperiment.
#' @param spatialCoords The names of the spatialCoords column if using a SingleCellExperiment.
#' @param Rs A vector of the radii that the measures of association should be calculated over.
#' @param r A vector of the radii that the measures of association should be calculated over.
#' @param sigma A numeric variable used for scaling when fitting inhomogenous L-curves.
#' @param from vector of cell types which you would like to compare to the to vector.
#' @param to vector of cell types which you would like to compare to the from vector.
Expand All @@ -32,6 +32,7 @@
#' @param cellTypeCol \{DEPRECATED\} The name of the cellType column if using a SingleCellExperiment or SpatialExperiment.
#' @param spatialCoordCols \{DEPRECATED\} The names of the spatialCoords column if using a SingleCellExperiment.
#' @param nCores \{DEPRECATED\} Number of cores to use for parallel processing or a BiocParallel MulticoreParam or SerialParam object.
#' @param Rs \{DEPRECATED\} A vector of the radii that the measures of association should be calculated over.
#' @param ... Other options
#' @return Data frame of p-values.
#' @export
Expand Down Expand Up @@ -71,7 +72,7 @@ spicy <- function(cells,
imageID = "imageID",
cellType = "cellType",
spatialCoords = c("x", "y"),
Rs = NULL,
r = NULL,
sigma = NULL,
from = NULL,
to = NULL,
Expand All @@ -91,6 +92,7 @@ spicy <- function(cells,
cellTypeCol = cellType,
spatialCoordCols = spatialCoords,
nCores = cores,
Rs = r,
...) {

user_args = as.list(match.call())[-1]
Expand Down Expand Up @@ -172,7 +174,7 @@ spicy <- function(cells,

if (is.null(alternateResult)) {
pairwiseAssoc <- getPairwise(cells,
Rs = Rs,
r = r,
sigma = sigma,
from = from,
to = to,
Expand Down Expand Up @@ -417,7 +419,7 @@ cleanMEM <- function(mixed.lmer, BPPARAM) {
#' The name of the imageID column if using a SingleCellExperiment or SpatialExperiment.
#' @param cellType The name of the cellType column if using a SingleCellExperiment or SpatialExperiment.
#' @param spatialCoords The names of the spatialCoords column if using a SingleCellExperiment.
#' @param Rs A vector of the radii that the measures of association should be calculated over.
#' @param r A vector of the radii that the measures of association should be calculated over.
#' @param sigma A numeric variable used for scaling when fitting inhomogenous L-curves.
#' @param from The 'from' cellType for generating the L curve.
#' @param to The 'to' cellType for generating the L curve.
Expand All @@ -432,6 +434,7 @@ cleanMEM <- function(mixed.lmer, BPPARAM) {
#' @param cellTypeCol \{DEPRECATED\} The name of the cellType column if using a SingleCellExperiment or SpatialExperiment.
#' @param spatialCoordCols \{DEPRECATED\} The names of the spatialCoords column if using a SingleCellExperiment.
#' @param nCores \{DEPRECATED\} Number of cores to use for parallel processing or a BiocParallel MulticoreParam or SerialParam object.
#' @param Rs \{DEPRECATED\} A vector of the radii that the measures of association should be calculated over.
#' calculation.
#' @return Statistic from pairwise L-curve of a single image.
#' @examples
Expand All @@ -449,7 +452,7 @@ getPairwise <- function(
imageID = "imageID",
cellType = "cellType",
spatialCoords = c("x", "y"),
Rs = NULL,
r = NULL,
sigma = NULL,
from = NULL,
to = NULL,
Expand All @@ -463,7 +466,8 @@ getPairwise <- function(
imageIDCol = imageID,
cellTypeCol = cellType,
spatialCoordCols = spatialCoords,
nCores = cores
nCores = cores,
Rs = r
) {

user_args = as.list(match.call())[-1]
Expand Down
2 changes: 2 additions & 0 deletions R/utilities.R
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,7 @@ argumentChecks = function(function_name, user_vals) {
handle_deprecated("spatialCoordCols", "spatialCoords", user_vals)
handle_deprecated("nCores", "cores", user_vals)
handle_deprecated("BPPARAM", "cores", user_vals)
handle_deprecated("Rs", "r", user_vals)

# enforce mutually exclusive arguments
check_exclusive = function(arg_set, user_vals) {
Expand All @@ -204,6 +205,7 @@ argumentChecks = function(function_name, user_vals) {
check_exclusive(c("imageIDCol", "imageID"), user_vals)
check_exclusive(c("spatialCoordCols", "spatialCoords"), user_vals)
check_exclusive(c("cores", "nCores", "BPPARAM"), user_vals)
check_exclusive(c("Rs", "r"), user_vals)

# validity checks for cores/nCores/BPPARAM
if ("nCores" %in% names(user_vals)) {
Expand Down
11 changes: 7 additions & 4 deletions man/getPairwise.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 5 additions & 2 deletions man/spicy.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 4bca7bf

Please sign in to comment.