Skip to contents

Usage

CCCPlot(
  data,
  plot_type = c("dot", "network", "chord", "circos", "heatmap", "sankey", "alluvial"),
  method = c("aggregation", "interaction"),
  magnitude = waiver(),
  specificity = waiver(),
  weighted = TRUE,
  meta_specificity = "sumlog",
  split_by = NULL,
  x_text_angle = 90,
  link_curvature = 0.2,
  link_alpha = 0.6,
  facet_by = NULL,
  show_row_names = TRUE,
  show_column_names = TRUE,
  ...
)

Arguments

data

A data frame with the cell-cell communication data. A typical data frame should have the following columns:

  • source The source cell type.

  • target The target cell type.

  • ligand The ligand gene.

  • receptor The receptor gene.

  • ligand_means The mean expression of the ligand gene per cell type.

  • receptor_means The mean expression of the receptor gene per cell type.

  • ligand_props The proportion of cells that express the entity.

  • receptor_props The proportion of cells that express the entity.

  • <magnitude> The magnitude of the communication.

  • <specificity> The specificity of the communication. Depends on the plot_type, some columns are optional. But the source, target, ligand, receptor and <magnitude> are required.

plot_type

The type of plot to use. Default is "dot". Possible values are "network", "chord", "circos", "heatmap", "sankey", "alluvial", and "dot".

  • network: A network plot with the source and target cells as the nodes and the communication as the edges.

  • chord: A chord plot with the source and target cells as the nodes and the communication as the chords.

  • circos: Alias of "chord".

  • heatmap: A heatmap plot with the source and target cells as the rows and columns.

  • sankey: A sankey plot with the source and target cells as the nodes and the communication as the flows.

  • alluvial: Alias of "sankey".

  • dot: A dot plot with the source and target cells as the nodes and the communication as the dots.

method

The method to determine the plot entities.

  • aggregation: Aggregate the ligand-receptor pairs interactions for each source-target pair. Only the source / target pairs will be plotted.

  • interaction: Plot the ligand-receptor pairs interactions directly. The ligand-receptor pairs will also be plotted.

magnitude

The column name in the data to use as the magnitude of the communication. By default, the second last column will be used. See li.mt.show_methods() for the available methods in LIANA. or https://liana-py.readthedocs.io/en/latest/notebooks/basic_usage.html#Tileplot

specificity

The column name in the data to use as the specificity of the communication. By default, the last column will be used. If the method doesn't have a specificity, set it to NULL.

weighted

Whether to use the magnitude as the weight of the aggregation interaction strength. for source-target pairs. Default is TRUE. Otherwise, the number of interactions will be used. Only used when method is "aggregation".

meta_specificity

The method to calculate the specificity when there are multiple ligand-receptor pairs interactions. Default is "sumlog". It should be one of the methods in the metap package.

split_by

A character vector of column names to split the plots. Default is NULL.

x_text_angle

The angle of the x-axis text. Default is 90. Only used when plot_type is "dot".

The curvature of the links. Default is 0.2. Only used when plot_type is "network".

The transparency of the links. Default is 0.6. Only used when plot_type is "network".

facet_by

A character vector of column names to facet the plots. Default is NULL. It should always be NULL.

show_row_names

Whether to show the row names in the heatmap. Default is TRUE. Only used when plot_type is "heatmap".

show_column_names

Whether to show the column names in the heatmap. Default is TRUE. Only used when plot_type is "heatmap".

...

Other arguments passed to the specific plot function.

  • For Network, see plotthis::Network.

  • For ChordPlot, see plotthis::ChordPlot.

  • For Heatmap, see plotthis::Heatmap.

  • For SankeyPlot, see plotthis::SankeyPlot.

  • For DotPlot, see plotthis::DotPlot.

Value

A ggplot object or a list if combine is FALSE

Examples

set.seed(8525)
data(cellphonedb_res)
CCCPlot(data = cellphonedb_res, plot_type = "network", legend.position = "none",
 theme = "theme_blank", theme_args = list(add_coord = FALSE))

CCCPlot(cellphonedb_res, plot_type = "chord")

CCCPlot(cellphonedb_res, plot_type = "heatmap")

CCCPlot(cellphonedb_res, plot_type = "dot", weighted = FALSE)


cellphonedb_res_sub <- cellphonedb_res[
  cellphonedb_res$source %in% c("Dendritic", "CD14+ Monocyte"),]
CCCPlot(cellphonedb_res_sub, plot_type = "dot", method = "interaction")
#> Multiple columns are provided in 'y'. They will be concatenated into one column.

CCCPlot(cellphonedb_res_sub, plot_type = "network", method = "interaction",
  node_size_by = 1)

CCCPlot(cellphonedb_res_sub, plot_type = "heatmap", method = "interaction")