← Về thư mục
📄 / / profiles / r-and-d / raw_evidence / OpenAI4S / skills / bioskills / bio-workflows-expression-to-pathways / references / usage-guide.md

Expression to Pathways - Usage Guide

Overview

This workflow orchestrates the path from differential expression results to redundancy-collapsed functional enrichment. It does not re-teach each enrichment method; it routes the meta-decisions - ORA vs GSEA, the background universe, per-method gene-ID conversion, and the live-vs-local database caveat - and hands off to the pathway-analysis skills that own each method. The first decision is the generation (ORA or GSEA), set by whether a per-gene ranking exists for all genes or only a pre-selected list.

Prerequisites

BiocManager::install(c('clusterProfiler', 'org.Hs.eg.db', 'enrichplot'))
BiocManager::install(c('ReactomePA', 'rWikiPathways'))

Conceptual prerequisites: - The input is either a gene LIST (for ORA) or a NAMED numeric vector sorted in DECREASING order (for GSEA). The ranking metric (signed test statistic, DESeq2 Wald stat, or -sign(log2FC)*log10(p)) determines the GSEA result. - The background universe for ORA is the genes that were testable (entered the DE test), not the whole genome. This is the single most common published enrichment error. - Gene IDs must match the method: OrgDb keyType for enrichGO, 'kegg'/'ncbi-geneid' for enrichKEGG, ENTREZ for ReactomePA and enrichWP. Convert with bitr/bitr_kegg. - KEGG and WikiPathways query LIVE databases - they need internet at runtime and are not reproducible across data releases (pin the access date). GO and Reactome read local Bioconductor annotation and are reproducible given the release. - The DE list and the ranking statistic come from differential-expression; this workflow only shapes them into enrichment inputs.

Quick Start

Tell your AI agent what you want to do: - "Take my DESeq2 results and find enriched pathways" - "Should I run ORA or GSEA on these DE results, then run the right one" - "Run GO, KEGG, and Reactome enrichment on my significant genes with the correct background" - "Make a redundancy-collapsed dot plot and enrichment map of the results"

Example Prompts

Deciding ORA vs GSEA

"I have a full DESeq2 result with the Wald statistic for every tested gene and no obvious significance cutoff. Decide whether ORA or GSEA is appropriate and run whichever fits on GO biological processes, using a named decreasing vector if it is GSEA."

ORA with a defensible background

"I have 240 significant genes (padj < 0.05, |log2FC| > 1) as Ensembl IDs and the full set of ~13,000 expressed genes. Run GO BP and KEGG over-representation using the expressed genes as the background, convert IDs to what each method needs, and simplify the redundant GO terms."

End-to-end DE to pathways

"Take my edgeR results to enriched pathways: convert IDs, run GO and Reactome ORA plus GSEA, collapse redundant terms, and give me a dot plot and an enrichment map with the top 20 terms."

Multi-condition comparison

"I have significant gene lists for three treatments. Compare KEGG enrichment across them in one model and make a faceted dot plot - do not compare p-values from separate runs."

Input Requirements

Input Format Required for
Gene list Character vector of IDs ORA
Ranked genes Named numeric vector, sorted decreasing GSEA
Background universe Character vector of testable genes ORA
Organism OrgDb package / KEGG organism code ID mapping and enrichment

What the Agent Will Do

  1. Decide the generation - check whether a ranking exists for all genes (GSEA) or only a pre-selected list (ORA), and state the choice.
  2. Prepare the input - build the significant list and/or the named decreasing ranked vector, and set the universe to the testable genes.
  3. Convert gene IDs to the form each method needs and report the conversion rate.
  4. Run the chosen enrichment - ORA (enrichGO/enrichKEGG/enrichPathway/enrichWP) and/or GSEA (gseGO/gseKEGG), flagging the live-DB steps.
  5. Collapse redundancy with simplify/pairwise_termsim, then visualize deliberately (dotplot/emapplot/gseaplot2).
  6. Record provenance - tool and database version/date, ranking metric, p-adjust method, and the universe - so the result is reproducible.

ORA vs GSEA

Feature ORA GSEA
Input pre-selected gene list all genes, ranked (named decreasing vector)
Cutoff uses a DE threshold no threshold needed
Information binary (in / out) uses magnitude and direction
Key parameter the background universe the ranking metric
Best for unranked lists (modules, GWAS, screens) full rankings; subtle coordinated shifts

Tips