Last data update: 2014.03.03

R: Function to reduce the pathway graph
reduceGraphR Documentation

Function to reduce the pathway graph

Description

Function simplifies a pathway graph topology. It merges a user specified nodes into a one. The specified set of nodes must be either a gene family or a protein complex. By a gene family we mean a set of genes with same outgoing or incoming edges. On the other hand, a protein complex is a set of nodes with only undirected binding edges between them and the number of edges is equal to the complex size.

Usage

reduceGraph(graph, reduction)

Arguments

graph

An object of class Pathway, a pathway to be reduced

reduction

A named list of reductions to be maded.

Value

A Pathway

Author(s)

Ivana Ihnatova

Examples

pathways<-pathways("hsapiens","kegg")["Prolactin signaling pathway"]
pathways<-convertIdentifiers(pathways[[1]], "SYMBOL")


#gr<-as(pathways,"pathway")
red<-list(RAS=c("NRAS","KRAS","HRAS"), SHC=c("SHC1", "SHC4","SHC2","SHC3"))
reduced<-reduceGraph(pathways, red)
reduced
par(mfrow=c(1,2))

nA<-list(fillcolor=c(NRAS="red", KRAS="red", HRAS="red", SHC1="green", SHC4="green", SHC2="green", SHC3="green"))
plot(as(pathways,"graphNEL"), nodeAttrs=nA, attrs=list(node=list(fontsize=30, height=40)), main="Before")

plot(as(reduced,"graphNEL"), 
 nodeAttrs=list(fillcolor=c(RAS="red", SHC="green")), attrs=list(node=list(fontsize=30, height=40)), main="After")

#this throws an error, "RELA", "FOS","NFKB1" is not correct set of genes
## Not run: 
pathways<-pathways("hsapiens","kegg")["Prolactin signaling pathway"]
pathways<-convertIdentifiers(pathways[[1]], "SYMBOL")


gr<-convertIdentifiers(kegg[["Prolactin signaling pathway"]],"SYMBOL")
red<-list(RAS=c("NRAS","KRAS","HRAS"), SHC=c("RELA", "FOS","NFKB1"))
reduced<-reduceGraph(pathways, red)

## End(Not run)

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(ToPASeq)
Loading required package: graphite
Loading required package: BiocGenerics
Loading required package: parallel

Attaching package: 'BiocGenerics'

The following objects are masked from 'package:parallel':

    clusterApply, clusterApplyLB, clusterCall, clusterEvalQ,
    clusterExport, clusterMap, parApply, parCapply, parLapply,
    parLapplyLB, parRapply, parSapply, parSapplyLB

The following objects are masked from 'package:stats':

    IQR, mad, xtabs

The following objects are masked from 'package:base':

    Filter, Find, Map, Position, Reduce, anyDuplicated, append,
    as.data.frame, cbind, colnames, do.call, duplicated, eval, evalq,
    get, grep, grepl, intersect, is.unsorted, lapply, lengths, mapply,
    match, mget, order, paste, pmax, pmax.int, pmin, pmin.int, rank,
    rbind, rownames, sapply, setdiff, sort, table, tapply, union,
    unique, unsplit

Loading required package: gRbase
Loading required package: graph
Loading required package: locfit
locfit 1.5-9.1 	 2013-03-22
Loading required package: Rgraphviz
Loading required package: grid
> png(filename="/home/ddbj/snapshot/RGM3/R_BC/result/ToPASeq/reduceRraph.Rd_%03d_medium.png", width=480, height=480)
> ### Name: reduceGraph
> ### Title: Function to reduce the pathway graph
> ### Aliases: reduceGraph
> ### Keywords: manip
> 
> ### ** Examples
> 
> pathways<-pathways("hsapiens","kegg")["Prolactin signaling pathway"]
> pathways<-convertIdentifiers(pathways[[1]], "SYMBOL")
'select()' returned 1:1 mapping between keys and columns
'select()' returned 1:1 mapping between keys and columns
> 
> 
> #gr<-as(pathways,"pathway")
> red<-list(RAS=c("NRAS","KRAS","HRAS"), SHC=c("SHC1", "SHC4","SHC2","SHC3"))
> reduced<-reduceGraph(pathways, red)
> reduced
"Prolactin signaling pathway" pathway
Native ID           = hsa:04917
Database            = KEGG
Species             = hsapiens
Type of identifiers = SYMBOL
Number of nodes     = 67
Number of edges     = 219
Retrieved on        = 03-05-2016
> par(mfrow=c(1,2))
> 
> nA<-list(fillcolor=c(NRAS="red", KRAS="red", HRAS="red", SHC1="green", SHC4="green", SHC2="green", SHC3="green"))
> plot(as(pathways,"graphNEL"), nodeAttrs=nA, attrs=list(node=list(fontsize=30, height=40)), main="Before")
> 
> plot(as(reduced,"graphNEL"), 
+  nodeAttrs=list(fillcolor=c(RAS="red", SHC="green")), attrs=list(node=list(fontsize=30, height=40)), main="After")
> 
> #this throws an error, "RELA", "FOS","NFKB1" is not correct set of genes
> ## Not run: 
> ##D pathways<-pathways("hsapiens","kegg")["Prolactin signaling pathway"]
> ##D pathways<-convertIdentifiers(pathways[[1]], "SYMBOL")
> ##D 
> ##D 
> ##D gr<-convertIdentifiers(kegg[["Prolactin signaling pathway"]],"SYMBOL")
> ##D red<-list(RAS=c("NRAS","KRAS","HRAS"), SHC=c("RELA", "FOS","NFKB1"))
> ##D reduced<-reduceGraph(pathways, red)
> ## End(Not run)
> 
> 
> 
> 
> 
> dev.off()
null device 
          1 
>