ggcluster: Plot KEGG Cluster Visualization

View source: R/ggdot_cluster.R

ggclusterR Documentation

Plot KEGG Cluster Visualization

Description

This function merges two cluster-plot approaches:

  • Enrichment mode: requires columns Term, Padj, Significant, Annotated, etc.

  • GSEA mode: requires columns pathway, padj, NES, etc.

Usage

ggcluster(
  data,
  method = c("auto", "enrich", "gsea"),
  color_low = "pink",
  color_high = "red",
  color_mid = "white",
  size_range = c(0.8, 4),
  curve_color = "grey70",
  curve_size = 0.5,
  vertical_line_color = "darkcyan",
  vertical_line_size = 1.5,
  dot_line_color = "grey70",
  dot_line_size = 0.3,
  dot_line_type = "dotted",
  vline_color = "grey80",
  vline_type = "dashed",
  label_font_size = 3,
  label_font_face = "bold",
  pathway_font_size = 2.5,
  pathway_font_face = "italic",
  legend_position = "right",
  x_pathway_offset = 0.3,
  label_x_size = 6,
  plot_margins = c(5, 200, 10, 250),
  ...
)

Arguments

data

A data frame containing KEGG cluster data. Must include columns: 'Term', 'Level2', 'group', 'Padj', 'Significant', and 'Annotated'.

method

One of "enrich" or "gsea". If "auto", guessed from columns.

color_low

Color for the lowest value in the gradient (default: "pink").

color_high

Color for the highest value in the gradient (default: "red").

color_mid

Color for the middle value in the gradient (default: "white").

size_range

A numeric vector of length 2 to control the size range of points (default: c(0.8, 4)).

curve_color

Color for the connecting curves between Level2 and Terms (default: "grey70").

curve_size

Line width for the connecting curves (default: 0.5).

vertical_line_color

Color for the vertical lines between Level2 labels and Terms (default: "darkcyan").

vertical_line_size

Width of vertical lines between Level2 and Terms (default: 1.5).

dot_line_color

Color for dotted lines connecting clusters to pathways (default: "grey70").

dot_line_size

Line width for the dotted lines (default: 0.3).

dot_line_type

Line type for the dotted lines (default: "dotted").

vline_color

Color for vertical lines separating clusters (default: "grey80").

vline_type

Line type for vertical lines separating clusters (default: "dashed").

label_font_size

Font size for the Level2 labels (default: 3).

label_font_face

Font face for the Level2 labels (default: "bold").

pathway_font_size

Font size for pathway labels (default: 2.5).

pathway_font_face

Font face for pathway labels (default: "italic").

legend_position

Position of the legend (default: "right").

x_pathway_offset

Offset to control the x-axis positioning of pathways (default: 0.3).

label_x_size

Font size for the x labels (default: 6).

plot_margins

Numeric vector of length 4 to control plot margins (default: c(5, 200, 10, 250)).

Details

If method = "auto", the function guesses which mode to use based on the columns found.

Value

A ggplot2 object (or a cowplot combined object).


guokai8/richR documentation built on June 10, 2025, 4:51 a.m.