Skip to contents

Generic function for ranking LR pairs. Dispatches on the class of x:

  • plotLRrank.blisa accepts a blisa object and uses its LR_results slot directly.

  • plotLRrank.data.frame accepts the LR_results data frame directly.

Usage

plotLRrank(x, ...)

# S3 method for class 'blisa'
plotLRrank(x, top = 30, pt_size = 4, flip = FALSE, size_by = "auto", ...)

# S3 method for class 'data.frame'
plotLRrank(
  x,
  top = 30,
  pt_size = 4,
  flip = FALSE,
  item_label = "Ligand-Receptor Pair",
  size_by = NULL,
  ...
)

Arguments

x

A blisa object or a data frame of LR results. The data frame must contain columns sig_numbers and annotation.

...

Additional arguments passed to the relevant method.

top

Integer or NULL. Number of top LR pairs (by sig_numbers) to display. Default 30.

pt_size

Numeric. Point size passed to geom_point. Default 4.

flip

Logical. When TRUE, LR pairs are placed on the x-axis and the hotspot count on the y-axis (vertical orientation). Default FALSE (LR pairs on y-axis, horizontal orientation).

size_by

Character or NULL. Name of a numeric column to map to point size. When NULL, all points use the fixed pt_size. For plotLRrank.blisa the default is "auto", which sizes pathway-level results (from blisaPathway) by "n_LR_pairs" and leaves LR-level results unsized; pass a column name, or NULL to disable, to override. Relabel the legend with + ggplot2::labs(size = ...).

item_label

Character. Axis label for the ranked items. Defaults to "Ligand-Receptor Pair"; plotLRrank.blisa sets it to "Pathway" for pathway-level objects.

Value

A ggplot object.

Methods (by class)

  • plotLRrank(blisa): Method for a blisa object. Extracts LR_results and delegates to plotLRrank.data.frame.

  • plotLRrank(data.frame): Method for a data frame of LR results (e.g. the LR_results slot of a blisa object).

Examples

if (FALSE) { # \dontrun{
# Continuing from the blisa() example:
# result <- blisa(spe, bin_size = 50, group = "cell_type")
plotLRrank(result, top = 30)
plotLRrank(result, top = 20, flip = TRUE)
} # }