parseKGML2DataFrame: Parse KGML file into a data frame

Description Usage Arguments Details Value Author(s) See Also Examples

View source: R/parse.R

Description

This function extends the parseKGML2Graph function, by converting the resulting graph into a three-column data frame representing out-nodes (the from column in the data frame), in-nodes (to) and subtypes of edges that connect them (subtype). It can be used, for example, for exporting KEGG pathway networks in plain text files.

Usage

1

Arguments

file

A KGML file

reactions

Logical, whether metabolic reactions should be parsed and returned as part of the data frame. Default:FALSE

...

Other parameters passed to KEGGpathway2Graph

Details

The out- and in-nodes are represented in the form of KEGG identifiers. For human EntrezIDs the function translateKEGGID2GeneID can be used.

Multile edges are supported: in case more than one subtypes of edges exist between two nodes, they are all listed in the resulting data frame.

Value

A three-column data frame, representing the graph structure: out-nodes (the from column), in-nodes (to) and edge subtype (subtype).

Author(s)

Jitao David Zhang

See Also

parseKGML2Graph, KEGGpathway2Graph and translateKEGGID2GeneID.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
sfile <- system.file("extdata/hsa04010.xml",package="KEGGgraph")
gdf <- parseKGML2DataFrame(sfile)
head(gdf)
dim(gdf)

rfile <- system.file("extdata/hsa00020.xml",package="KEGGgraph")
dim(dfWr <- parseKGML2DataFrame(rfile, reactions=TRUE))
dim(dfWOr <- parseKGML2DataFrame(rfile, reactions=FALSE))
stopifnot(nrow(dfWr)>nrow(dfWOr))

## not expanding genes: only the KGML-specific identifiers are used then
## only for expert use
## NOT RUN
gdf.ne <- parseKGML2DataFrame(sfile, expandGenes=FALSE)
dim(gdf.ne)
head(gdf.ne)
## NOT RUN

Example output

Attaching package: 'KEGGgraph'

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

    plot

      from        to    subtype
1 hsa:5923 hsa:22800 activation
2 hsa:5923 hsa:22808 activation
3 hsa:5923  hsa:3265 activation
4 hsa:5923  hsa:3845 activation
5 hsa:5923  hsa:4893 activation
6 hsa:5923  hsa:6237 activation
[1] 1029    3
[1] 130   3
[1] 101   3
[1] 184   3
  from to           subtype
1    2 32        activation
2    3 18        inhibition
3    3 18 dephosphorylation
4    4 18        inhibition
5    4 18 dephosphorylation
6    5 80        inhibition

KEGGgraph documentation built on May 2, 2018, 2:31 a.m.