This function takes a tibble produced by the liana package and generates a dot-plot visualization according to the user's specifications.
do_LigandReceptorPlot(
liana_output,
split.by = NULL,
keep_source = NULL,
keep_target = NULL,
top_interactions = 25,
top_interactions_by_group = FALSE,
dot_border = TRUE,
magnitude = "sca.LRscore",
specificity = "aggregate_rank",
sort.by = "E",
sorting.type.specificity = "descending",
sorting.type.magnitude = "descending",
border.color = "black",
axis.text.x.angle = 45,
legend.position = "bottom",
legend.type = "colorbar",
legend.length = 20,
legend.width = 1,
legend.framecolor = "grey50",
legend.tickcolor = "white",
legend.framewidth = 0.5,
legend.tickwidth = 0.5,
use_viridis = FALSE,
viridis.palette = "G",
viridis.direction = 1,
sequential.palette = "YlGnBu",
sequential.direction = 1,
font.size = 14,
dot.size = 1,
font.type = "sans",
plot.grid = TRUE,
grid.color = "grey90",
grid.type = "dotted",
compute_ChordDiagrams = FALSE,
sort_interactions_alphabetically = FALSE,
number.breaks = 5,
plot.title.face = "bold",
plot.subtitle.face = "plain",
plot.caption.face = "italic",
axis.title.face = "bold",
axis.text.face = "plain",
legend.title.face = "bold",
legend.text.face = "plain",
return_interactions = FALSE,
invert_specificity = TRUE,
invert_magnitude = FALSE,
verbose = TRUE
)A ggplot2 plot with the results of the Ligand-Receptor analysis.
tibble | Object resulting from running the liana functions liana_wrap and liana_aggregate.
character | Whether to further facet the plot on the y axis by common ligand.complex or receptor.complex. Values to provide: NULL, ligand.complex, receptor.complex.
character | Identities to keep for the source/target of the interactions. NULL otherwise.
numeric | Number of unique interactions to retrieve ordered by magnitude and specificity. It does not necessarily mean that the output will contain as many, but rather an approximate value.
logical | Enforce the value on top_interactions to be applied to each group in source column.
logical | Whether to draw a black border in the dots.
character | Which columns to use for specificity and magnitude.
character | How to arrange the top interactions. Interactions are sorted and then the top N are retrieved and displayed. This takes place after subsetting for keep_source and keep_target One of:
A: Sorts by specificity.
B: Sorts by magnitude.
C: Sorts by specificity, then magnitude (gives extra weight to specificity).
D: Sorts by magnitude, then specificity (gives extra weight to magnitude). Might lead to the display of non-significant results.
E: Sorts by specificity and magnitude equally.
character | Whether the sorting of e magnitude or specificity columns is done in ascending or descending order. This synergises with the value of e invert_specificity and e invert_magnitude parameters.
character | Color for the border of the heatmap body.
numeric | Degree to rotate the X labels. One of: 0, 45, 90.
character | Position of the legend in the plot. One of:
top: Top of the figure.
bottom: Bottom of the figure.
left: Left of the figure.
right: Right of the figure.
none: No legend is displayed.
character | Type of legend to display. One of:
normal: Default legend displayed by ggplot2.
colorbar: Redefined colorbar legend, using guide_colorbar.
numeric | Length and width of the legend. Will adjust automatically depending on legend side.
character | Color of the lines of the box in the legend.
character | Color of the ticks of the box in the legend.
numeric | Width of the lines of the box in the legend.
logical | Whether to use viridis color scales.
character | A capital letter from A to H or the scale name as in scale_fill_viridis.
numeric | Either 1 or -1. Controls how the gradient of viridis scale is formed.
character | Type of sequential color palette to use. Out of the sequential palettes defined in brewer.pal.
numeric | Direction of the sequential color scale. Either 1 or -1.
numeric | Overall font size of the plot. All plot elements will have a size relationship with this font size.
numeric | Size aesthetic for the dots.
character | Base font family for the plot. One of:
mono: Mono spaced font.
serif: Serif font family.
sans: Default font family.
logical | Whether to plot grid lines.
character | Color of the grid in the plot. In heatmaps, color of the border of the cells.
character | One of the possible linetype options:
blank.
solid.
dashed.
dotted.
dotdash.
longdash.
twodash.
logical | Whether to also compute Chord Diagrams for both the number of interactions between source and target but also between ligand.complex and receptor.complex.
logical | Sort the interactions to be plotted alphabetically (TRUE) or keep them in their original order in the matrix (FALSE).
numeric | Controls the number of breaks in continuous color scales of ggplot2-based plots.
character | Controls the style of the font for the corresponding theme element. One of:
plain: For normal text.
italic: For text in itallic.
bold: For text in bold.
bold.italic: For text both in itallic and bold.
logical | Whether to return the data.frames with the interactions so that they can be plotted as chord plots using other package functions.
logical | Whether to -log10 transform specificity and magnitude columns.
logical | Whether to show extra comments, warnings,etc.
# \donttest{
# Check Suggests.
value <- SCpubr:::check_suggests(function_name = "do_LigandReceptorPlot", passive = TRUE)
if (isTRUE(value)){
liana_output <- readRDS(system.file("extdata/liana_output_example.rds", package = "SCpubr"))
# Ligand Receptor analysis plot.
p <- SCpubr::do_LigandReceptorPlot(liana_output = liana_output)
p
} else if (base::isFALSE(value)){
message("This function can not be used without its suggested packages.")
message("Check out which ones are needed using `SCpubr::state_dependencies()`.")
}
# }
Run the code above in your browser using DataLab