Learn R Programming

PopComm (version 1.0.0)

dotplot_lr_continuous_group: Dotplot of Ligand-Receptor Interaction Scores Against Continuous Group Variable

Description

Creates a dotplot (scatter plot) of ligand-receptor (LR) interaction scores against a continuous variable with optional regression line.

Usage

dotplot_lr_continuous_group(
  lr_scores,
  metadata,
  ligand,
  receptor,
  sender,
  receiver,
  group_by,
  score = c("normalized", "raw"),
  point_size = 3,
  point_color = "dodgerblue4",
  add_regression = TRUE,
  title = NULL
)

Value

A list containing:

  • plot - ggplot object of the dotplot

  • df - data frame used for plotting

Arguments

lr_scores

Data frame containing LR interaction scores per sample (data frame).

metadata

Data frame containing sample metadata (data frame).

ligand

Ligand gene name to filter (character).

receptor

Receptor gene name to filter (character).

sender

Sender cell type to filter (character).

receiver

Receiver cell type to filter (character).

group_by

Continuous variable column in metadata (e.g., age, severity score) (character).

score

Use 'normalized' or 'raw' score (default: "normalized") (character).

point_size

Size of the points in the plot (numeric, default: 3).

point_color

Color of the points in the plot (default: "dodgerblue4").

add_regression

Whether to add regression line (logical, default: TRUE).

title

Custom plot title (optional).

Examples

Run this code
# Dotplot of LR Score Against Continuous Group Variable
data(lr_scores_eg)
data(metadata_eg)

res <- dotplot_lr_continuous_group(
  lr_scores = lr_scores_eg,
  metadata = metadata_eg,
  ligand = "HLA-A",
  receptor = "LILRB2",
  sender = "Lymphoid",
  receiver = "Myeloid",
  group_by = "IFNscore"
)

print(res$plot)
head(res$df)

Run the code above in your browser using DataLab