# NOT RUN {
# Load the library
library(XGR)
RData.location <- "http://galahad.well.ox.ac.uk/bigdata/"
# load REACTOME
# restricted to Immune System ('R-HSA-168256') or Signal Transduction ('R-HSA-162582')
g <- xRDataLoader('ig.REACTOME', RData.location=RData.location)
neighs.out <- igraph::neighborhood(g, order=vcount(g),
nodes="R-HSA-168256", mode="out")
nodeInduced <- V(g)[unique(unlist(neighs.out))]$name
ig <- igraph::induced.subgraph(g, vids=nodeInduced)
# compare Fruchterman and Reingold force-directed placement algorithm
## based on igraph layout
ig1 <- xLayout(ig, layout="layout_with_fr")
gp1 <- xGGnetwork(ig1, node.xcoord="xcoord", node.ycoord="ycoord")
## based on sna layout
ig2 <- xLayout(ig, layout="gplot.layout.fruchtermanreingold")
gp2 <- xGGnetwork(ig2, node.xcoord="xcoord", node.ycoord="ycoord")
# compare Kamada-Kawai force-directed placement algorithm
## based on igraph layout
ig1 <- xLayout(ig, layout="layout_with_kk")
gp1 <- xGGnetwork(ig1, node.xcoord="xcoord", node.ycoord="ycoord")
## based on sna layout
ig2 <- xLayout(ig, layout="gplot.layout.kamadakawai")
gp2 <- xGGnetwork(ig2, node.xcoord="xcoord", node.ycoord="ycoord")
# }
Run the code above in your browser using DataLab