Last data update: 2014.03.03

R: Convert chemical reaction network of KEGG pathway into graph
KEGGpathway2reactionGraphR Documentation

Convert chemical reaction network of KEGG pathway into graph

Description

Regulatory pathways are always viewed as protein networks, so there is no 'reaction' information saved in their KGML files. Metabolic pathways are viewed both as both protein networks and chemical networks, hence the KEGGPathway-class object may have reactions information among chemical compounds.

This functions extracts reaction information from KEGG pathway, and convert the chemical compound reaction network into directed graph.

Usage

KEGGpathway2reactionGraph(pathway)

Arguments

pathway

A KEGGPathway-class object, usually as the result of the function parseKGML

Details

The direction of the graph is specified by the role of the compound in the reaction, the edges goes always out of 'substrate' and points to 'product'.

For now there is no wrapper to parse the KGML file directly into a reaction graph. In future there maybe one, but we don't want to confuse users with two similar functions to parse the file into a graph (since we assume that most users will need the protein graph, which can be conveniently parsed by parseKGML2Graph).

From version 1.18.0, reaction graphs returned by KEGGpathway2reactionGraph can be merged with other reaction graphs or pathway graphs.Thus users can combine pathway and reaction graph in one KGML file into a single graph.

Value

A directed graph with compounds as nodes and reactions as edges.

If the pathway does not contain any chemical reactions, a warning message will be printed and NULL is returned.

Author(s)

Jitao David Zhang mailto:jitao_david.zhang@roche.com

References

KGML Document manual http://www.genome.jp/kegg/docs/xml/

See Also

KEGGPathway-class

Examples

mapfile <-  system.file("extdata/map00260.xml",package="KEGGgraph")
map <- parseKGML(mapfile)
cg <- KEGGpathway2reactionGraph(map)
cg
nodes(cg)[1:3]
edges(cg)[1:3]

Results


R version 3.3.1 (2016-06-21) -- "Bug in Your Hair"
Copyright (C) 2016 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)

R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.

R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.

Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.

> library(KEGGgraph)

Attaching package: 'KEGGgraph'

The following object is masked from 'package:graphics':

    plot

> png(filename="/home/ddbj/snapshot/RGM3/R_BC/result/KEGGgraph/KEGGpathway2reactionGraph.Rd_%03d_medium.png", width=480, height=480)
> ### Name: KEGGpathway2reactionGraph
> ### Title: Convert chemical reaction network of KEGG pathway into graph
> ### Aliases: KEGGpathway2reactionGraph
> 
> ### ** Examples
> 
> mapfile <-  system.file("extdata/map00260.xml",package="KEGGgraph")
> map <- parseKGML(mapfile)
> cg <- KEGGpathway2reactionGraph(map)
> cg
A graphNEL graph with directed edges
Number of Nodes = 57 
Number of Edges = 67 
> nodes(cg)[1:3]
[1] "cpd:C00576" "cpd:C00065" "cpd:C06231"
> edges(cg)[1:3]
$`cpd:C00576`
[1] "cpd:C00719"

$`cpd:C00065`
[1] "cpd:C00740" "cpd:C00168" "cpd:C02291" "cpd:C02553" "cpd:C02737"
[6] "cpd:C00022" "cpd:C00097"

$`cpd:C06231`
[1] "cpd:C16432"

> 
> 
> 
> 
> 
> dev.off()
null device 
          1 
>