KEGGlincs Workflows

Shana White

2017-10-30

Overview of KEGGlincs

The package KEGGlincs and the functions contained within it are designed such that users can explore KEGG pathways in a more meaningful and informative manner both visually and analytically. This method of pathway analysis is approached via functions that handle the following (related) objectives:

The idea of ‘expanded’ nodes and edges should become very clear after reviewing the following example KEGGlincs workflows. Please keep in mind, the individual functions detailed in the following workflows are incorporated into the KEGG_lincs ‘master function’; these workflows are designed to provide users a with a better understanding of how this function works, how pathway topology is represented in KGML files, and how this package could be used with non-LINCS edge data (see Workflow 2).

Workflow 1: Visualize detailed ‘expanded’ KEGG pathways

No data added to edges

This workflow is intended to give users insight into the ‘expansion’ of KEGG pathway mapping via manipulation of the source KGML file. The only input required is the KEGG pathway ID for your pathway of choice. The primary goal for this method of pathway re-generation is to give users insight into the complexity that underlies many KEGG pathways but is in a sense ‘hidden’, yet hard-coded, in the curated KGML files. Users can also see the exact pathway topology that is used for input in analyses such as SPIA (Signaling Pathway Impact Analysis).

Initialize KEGGlincs package (development phase)

library(KEGGlincs)

Download and parse the most current KGML file for Fox0 signaling pathway

FoxO_KGML <- get_KGML("hsa04068")

#Information from KGML can be accessed using the following syntax:
slot(FoxO_KGML, "pathwayInfo")
## [ Title ]: FoxO signaling pathway
## [ Name ]: path:hsa04068
## [ Organism ]: hsa
## [ Number ] :04068
## [ Image ] :http://www.kegg.jp/kegg/pathway/hsa/hsa04068.png
## [ Link ] :http://www.kegg.jp/kegg-bin/show_pathway?hsa04068

The code chunks below are useful for viewing the original pathway image.

#Get address for pathway with active links:
slot(slot(FoxO_KGML, "pathwayInfo"), "image")
## [1] "http://www.kegg.jp/kegg/pathway/hsa/hsa04068.png"
#Download a static pathway image (png file) to working directory:
image_link <- slot(slot(FoxO_KGML, "pathwayInfo"), "image")
download.file(image_link, basename(image_link), mode = "wb")
Rendering of the png file for the p53 signaling pathway from KEGG:

The following commands produce ‘expanded’ node and edge sets

Note that KEGG IDs are converted to gene/compound symbols; this conversion accounts for the majority of computing time behind the expand_KEGG_mappings function. For quicker map generation, users may chose to change the argument convert_KEGG_IDs to FALSE; this will result in edges being identified by pairs of accession numbers instead of symbols in the final pathway map (example at end of this workflow using KEGG_lincs master function).

FoxO_KEGG_mappings <- expand_KEGG_mappings(FoxO_KGML)
FoxO_edges <- expand_KEGG_edges(FoxO_KGML, FoxO_KEGG_mappings)
Compare counts for ‘expanded’ vs. ‘unexpanded’ nodes and edges:
length(graph::nodes(FoxO_KGML)) # 'Un-expanded' nodes
## [1] 98
nrow(FoxO_KEGG_mappings)        # 'Expanded' nodes
## [1] 166

length(graph::edges(FoxO_KGML)) # 'Un-expanded' edges
## [1] 77
nrow(FoxO_edges)                # 'Expanded' edges
## [1] 456
Add graphing information to nodes and edges and get graph object:

Note: While the node_mapping_info function is rather trivial, the edge_mapping_info functions differently when data is added.

#Modify existing data sets; specify as nodes and edges
FoxO_node_mapping_info <- node_mapping_info(FoxO_KEGG_mappings)
FoxO_edge_mapping_info <- edge_mapping_info(FoxO_edges)

#Create an igraph object
GO <- get_graph_object(FoxO_node_mapping_info, FoxO_edge_mapping_info)
class(GO)
## [1] "igraph"
Finally, transform graph object and send to Cytoscape with one command:
cyto_vis(GO, "FoxO Pathway with Expanded Edges[no data added]")
Graph rendered in Cytoscape:

Edge Color Key:

Red: Activation or Expression *

Orange: Activating PTM **

Green: PTM (no activation/inhibition activity defined)

Blue: Inhibition

Purple: Inhibiting PTM

Black(solid): Binding/Association

Black(dashed): Indirect effect (no activation/inhibition activity defined)

*Any dashed colored line indicates that the effect is indirect

**PTM = post-translational modification or, as KEGG defines them, ‘molecular events’.

  • The specific types of PTMS (indicated by edge label) include:
    • +p: phosphorylation
    • -p: dephosphorylation
    • +g: glycosylation
    • +u: ubiquitination
    • +m: methylation

Notice that the original KEGG pathway image includes visual elements such as cellular-component-demarcations and certain edges (especially those ‘connecting’ genes to other pathways) that are not rendered in Cytoscape. These are features that are either not explicitly part of the pathway topology (i.e. not nodes or edges connecting nodes) or have not been hard-coded in the KGML file. The node labels may also differ between maps (KEGGlincs labels nodes as the first ‘alias’ in the respective KGML slot as there is no corresponding ‘label’ slot).

Alternative: KEGG_lincs master function

The steps above may be avoided if the user does not wish to generate intermediary files/objects by making use of the function KEGG_lincs as follows:

KEGG_lincs("hsa04068")

If users would like the Cytoscape-rendered map along with the detailed list of expanded edges (as an R object), KEGG_lincs can be invoked as follows:

FoxO_edges <- KEGG_lincs("hsa04068")

To speed up the mapping process (at the expense of having edges labelled with pairs of gene accession numbers as opposed to symbols) users may change the default convert_KEGG_IDs argumet to FALSE

KEGG_lincs("hsa04068", convert_KEGG_IDs = FALSE)

*Note: As with cyto_vis, please use the function KEGG_lincs_auto (after sourcing cyto_vis_auto) available from : https://github.com/uc-bd2k/KEGGlincs/blob/master/R/KEGG_lincs_auto.R #####Graph rendered in Cytoscape without edge accession numbers converted: