Pathways Explorer in R

Explore KEGG module completeness and the functions detected in an analysis.
Authors

Alejandra Escobar

Amartya Nambiar

Explore the functional annotations from an MGnify assembly analysis. You will find the KEGG orthologues (KOs) detected in the analysis, compare KEGG module completeness, and inspect the KOs that make up an individual module.

Start with the example study MGYS00006180, or replace it with a study accession of your choice. Run the cells in order.

Choose an analysis

Change STUDY to another study with assembly analyses. The first page of analyses is loaded below; change page=1 to retrieve another page.

Read the result tables

The first analysis is selected automatically. Replace ANALYSIS with an accession from the table to explore a different analysis. The analysis record provides the KO counts and module-completeness tables.

Explore module completeness

A KEGG module describes a functional unit within a pathway. The completeness value is the percentage of that module’s functions found in the analysis. It does not show whether an entire pathway is complete or active.

Plot the 15 highest-scoring incomplete modules. Change 15 to show more or fewer.

Inspect a module

Start with glycolysis (M00001), or choose an identifier from the tables above. The table shows which KOs in the module were found and which were not found in the analysis. A missing annotation does not necessarily mean that a function is absent from the community.

The KEGG link opens the reference diagram for the selected module. It does not colour the diagram with this analysis’s results.

View detected functions in KEGG Mapper

Download the detected KO identifiers below, then:

  1. Open KEGG Mapper Search.
  2. Under Search mode, select the Reference radio button. The default hsa mode expects human gene identifiers and gives no matches for this file.
  3. Use Or upload file to select the downloaded -KOs.txt file, then click Exec.
  4. Open a result such as Glycolysis / Gluconeogenesis to see the detected KOs highlighted on its pathway map.

The search highlights pathways containing functions detected in your analysis. A pathway match does not mean that the entire pathway is complete.

Running this code in your own environment

Install jsonlite from your R console:

install.packages("jsonlite")

Run the R cells in RStudio or an R script. To save the KO identifiers locally, use writeLines(ko_text, ko_filename).

Querying KEGG from RStudio

When working in a local R installation, the Bioconductor KEGGREST package can be used to query KEGG directly. For example, this retrieves the definition of a KEGG module:

# Run locally in RStudio; this is not executed in the browser page.
if (!requireNamespace("BiocManager", quietly = TRUE))
    install.packages("BiocManager")
BiocManager::install("KEGGREST")

library(KEGGREST)
keggGet("M00001")