subKEGGgraph: Subset KEGG graph, including subsetting node and edge...

Description Usage Arguments Details Value Author(s) Examples

View source: R/graph.R

Description

subKEGGgraph extends generic method subGraph and subsets the KEGG graph. Both 'subKEGGgraph' and 'subGraph' can be used to subset the graph, the difference lies in whether the node and edge attributes from KEGG are also subset (subKEGGgraph) or not (subGraph).

See details below.

Usage

1
subKEGGgraph(nodes, graph)

Arguments

nodes

Node names to subset

graph

A graph parsed from KGML files, produced by parseKGML2Graph, KEGGpathway2Graph or parseKGMLexpandMaps

Details

subGraph does not subset the node or edge attributes, hence the results of getKEGGnodeData and getKEGGedgeData does not map to the nodes and edges in the subgraph in a one-to-one manner, with attributes of removed nodes and edges still remaining in the subGraph.

subKEGGgraph calls subGraph first to subset the graph, and then it also subsets the KEGGnodeData and KEGGedgeData so that they are one-to-one mapped to the nodes and edges in the subgraph.

Value

A graph with nodeData and edgeData.

Author(s)

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

Examples

1
2
3
4
5
6
7
sfile <- system.file("extdata/hsa04010.xml",package="KEGGgraph")
gR <- parseKGML2Graph(sfile,expandGenes=TRUE)
subs <-  c("hsa:1432",edges(gR)$`hsa:1432`,"hsa:5778","hsa:5801",
"hsa:84867","hsa:11072","hsa:5606","hsa:5608","hsa:5494","hsa:5609")
gR.keggsub <- subKEGGgraph(subs, gR)
gR
gR.keggsub

Example output

Attaching package: 'KEGGgraph'

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

    plot

A graphNEL graph with directed edges
Number of Nodes = 265 
Number of Edges = 876 
A graphNEL graph with directed edges
Number of Nodes = 22 
Number of Edges = 22 

KEGGgraph documentation built on Nov. 8, 2020, 5:42 p.m.