pathway_gsea: Gene Set Enrichment Analysis for PICRUSt2 output

View source: R/pathway_gsea.R

pathway_gseaR Documentation

Gene Set Enrichment Analysis for PICRUSt2 output

Description

This function performs Gene Set Enrichment Analysis (GSEA) on PICRUSt2 predicted functional data to identify enriched pathways between different conditions.

Usage

pathway_gsea(
  abundance,
  metadata,
  group,
  pathway_type = "KEGG",
  method = "fgsea",
  rank_method = "signal2noise",
  nperm = 1000,
  min_size = 10,
  max_size = 500,
  p.adjust = "BH",
  seed = 42
)

Arguments

abundance

A data frame containing KO/EC/MetaCyc abundance data, with features as rows and samples as columns

metadata

A data frame containing sample metadata

group

A character string specifying the column name in metadata that contains the grouping variable

pathway_type

A character string specifying the pathway type: "KEGG", "MetaCyc", or "GO"

method

A character string specifying the GSEA method: "fgsea", "GSEA", or "clusterProfiler"

rank_method

A character string specifying the ranking statistic: "signal2noise", "t_test", "log2_ratio", or "diff_abundance"

nperm

An integer specifying the number of permutations

min_size

An integer specifying the minimum gene set size

max_size

An integer specifying the maximum gene set size

p.adjust

A character string specifying the p-value adjustment method

seed

An integer specifying the random seed for reproducibility

Value

A data frame containing GSEA results

Examples

## Not run: 
# Load example data
data(ko_abundance)
data(metadata)

# Prepare abundance data
abundance_data <- as.data.frame(ko_abundance)
rownames(abundance_data) <- abundance_data[, "#NAME"]
abundance_data <- abundance_data[, -1]

# Run GSEA analysis
gsea_results <- pathway_gsea(
  abundance = abundance_data,
  metadata = metadata,
  group = "Environment",
  pathway_type = "KEGG",
  method = "fgsea"
)

# Visualize results
visualize_gsea(gsea_results, plot_type = "enrichment_plot", n_pathways = 10)

## End(Not run)

ggpicrust2 documentation built on April 13, 2025, 9:08 a.m.