Skip to contents

This function performs Metabolite Set Enrichment Analysis (MSEA) using the fgsea package. It takes a ranked list of feature scores and tests for enrichment of metabolite sets based on Canopus-predicted terms. The results are saved as a CSV file and a PDF plot.

Usage

MSEA(
  mmo,
  feature_name,
  feature_score,
  term_level = "NPC_class",
  pthr = 0.05,
  prefix = "MSEA",
  width = 8,
  height = 12,
  sig = FALSE
)

Arguments

mmo

The mmo object with sirius annotation and normalized data

feature_name

A vector of feature names corresponding to the feature scores

feature_score

A vector of feature scores (e.g., log2 fold changes)

term_level

The level of term to use for enrichment analysis. Options are 'NPC_pathway', 'NPC_superclass', 'NPC_class', 'ClassyFire_superclass', 'ClassyFire_class', 'ClassyFire_subclass', 'ClassyFire_level5', or 'ClassyFire_most_specific' (default: 'NPC_class')

pthr

The threshold for adjusted p-value to be considered significant (default: 0.05)

prefix

The prefix for output files (default: 'MSEA')

width

The width of the output plot in inches (default: 8)

height

The height of the output plot in inches (default: 12)

sig

A logical value indicating whether to return only significant terms (default: FALSE)

Examples

if (FALSE) {
# Perform MSEA using NPC_class level
MSEA(
 mmo, feature_name = rownames(DE_results), feature_score = DE_results$log2FoldChange, 
 term_level = 'NPC_class', pthr = 0.05, prefix = 'MSEA_NPC_class', 
 width = 8, height = 12, sig = FALSE
)
}