Skip to content

Commit dd79d33

Browse files
committed
chore(CCCPlot): default magnitude_agg to length (number of interactions)
1 parent cfcdcb9 commit dd79d33

File tree

3 files changed

+13
-12
lines changed

3 files changed

+13
-12
lines changed

R/cccplot.R

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -42,9 +42,9 @@
4242
#' By default, the last column will be used.
4343
#' If the method doesn't have a specificity, set it to NULL.
4444
#' @param magnitude_agg A function to aggregate the magnitude of the communication.
45-
#' Default is `sum`.
45+
#' Default is `length`.
4646
#' @param magnitude_name The name of the magnitude in the plot.
47-
#' Default is "Total interaction strength".
47+
#' Default is "No. of interactions".
4848
#' @param meta_specificity The method to calculate the specificity when there are multiple
4949
#' ligand-receptor pairs interactions. Default is "sumlog".
5050
#' It should be one of the methods in the `metap` package.
@@ -83,7 +83,7 @@
8383
#' CCCPlot(cellphonedb_res, plot_type = "chord")
8484
#' CCCPlot(cellphonedb_res, plot_type = "heatmap")
8585
#' CCCPlot(cellphonedb_res, plot_type = "dot",
86-
#' magnitude_agg = mean, magnitude_name = "Average Interaction Length")
86+
#' magnitude_agg = mean, magnitude_name = "Average Interaction Strength")
8787
#' CCCPlot(cellphonedb_res, plot_type = "sankey")
8888
#'
8989
#' cellphonedb_res_sub <- cellphonedb_res[
@@ -98,8 +98,8 @@ CCCPlot <- function(
9898
method = c("aggregation", "interaction"),
9999
magnitude = waiver(),
100100
specificity = waiver(),
101-
magnitude_agg = sum,
102-
magnitude_name = "Total interaction strength",
101+
magnitude_agg = length,
102+
magnitude_name = "No. of interactions",
103103
meta_specificity = "sumlog",
104104
split_by = NULL,
105105
x_text_angle = 90,
@@ -148,7 +148,7 @@ CCCPlot <- function(
148148
links <- suppressWarnings({ links %>%
149149
filter(!is.na(!!sym(specificity))) %>%
150150
summarise(
151-
interactionStrength = sum(!!sym(magnitude)),
151+
interactionStrength = magnitude_agg(!!sym(magnitude)),
152152
.specificity = if (is.null(specificity)) {
153153
NA
154154
} else if (n() == 1) {

ccc.rds

1.41 MB
Binary file not shown.

man/CCCPlot.Rd

Lines changed: 7 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)