
Run Gene Enrichment and Compare with TKOI Data
Source:R/run_gene_enrichment.R
run_gene_enrichment.RdThis function performs gene enrichment analysis using the clusterProfiler package and
integrates the results
with the tKOIList object, specifically comparing the enrichment results with the TKOI data.
It generates
scatter plots visualizing the relationship between TKOI scores and enrichment results.
Arguments
- tkoi_list
An object of class
tKOIListthat contains the input data for analysis. The object should include the following slots:expression_data: Adata.framewith columns includinggene_nameandpvalue.network_summary_statistics: Alistcontaining network-level summary data for Biological Process (BP), Cellular Component (CC), and Molecular Function (MF), each stored as adata.frame.pvalue_threshold: Anumericvalue specifying the significance threshold for filtering genes.
Value
A tKOIList object with the gene_enrichment_comparison slot populated. This slot
is a list
containing:
enrichment_result: Adata.framewith the merged results of the enrichment analysis and TKOI network data.comparison_scatter1: Aggplotobject visualizing a scatter plot without facets.comparison_scatter2: Aggplotobject visualizing a scatter plot with facets for each namespace.
Details
The function performs the following steps:
Extracts genes with p-values at or below the threshold stored in
tkoi_list(the log fold change threshold is not applied here).Conducts Gene Ontology (GO) enrichment analysis for Biological Process (BP), Cellular Component (CC), and Molecular Function (MF) using
clusterProfiler::enrichGO.Merges the enrichment results with TKOI network statistics to create a unified dataset.
Generates scatter plots to visualize the relationship between TKOI network enrichment effect size and gene enrichment q-values.
Examples
if (FALSE) { # \dontrun{
tkoi_result = run_tkoi(expression_data)
tkoi_result = run_gene_enrichment(tkoi_result)
tkoi_result@gene_enrichment_comparison$enrichment_result
tkoi_result@gene_enrichment_comparison$comparison_scatter1
} # }