if (FALSE) {
# 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 (using camera method - recommended)
gsea_results <- pathway_gsea(
abundance = abundance_data,
metadata = metadata,
group = "Environment",
pathway_type = "KEGG",
method = "camera"
)
# Create enrichment plot with pathway IDs (default)
visualize_gsea(gsea_results, plot_type = "enrichment_plot", n_pathways = 10)
# Annotate results for better pathway names
annotated_results <- gsea_pathway_annotation(
gsea_results = gsea_results,
pathway_type = "KEGG"
)
# Create plots with readable pathway names
visualize_gsea(annotated_results, plot_type = "dotplot", n_pathways = 20)
visualize_gsea(annotated_results, plot_type = "barplot", n_pathways = 15)
# Create network plot with custom labels
visualize_gsea(annotated_results, plot_type = "network", n_pathways = 15)
# Use custom column for labels (if available)
visualize_gsea(annotated_results, plot_type = "barplot",
pathway_label_column = "pathway_name", n_pathways = 10)
# Create heatmap
visualize_gsea(
annotated_results,
plot_type = "heatmap",
n_pathways = 15,
abundance = abundance_data,
metadata = metadata,
group = "Environment"
)
}
Run the code above in your browser using DataLab