Skip to content

Commit

Permalink
Merge pull request #1123 from jiajic/suite_dev
Browse files Browse the repository at this point in the history
fix: `processData()` `name` passing
  • Loading branch information
jiajic authored Mar 3, 2025
2 parents ea5a69b + f38409d commit 17a3546
Show file tree
Hide file tree
Showing 3 changed files with 44 additions and 22 deletions.
36 changes: 22 additions & 14 deletions R/normalize.R
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,13 @@ NULL
#' @param param S4 parameter class defining the transform operation and
#' params affecting it. Can also be a list of several of these objects, acting
#' as a pipeline.
#' @param name character. [Object name][GiottoClass::giotto_schema] to assign
#' to the output.
#' @param name character (optional). [Object name][GiottoClass::giotto_schema]
#' to assign to the output. Default `name` changes based on `param` input:
#' * when `param` is `list` or `scaleParam`: `name = "scaled"`
#' * when `param` is `normParam`: `name = "normalized"`
#' * when `param` is `adjustParam`: `name = "custom"`
#' * when `param` is `osmFISHNormParam`: `name = "custom"`
#' * when `param` is `pearsonResidNormParam`: `name = "scaled"`
#' @param \dots additional params to pass
#' @examples
#' m <- matrix(c(0, 0, 3, 2, 0, 5, 4, 0, 0, 1, 12, 0), nrow = 3)
Expand Down Expand Up @@ -673,6 +678,16 @@ setMethod("processData",
}
)

#' @rdname processData
setMethod("processData",
signature(x = "exprObj", param = "scaleParam"),
function(x, param, name = "scaled", ...) {
x[] <- processData(x[], param, ...)
objName(x) <- name
return(x)
}
)

#' @rdname processData
setMethod("processData",
signature(x = "exprObj", param = "adjustParam"),
Expand Down Expand Up @@ -711,16 +726,6 @@ setMethod("processData",
}
)

#' @rdname processData
setMethod("processData",
signature(x = "exprObj", param = "scaleParam"),
function(x, param, name = "scaled", ...) {
x[] <- processData(x[], param, ...)
objName(x) <- name
return(x)
}
)


# * matrix ####

Expand Down Expand Up @@ -937,7 +942,8 @@ setMethod("processData",

#' @rdname processExpression
#' @export
processExpression <- function(gobject, param, name,
processExpression <- function(gobject, param,
name = NULL,
expression_values = "raw",
spat_unit = NULL,
feat_type = NULL,
Expand All @@ -953,9 +959,11 @@ processExpression <- function(gobject, param, name,
process_args <- list(
x = ex,
param = param,
name = name,
...
)
if (!is.null(name)) {
process_args$name <- name
}

# detect svkeys
if (!is.list(param)) param <- list(param)
Expand Down
17 changes: 12 additions & 5 deletions man/processData.Rd

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

13 changes: 10 additions & 3 deletions man/processExpression.Rd

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

0 comments on commit 17a3546

Please sign in to comment.