Abstract

This package enables the interpretation and analysis of results from a gene set enrichment analysis using network-based and text-mining approaches. Most enrichment analyses result in large lists of significant gene sets that are difficult to interpret. Tools in this package help build a similarity-based network of significant gene sets from a gene set enrichment analysis that can then be investigated for their biological function using text-mining approaches.

vissE

This package implements the vissE algorithm to summarise results of gene-set analyses. Usually, the results of a gene-set enrichment analysis (e.g using limma::fry, singscore or GSEA) consist of a long list of gene-sets. Biologists then have to search through these lists to determines emerging themes to explain the altered biological processes. This task can be labour intensive therefore we need solutions to summarise large sets of results from such analyses.

This package provides an approach to provide summaries of results from gene-set enrichment analyses. It exploits the relatedness between gene-sets and the inherent hierarchical structure that may exist in pathway databases and gene ontologies to cluster results. For each cluster of gene-sets vissE identifies, it performs text-mining to automate characterisation of biological functions and processes represented by the cluster.

An additional power of vissE is to perform a novel type of gene-set enrichment analysis based on the network of similarity between gene-sets. Given a list of genes (e.g. from a DE analysis), vissE can characterise said list by first identifying all other gene-sets that are similar to it, following up with clustering the resulting gene-sets and finally performing text-mining to reveal emerging themes.

In addition to these analyses, it provides visualisations to assist the users in understanding the results of their experiment. This document will demonstrate these functions across the two use-cases. The vissE package can be downloaded as follows:

if (!requireNamespace("BiocManager", quietly = TRUE))
    install.packages("BiocManager")

BiocManager::install("vissE")

Summarising the results of a gene-set enrichment analysis

Often, the results of a gene-set enrichment analysis (be it an over representation analysis of a functional class scoring approach) is a list of gene-sets that are accompanied by their statistics and p-values or false discovery rates (FDR). These results are mostly scanned through by biologists who then extract relevant themes pertaining to the experiment of interest. The approach here, vissE, will allow automated extraction of themes.

The example below can be used with the results of any enrichment analysis. The data below is simulated to demonstrate the workflow.

library(msigdb)
library(GSEABase)

#load the MSigDB from the msigdb package
msigdb_hs = getMsigdb()
#append KEGG gene-sets - comment out to run
# msigdb_hs = appendKEGG(msigdb_hs)
#select h, c2, and c5 collections (recommended)
msigdb_hs = subsetCollection(msigdb_hs, c('h', 'c2', 'c5'))

#randomly sample gene-sets to simulate the results of an enrichment analysis
set.seed(360)
geneset_res = sample(sapply(msigdb_hs, setName), 2500)

#create a GeneSetCollection using the gene-set analysis results
geneset_gsc = msigdb_hs[geneset_res]
geneset_gsc
#> GeneSetCollection
#>   names: GOMF_GLUCOSE_1-DEHYDROGENASE_(NADP+)_ACTIVITY, GOCC_PROTON-TRANSPORTING_ATP_SYNTHASE,_CATALYTIC_CORE, ..., GOBP_KUPFFER'S_VESICLE_DEVELOPMENT (2500 total)
#>   unique identifiers: H6PD, ATP5F1A, ..., SAMD15 (19300 total)
#>   types in collection:
#>     geneIdType: SymbolIdentifier (1 total)
#>     collectionType: BroadCollection (1 total)

A vissE analysis involves 3 steps:

  1. Compute gene-set overlaps and the gene-set overlap network
  2. Identify clusters of gene-sets based on their overlap
  3. Characterise clusters using text mining
  4. (Optional) Visualise gene-level statistics

Compute gene-set overlap

The default approach to computing overlaps is using the Jaccard index. Overlap is computed based on the gene overlap between gene-sets. Alternatively, the overlap coefficient can be used. The latter can be used to highlight hierarchical overlaps (such as those present in the gene ontology).

library(vissE)

#compute gene-set overlap
gs_ovlap = computeMsigOverlap(geneset_gsc, thresh = 0.25)
#create an overlap network
gs_ovnet = computeMsigNetwork(gs_ovlap, msigdb_hs)
#plot the network
set.seed(36) #set seed for reproducible layout
plotMsigNetwork(gs_ovnet)

The overlap network plot above is annotated using the MSigDB category. If gene-set statistics are available, they can be projected onto the network too. Gene-set statistics can be passed onto the plotting function as a named vector.

#simulate gene-set statistics
geneset_stats = rnorm(2500)
names(geneset_stats) = geneset_res
head(geneset_stats)
#>                GOMF_GLUCOSE_1-DEHYDROGENASE_(NADP+)_ACTIVITY 
#>                                                   1.38997154 
#>        GOCC_PROTON-TRANSPORTING_ATP_SYNTHASE,_CATALYTIC_CORE 
#>                                                   0.07643696 
#>             GOMF_HISTONE_KINASE_ACTIVITY_(H2A-T120_SPECIFIC) 
#>                                                  -1.21057015 
#>                                      HP_BUDD_CHIARI_SYNDROME 
#>                                                  -0.76771773 
#>                                 GOBP_IMMUNE_EFFECTOR_PROCESS 
#>                                                   1.29679357 
#> GOBP_POSITIVE_REGULATION_OF_SMOOTH_MUSCLE_CELL_PROLIFERATION 
#>                                                  -0.89653508

#plot the network and overlay gene-set statistics
set.seed(36) #set seed for reproducible layout
plotMsigNetwork(gs_ovnet, genesetStat = geneset_stats)

Identify clusters of gene-sets

Related gene-sets likely represent related processes. The next step is to identify clusters of gene-sets so that they can be assessed for biological themes. The specific clustering approach can be selected by the user though we recommend graph clustering approaches to use the information provided in the overlap graph. We recommend using the igraph::cluster_walktrap() algorithm as it works well with dense graphs. Many other algorithms are implemented in the igraph package and these can be used instead of the walktrap algorithm.

library(igraph)

#identify clusters - order based on cluster size and avg gene-set stats
grps = findMsigClusters(gs_ovnet,
                        genesetStat = geneset_stats,
                        alg = cluster_walktrap,
                        minSize = 5)
#plot the top 12 clusters
set.seed(36) #set seed for reproducible layout
plotMsigNetwork(gs_ovnet, markGroups = grps[1:6], genesetStat = geneset_stats)

Instead of exploring the full network of gene-sets, the subgraph of nodes that form part of the groups can be plot. This allows for a more focused investigation into the relatedness of clusters identified using vissE.

set.seed(36) #set seed for reproducible layout
plotMsigNetwork(
  gs_ovnet,
  markGroups = grps[1:6],
  genesetStat = geneset_stats,
  rmUnmarkedGroups = TRUE
)

Characterise gene-set clusters

Gene-set clusters identified can be assessed for their biological similarities using text-mining approaches. Here, we perform a frequency analysis (adjusted for using the inverse document frequency) on the gene-set names or their short descriptions to assess recurring biological themes in clusters. These results are then presented as word clouds.

#compute and plot the results of text-mining
#using gene-set Names
plotMsigWordcloud(msigdb_hs, grps[1:6], type = 'Name')

#using gene-set Short descriptions
plotMsigWordcloud(msigdb_hs, grps[1:6], type = 'Short')

Visualise gene-level statistics for gene-set clusters

Gene-level statistics for each gene-set cluster can be visualised to better understand the genes contributing to significance of gene-sets. Gene-level statistics can be passed onto the plotting function as a named vector. A jitter is applied on the x-axis (due to its discrete nature).

library(ggplot2)

#simulate gene statistics
set.seed(36)
genes = unique(unlist(geneIds(geneset_gsc)))
gene_stats = rnorm(length(genes))
names(gene_stats) = genes
head(gene_stats)
#>       H6PD    ATP5F1A    ATP5F1B      DCAF1        MPL       JAK2 
#>  0.3117314  0.8498291  0.7055331  1.6999284 -1.3455710 -0.5698134

#plot the gene-level statistics
plotGeneStats(gene_stats, msigdb_hs, grps[1:6]) +
  geom_hline(yintercept = 0, colour = 2, lty = 2)

Visualise protein-protein interactions (PPI) in each cluster

An alternative line of evidence for a common functional role of genes are the protein-protein interactions between them. Genes involved in a biological process are likely to interact with each other to achieve the desired function. We can therefore investigate protein-protein interactions within each cluster and thus assess evidence of a common process. In vissE, this can be done by inducing the protein-protein interaction of all genes in a gene-set cluster. Furthermore, the individual nodes in the network can be mapped onto properties such as the gene-level statistic. Networks can then be filtered based on the gene-level statistic, the confidence value of each interaction and the frequency of each gene in the cluster (i.e., how many gene-sets it belongs to).

We will retrieve the PPI from the msigdb R/Bioconductor package. Setting inferred to TRUE will allow PPIs inferred from across organisms to be used in the analysis.

#load PPI from the msigdb package
ppi = getIMEX('hs', inferred = TRUE)
#create the PPI plot
set.seed(36)
plotMsigPPI(
  ppi,
  msigdb_hs,
  grps[1:6],
  geneStat = gene_stats,
  threshStatistic = 0.2,
  threshConfidence = 0.2
)

Combine results to interpret results

Results of a vissE analysis are best presented and interpreted as paneled plots that combine all of the above plots. This allows for collective interpretation of the gene-set clusters.

library(patchwork)

#create independent plots
set.seed(36) #set seed for reproducible layout
p1 = plotMsigWordcloud(msigdb_hs, grps[1:6], type = 'Name')
p2 = plotMsigNetwork(gs_ovnet, markGroups = grps[1:6], genesetStat = geneset_stats)
p3 = plotGeneStats(gene_stats, msigdb_hs, grps[1:6]) +
  geom_hline(yintercept = 0, colour = 2, lty = 2)
p4 = plotMsigPPI(
  ppi,
  msigdb_hs,
  grps[1:6],
  geneStat = gene_stats,
  threshStatistic = 0.2,
  threshConfidence = 0.2
)

#combine using functions from ggpubr
p1 + p2 + p3 + p4 + plot_layout(2, 2)

Session information

sessionInfo()
#> R version 4.2.1 (2022-06-23)
#> Platform: x86_64-pc-linux-gnu (64-bit)
#> Running under: Ubuntu 20.04.5 LTS
#> 
#> Matrix products: default
#> BLAS:   /usr/lib/x86_64-linux-gnu/openblas-pthread/libblas.so.3
#> LAPACK: /usr/lib/x86_64-linux-gnu/openblas-pthread/liblapack.so.3
#> 
#> locale:
#>  [1] LC_CTYPE=en_US.UTF-8       LC_NUMERIC=C              
#>  [3] LC_TIME=en_US.UTF-8        LC_COLLATE=en_US.UTF-8    
#>  [5] LC_MONETARY=en_US.UTF-8    LC_MESSAGES=en_US.UTF-8   
#>  [7] LC_PAPER=en_US.UTF-8       LC_NAME=C                 
#>  [9] LC_ADDRESS=C               LC_TELEPHONE=C            
#> [11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C       
#> 
#> attached base packages:
#> [1] stats4    stats     graphics  grDevices utils     datasets  methods  
#> [8] base     
#> 
#> other attached packages:
#>  [1] patchwork_1.1.2      ggplot2_3.3.6        igraph_1.3.5        
#>  [4] vissE_1.5.3          GSEABase_1.59.0      graph_1.75.0        
#>  [7] annotate_1.75.0      XML_3.99-0.11        AnnotationDbi_1.59.1
#> [10] IRanges_2.31.2       S4Vectors_0.35.4     Biobase_2.57.1      
#> [13] BiocGenerics_0.43.4  msigdb_1.5.0        
#> 
#> loaded via a namespace (and not attached):
#>   [1] AnnotationHub_3.5.2           BiocFileCache_2.5.2          
#>   [3] systemfonts_1.0.4             plyr_1.8.7                   
#>   [5] GenomeInfoDb_1.33.7           digest_0.6.29                
#>   [7] htmltools_0.5.3               viridis_0.6.2                
#>   [9] fansi_1.0.3                   magrittr_2.0.3               
#>  [11] memoise_2.0.1                 tm_0.7-8                     
#>  [13] Biostrings_2.65.6             graphlayouts_0.8.2           
#>  [15] textshape_1.7.3               pkgdown_2.0.6.9000           
#>  [17] colorspace_2.0-3              blob_1.2.3                   
#>  [19] rappdirs_0.3.3                ggrepel_0.9.1                
#>  [21] sylly_0.1-6                   textshaping_0.3.6            
#>  [23] xfun_0.33                     dplyr_1.0.10                 
#>  [25] crayon_1.5.2                  RCurl_1.98-1.9               
#>  [27] jsonlite_1.8.2                glue_1.6.2                   
#>  [29] polyclip_1.10-0               gtable_0.3.1                 
#>  [31] zlibbioc_1.43.0               XVector_0.37.1               
#>  [33] scico_1.3.1                   scales_1.2.1                 
#>  [35] DBI_1.1.3                     qdapRegex_0.7.5              
#>  [37] Rcpp_1.0.9                    viridisLite_0.4.1            
#>  [39] xtable_1.8-4                  bit_4.0.4                    
#>  [41] textclean_0.9.3               httr_1.4.4                   
#>  [43] ggwordcloud_0.5.0             RColorBrewer_1.1-3           
#>  [45] ellipsis_0.3.2                pkgconfig_2.0.3              
#>  [47] farver_2.1.1                  sass_0.4.2                   
#>  [49] dbplyr_2.2.1                  utf8_1.2.2                   
#>  [51] tidyselect_1.2.0              labeling_0.4.2               
#>  [53] rlang_1.0.6                   reshape2_1.4.4               
#>  [55] later_1.3.0                   munsell_0.5.0                
#>  [57] BiocVersion_3.16.0            tools_4.2.1                  
#>  [59] cachem_1.0.6                  cli_3.4.1                    
#>  [61] generics_0.1.3                RSQLite_2.2.18               
#>  [63] ExperimentHub_2.5.0           evaluate_0.17                
#>  [65] stringr_1.4.1                 fastmap_1.1.0                
#>  [67] yaml_2.3.5                    ragg_1.2.3                   
#>  [69] textstem_0.1.4                org.Hs.eg.db_3.16.0          
#>  [71] knitr_1.40                    bit64_4.0.5                  
#>  [73] fs_1.5.2                      tidygraph_1.2.2              
#>  [75] purrr_0.3.5                   KEGGREST_1.37.3              
#>  [77] ggraph_2.1.0                  koRpus_0.13-8                
#>  [79] mime_0.12                     slam_0.1-50                  
#>  [81] xml2_1.3.3                    BiocStyle_2.25.0             
#>  [83] compiler_4.2.1                filelock_1.0.2               
#>  [85] curl_4.3.3                    png_0.1-7                    
#>  [87] interactiveDisplayBase_1.35.1 koRpus.lang.en_0.1-4         
#>  [89] syuzhet_1.0.6                 tibble_3.1.8                 
#>  [91] tweenr_2.0.2                  bslib_0.4.0                  
#>  [93] stringi_1.7.8                 highr_0.9                    
#>  [95] desc_1.4.2                    lattice_0.20-45              
#>  [97] Matrix_1.5-1                  vctrs_0.4.2                  
#>  [99] pillar_1.8.1                  lifecycle_1.0.3              
#> [101] BiocManager_1.30.18           jquerylib_0.1.4              
#> [103] data.table_1.14.2             bitops_1.0-7                 
#> [105] httpuv_1.6.6                  sylly.en_0.1-3               
#> [107] R6_2.5.1                      promises_1.2.0.1             
#> [109] gridExtra_2.3                 lexicon_1.2.1                
#> [111] MASS_7.3-58.1                 assertthat_0.2.1             
#> [113] rprojroot_2.0.3               withr_2.5.0                  
#> [115] GenomeInfoDbData_1.2.9        parallel_4.2.1               
#> [117] grid_4.2.1                    prettydoc_0.4.1              
#> [119] tidyr_1.2.1                   rmarkdown_2.17               
#> [121] ggforce_0.4.1                 NLP_0.2-1                    
#> [123] shiny_1.7.2