| Title: | Plots For Visualising Cell-Cell Interactions |
|---|---|
| Description: | CCPlotR is an R package for visualising results from tools that predict cell-cell interactions from single-cell RNA-seq data. These plots are generic and can be used to visualise results from multiple tools such as Liana, CellPhoneDB, NATMI etc. |
| Authors: | Sarah Ennis [aut, cre] (ORCID: <https://orcid.org/0000-0001-6100-8573>), Pilib Ó Broin [aut], Eva Szegezdi [aut] |
| Maintainer: | Sarah Ennis <[email protected]> |
| License: | MIT + file LICENSE |
| Version: | 1.11.0 |
| Built: | 2026-05-29 08:25:17 UTC |
| Source: | https://github.com/bioc/CCPlotR |
This function plots interactions between a pair of cell types
cc_arrow( cc_df, cell_types = NULL, option = "A", n_top_ints = 15, exp_df = NULL, colours = setNames(paletteMartin(n = 2), cell_types), palette = "BuPu" )cc_arrow( cc_df, cell_types = NULL, option = "A", n_top_ints = 15, exp_df = NULL, colours = setNames(paletteMartin(n = 2), cell_types), palette = "BuPu" )
cc_df |
A dataframe with columns 'source', 'target', 'ligand', 'receptor' and 'score'. See |
cell_types |
A vector of which two cell types to plot. |
option |
Either 'A' or 'B'. Option A will plot the top |
n_top_ints |
The number of top interactions to plot. |
exp_df |
A dataframe containing the mean expression values for each ligand/receptor in each cell type. See |
colours |
A named vector of colours for each cell type. Default is |
palette |
Which colour palette to use to show the mean expression. Should be one of the RColorBrewer sequential palettes. Only used for option B. |
Returns a plot generated with the ggplot2 package
data(toy_data, toy_exp, package = 'CCPlotR') cc_arrow(toy_data, cell_types = c("B", "CD8 T"), colours = c(`B` = "hotpink", `CD8 T` = "orange")) cc_arrow(toy_data, cell_types = c("NK", "CD8 T"), option = "B", exp_df = toy_exp, n_top_ints = 10, palette = "OrRd" )data(toy_data, toy_exp, package = 'CCPlotR') cc_arrow(toy_data, cell_types = c("B", "CD8 T"), colours = c(`B` = "hotpink", `CD8 T` = "orange")) cc_arrow(toy_data, cell_types = c("NK", "CD8 T"), option = "B", exp_df = toy_exp, n_top_ints = 10, palette = "OrRd" )
This function creates a circos plot
cc_circos( cc_df, option = "A", n_top_ints = 15, exp_df = NULL, cell_cols = NULL, palette = "BuPu", cex = 1, show_legend = TRUE, scale = FALSE, ... )cc_circos( cc_df, option = "A", n_top_ints = 15, exp_df = NULL, cell_cols = NULL, palette = "BuPu", cex = 1, show_legend = TRUE, scale = FALSE, ... )
cc_df |
A dataframe with columns 'source', 'target', 'ligand', 'receptor' and 'score'. See |
option |
Either 'A' , 'B' or 'C'. Option A will plot the number of interactions between pairs of cell types, option B will plot the top |
n_top_ints |
The number of top interactions to plot. Only required for options B and C. |
exp_df |
A dataframe containing the mean expression values for each ligand/receptor in each cell type. See |
cell_cols |
A named vector of colours for each cell type. Default uses |
palette |
Which colour palette to use to show the mean expression. Should be one of the RColorBrewer sequential palettes. |
cex |
Determines text size |
show_legend |
TRUE or FALSE - whether to add legend or not. Only required for options B and C. |
scale |
TRUE or FALSE - whether to scale each sector to same width. Only required for options B and C. |
... |
Additional parameters passed to |
Returns a chord diagram generated by the circlize R package
data(toy_data, toy_exp, package = 'CCPlotR') cc_circos(toy_data) cc_circos(toy_data, option = "B", n_top_ints = 10, cex = 0.5) cc_circos(toy_data, option = "C", n_top_ints = 15, exp_df = toy_exp, cell_cols = c(`B` = "hotpink", `NK` = "orange", `CD8 T` = "cornflowerblue"), palette = "PuRd", cex = 0.5 )data(toy_data, toy_exp, package = 'CCPlotR') cc_circos(toy_data) cc_circos(toy_data, option = "B", n_top_ints = 10, cex = 0.5) cc_circos(toy_data, option = "C", n_top_ints = 15, exp_df = toy_exp, cell_cols = c(`B` = "hotpink", `NK` = "orange", `CD8 T` = "cornflowerblue"), palette = "PuRd", cex = 0.5 )
This function plots a dotplot
cc_dotplot(cc_df, option = "A", n_top_ints = 30)cc_dotplot(cc_df, option = "A", n_top_ints = 30)
cc_df |
A dataframe with columns 'source', 'target', 'ligand', 'receptor' and 'score'. See |
option |
Either 'A', 'B', 'CellPhoneDB' or 'Liana'. Option A will plot the number of interactions between pairs of cell types, option B will plot the top |
n_top_ints |
The number of top interactions to plot. Only required for option B. |
Returns a plot generated with the ggplot2 package
data(toy_data, package = 'CCPlotR') cc_dotplot(toy_data) cc_dotplot(toy_data, option = "B", n_top_ints = 10) cc_dotplot(toy_data, option = "Liana", n_top_ints = 15)data(toy_data, package = 'CCPlotR') cc_dotplot(toy_data) cc_dotplot(toy_data, option = "B", n_top_ints = 10) cc_dotplot(toy_data, option = "Liana", n_top_ints = 15)
This plots a heatmap
cc_heatmap(cc_df, option = "A", n_top_ints = 30)cc_heatmap(cc_df, option = "A", n_top_ints = 30)
cc_df |
A dataframe with columns 'source', 'target', 'ligand', 'receptor' and 'score'. See |
option |
Either 'A', 'B', 'CellPhoneDB' or 'Liana'. Option A will plot the number of interactions between pairs of cell types, option B will plot the top |
n_top_ints |
The number of top interactions to plot. Only required for option B. |
Returns a plot generated with the ggplot2 package
data(toy_data, package = 'CCPlotR') cc_heatmap(toy_data) cc_heatmap(toy_data, option = "B", n_top_ints = 10) cc_heatmap(toy_data, option = "CellPhoneDB")data(toy_data, package = 'CCPlotR') cc_heatmap(toy_data) cc_heatmap(toy_data, option = "B", n_top_ints = 10) cc_heatmap(toy_data, option = "CellPhoneDB")
This function plots a network of representing the number of interactions between cell types
cc_network( cc_df, colours = paletteMartin(), option = "A", n_top_ints = 20, node_size = 2.75, label_size = 4, layout = "kk" )cc_network( cc_df, colours = paletteMartin(), option = "A", n_top_ints = 20, node_size = 2.75, label_size = 4, layout = "kk" )
cc_df |
A dataframe with columns 'source', 'target', 'ligand', 'receptor' and 'score'. See |
colours |
A vector of colours for each cell type. Default is |
option |
Either 'A' or 'B'. Option A will plot the number of interactions between pairs of cell types, option B will plot the top |
n_top_ints |
The number of top interactions to plot. Only required for option B. |
node_size |
Point size for nodes in option B. |
label_size |
Size for labels in option B. |
layout |
Algorithm for determining layout in option B. One of 'dh', 'drl', 'fr', 'gem', 'graphopt', 'kk', 'lgl', 'mds', 'nicely'. See iGraph layouts for more details. |
Returns a plot generated with the ggplot2 package
data(toy_data, package = 'CCPlotR') cc_network(toy_data) cc_network(toy_data, colours = c("orange", "cornflowerblue", "hotpink"), option = "B")data(toy_data, package = 'CCPlotR') cc_network(toy_data) cc_network(toy_data, colours = c("orange", "cornflowerblue", "hotpink"), option = "B")
This function plots interactions using the geom_sigmoid function from the ggbump R package
cc_sigmoid(cc_df, n_top_ints = 20, colours = paletteMartin())cc_sigmoid(cc_df, n_top_ints = 20, colours = paletteMartin())
cc_df |
A dataframe with columns 'source', 'target', 'ligand', 'receptor' and 'score'. See |
n_top_ints |
The number of top interactions to plot. |
colours |
A named vector of colours for each cell type. Default is |
Returns a plot generated with the ggplot2 package
data(toy_data, package = 'CCPlotR') cc_sigmoid(toy_data) cc_sigmoid(toy_data, colours = c( `B` = "hotpink", `CD8 T` = "orange", `NK` = "cornflowerblue" ), n_top_ints = 25)data(toy_data, package = 'CCPlotR') cc_sigmoid(toy_data) cc_sigmoid(toy_data, colours = c( `B` = "hotpink", `CD8 T` = "orange", `NK` = "cornflowerblue" ), n_top_ints = 25)
Creates a ggplot that makes a smooth rank over time. To change the smooth
argument you need to put it outside of the aes of the geom.
Uses the x, xend, y and yend aestethics. Make sure each sigmoid curve is its own group.
geom_sigmoid( mapping = NULL, data = NULL, geom = "line", position = "identity", na.rm = FALSE, show.legend = NA, smooth = 8, direction = "x", inherit.aes = TRUE, ... )geom_sigmoid( mapping = NULL, data = NULL, geom = "line", position = "identity", na.rm = FALSE, show.legend = NA, smooth = 8, direction = "x", inherit.aes = TRUE, ... )
mapping |
provide you own mapping. both x, xend, y and yend need to be numeric. |
data |
provide you own data |
geom |
xhange geom |
position |
change position |
na.rm |
remove missing values |
show.legend |
show legend in plot |
smooth |
how much smooth should the curve have? More means steeper curve. |
direction |
the character x or y depending of smoothing direction |
inherit.aes |
should the geom inherits aestethics |
... |
other arguments to be passed to the geom |
ggplot layer
library(ggplot2) df <- data.frame(x = 1:6, y = 5:10, xend = 7, yend = -3:2) ggplot(df, aes(x = x, xend = xend, y = y, yend = yend, color = factor(x))) + geom_sigmoid()library(ggplot2) df <- data.frame(x = 1:6, y = 5:10, xend = 7, yend = -3:2) ggplot(df, aes(x = x, xend = xend, y = y, yend = yend, color = factor(x))) + geom_sigmoid()
Generate a palette of up to 15 colours. The colours are from the paletteMartin palette in the colorBlindess R package.
paletteMartin(n = 15)paletteMartin(n = 15)
n |
Number of colours to return. Max = 15. |
Returns a vector of colours of length n.
scales::show_col(paletteMartin(n = 9))scales::show_col(paletteMartin(n = 9))
This function is copied from the ggbump package
A toy dataset of ligand-receptor interactions to demonstrate cell-cell interaction plots.
toy_datatoy_data
An object of class tbl_df (inherits from tbl, data.frame) with 735 rows and 5 columns.
toy_dataA data frame with 735 rows and 5 columns:
Cell type expressing the ligand
Cell type expressing the receptor
Ligand
Receptor
A score for each interaction e.g. -log10(aggregate_rank) returned by Liana
This is a modified version of the toy dataset that comes with the Liana R package.
A dataframe showing the mean expression values for each ligand and receptor in each cell type.
toy_exptoy_exp
An object of class grouped_df (inherits from tbl_df, tbl, data.frame) with 477 rows and 3 columns.
toy_expA data frame with 477 rows and 3 columns:
Cell type
Ligand/receptor gene
Mean (normalised) expression of lignad/receptor gene in cell type