Skip to content

Commit

Permalink
Fix message in getCrossAssociation (#687)
Browse files Browse the repository at this point in the history
  • Loading branch information
TuomasBorman authored Feb 6, 2025
1 parent 676c69d commit 8a04bd8
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 6 deletions.
16 changes: 11 additions & 5 deletions R/getCrossAssociation.R
Original file line number Diff line number Diff line change
Expand Up @@ -279,7 +279,7 @@ setMethod("getCrossAssociation", signature = c(x = "MultiAssayExperiment"),
colData_variable2 = NULL,
by = MARGIN,
MARGIN = 1,
method = c("kendall", "spearman", "categorical", "pearson"),
method = "kendall",
mode = "table",
p.adj.method = p_adj_method,
p_adj_method = c("fdr", "BH", "bonferroni", "BY", "hochberg", "holm",
Expand Down Expand Up @@ -405,7 +405,7 @@ setMethod("getCrossAssociation", signature = "SummarizedExperiment",
dimred1 = NULL,
dimred2 = NULL,
by = 1,
method = c("kendall", "spearman", "categorical", "pearson"),
method = "kendall",
mode = c("table", "matrix"),
p.adj.method = c("fdr", "BH", "bonferroni", "BY", "hochberg", "holm",
"hommel", "none"),
Expand Down Expand Up @@ -822,7 +822,7 @@ setMethod("getCrossAssociation", signature = "SummarizedExperiment",
.calculate_association <- function(
assay1,
assay2,
method = c("kendall", "spearman", "categorical", "pearson"),
method = "kendall",
p.adj.method,
test.signif,
show.warnings,
Expand All @@ -838,7 +838,13 @@ setMethod("getCrossAssociation", signature = "SummarizedExperiment",
...){
# Check method if association.fun is not NULL
if( is.null(association.fun) ){
method <- match.arg(method)
# Check that method is correct
supported_methods <- c("kendall", "spearman", "categorical", "pearson")
if( !(.is_a_string(method) && method %in% supported_methods) ){
stop("'method' must be one of the following options: '",
paste0(supported_methods, collapse = "', '"), "'",
call. = FALSE)
}
# Get function name for message
function_name <- ifelse(
method == "categorical", "mia:::.calculate_gktau",
Expand Down Expand Up @@ -872,7 +878,7 @@ setMethod("getCrossAssociation", signature = "SummarizedExperiment",
", dimred2: ", ifelse(!is.null(dimred2), dimred2, "-"),
"\nby: ", by,
", function: ", function_name,
", method: ", method,
", method: ", ifelse(!is.null(method), method, "-"),
", test.signif: ", test.signif,
", p.adj.method: ",
ifelse(!is.null(p.adj.method), p.adj.method, "-"),
Expand Down
2 changes: 1 addition & 1 deletion man/getCrossAssociation.Rd

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

0 comments on commit 8a04bd8

Please sign in to comment.