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.
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 ) {
0 commit comments