R functions for visualizing functional enrichment results obtained with the CERNO test from tmod package. The repository supports Gene Ontology Biological Process, Cellular Component and Molecular Function collections, as well as Reactome pathways.
CERNO_vis.R is the main script. Set the input directory, output directory and input file names in its User settings section, then run the script from the repository root.
R 4.1 or later is recommended.
source("install_packages.R")CERNO results may be stored in Excel files and should contain the following columns:
| Column | Meaning | Required by |
|---|---|---|
ID |
Pathway or gene-set identifier | tree plot, GO graph, redundancy analysis |
Title |
Pathway name | all visualizations |
adj.P.Val |
FDR-adjusted p-value | all visualizations |
AUC |
CERNO effect-size measure | all visualizations |
ONTOLOGY |
BP, CC, MF or REACTOME |
added automatically by CERNO_vis.R |
n_pathway_total |
Pathway size | optional; used by filtering helpers |
ID should preferably correspond to an MSigDB gene-set identifier. The main script normalizes IDs against the collections returned by msigdbr.
| Function | Purpose | Most important parameters |
|---|---|---|
cerno_dotplot() |
Displays pathways by -log10(FDR) with point size representing AUC |
top_n, padj_cutoff, highlight1, highlight2, point_size_range |
cerno_manhattan_go() |
Compares GO terms across BP, CC and MF | padj_cutoff, label_top_n, label_padj_cutoff, max_terms_per_ontology, jitter_width |
cerno_treeplot() |
Hierarchically clusters pathways using Jaccard overlap of member genes | ontology, top_n, selection_mode, nCluster, cluster_method |
cerno_go_graph() |
Displays selected GO terms and their ancestors in the GO hierarchy | ontology, top_n, selection_mode, max_depth, include_roots, layout |
cerno_simplify_go_terms() |
Groups semantically redundant GO terms and selects representatives | ontology, selection_mode, similarity_cutoff, semantic_measure |
cerno_go_redundancy_emap() |
Visualizes semantic similarity among GO terms | label, similarity_cutoff, layout, show_removed_labels |
The visualization functions use a consistent set of parameters wherever applicable:
-
highlight1andhighlight2are lists of exact pathway names or IDs that will be highlighted in the dotplot (by color) and treeplot (with one or two stars *, respectively), optional. -
ontologyselects the functional category to analyze. Supported GO values are"BP","CC"and"MF". The tree plot also supports"REACTOME"when appropriate pathway definitions are supplied. -
top_ndefines the maximum number of terms included in the visualization. -
padj_cutoffdefines the adjusted p-value threshold used to identify statistically significant terms. The default value is0.05. -
selection_modecontrols how terms are selected before constructing tree, hierarchy and redundancy visualizations:"significant_top_n"selects up totop_nterms with adjusted p-values belowpadj_cutoff."significant_all"selects all terms with adjusted p-values belowpadj_cutoff."top_n"selects thetop_nterms with the lowest adjusted p-values, regardless of significance."significant_or_top_n"uses significant terms when enough are available for the selected visualization; otherwise, it falls back to thetop_nterms with the lowest adjusted p-values.
-
ontology_col,id_col,term_col,padj_colandauc_colspecify the corresponding columns in the input data. Their defaults are"ONTOLOGY","ID","Title","adj.P.Val"and"AUC". -
split_after_wordscontrols line wrapping in long pathway names. -
point_size_rangecontrols the minimum and maximum point sizes used to represent AUC values. -
nClusterdefines the number of functional clusters displayed in a pathway tree. -
similarity_cutoffdefines the minimum GO semantic similarity required to group or connect terms in the redundancy analysis. -
semantic_measureselects the GO semantic similarity method. The default is"Wang". -
max_depthcontrols how many GO ancestor levels are included in the hierarchy graph. For greater clarity, if you have >30 significant pathways, set max_depth to 2-3.
And other parameters related to labels, legends, layout and figure dimensions.
source("CERNO_vis.R")The script creates PNG figures, CSV files describing representative and redundant GO terms in the selected output directory.
The visualization concepts and analytical workflows implemented in this repository were inspired by the functional enrichment visualization methods presented in the Biomedical Knowledge Mining book and the enrichplot ecosystem.
The code provides custom implementations adapted to tabular CERNO results.
CERNO results may be generated using the tmod R package.
References:
- Biomedical Knowledge Mining: https://yulab-smu.top/biomedical-knowledge-mining-book/enrichplot.html
- enrichplot: https://bioconductor.org/packages/enrichplot/
- tmod: https://CRAN.R-project.org/package=tmod
This repository is not affiliated with or endorsed by the authors of enrichplot, clusterProfiler or tmod.
This project is distributed under the GNU General Public License v3.0.
See the LICENSE file for details.