Learn R Programming

inDAGO (version 1.0.0)

UpSetPlot: UpSetPlot

Description

Generate an UpSet plot of overlapping DEGs across multiple contrasts.

Usage

UpSetPlot(
  WD_samples,
  Th_logFC,
  Th_Pvalue,
  collapseName,
  nintersects,
  st_significance,
  scale
)

Value

An UpSet plot.

Arguments

WD_samples

Character. Directory containing DEG result CSV files.

Th_logFC

Numeric. Absolute log2 fold-change threshold to include a gene.

Th_Pvalue

Numeric. P-value threshold for significance (0 < Th_Pvalue <= 1).

collapseName

Logical. If TRUE, strip method/model prefixes from file names when labeling sets.

nintersects

Integer. Maximum number of intersections to display.

st_significance

Character. Which p-value to use: "adjustPvalue" (FDR or FWER) or "PValue".

scale

Numeric. Text scaling factor for plot labels and annotations.

Details

This function reads DEG CSV files from a directory, filters genes by log-FC and p-value thresholds (adjusted or raw), optionally simplifies file names, and visualizes the intersections of gene sets using an UpSet plot.

  1. Validates thresholds (Th_logFC >= 0, 0 < Th_Pvalue <= 1).

  2. Lists all CSV files in WD_samples and reads each into a data frame.

  3. Checks for duplicate IDs and standardizes to columns ID, logFC, and adjustPvalue or PValue.

  4. Filters each set of results by |logFC| >= Th_logFC and p-value < Th_Pvalue.

  5. Renames each gene-ID column to the (optionally collapsed) file name.

  6. Converts the list of filtered ID sets to an UpSetR input and calls UpSetR::upset().