-
Notifications
You must be signed in to change notification settings - Fork 7
KEGG pathway display with DiagrammeR
Louis edited this page Mar 29, 2015
·
6 revisions
# install.packages('DiagrammeR')
# requires V8 package (in turn requires `apt-get install libv8-dev`)
# source("http://bioconductor.org/bioclite.r")
# biocLite("KEGGgraph")
# biocLite('Rgraphviz')
# library('DiagrammeR')
# library('KEGGgraph')
# library('Rgraphviz')Download your KGML (.xml) for the organism/pathway from KEGG, e.g. adenine pathway in S. cerevisiae:
%20-%20Google%20Chrome_011.png?raw=true)
KEGGgraph parses KEGG XML ("KGML") into graph models in R
# purine.kgml <- system.file("sce00230.xml", package="KEGGgraph")
# ^ did not work
purine.kgml <- "sce00230.xml"
purine.graph <- parseKGML2DataFrame(purine.kgml, genesOnly = FALSE)
# purine.graph is Formal class graphNELDiagrammeR works with DOT language graph specifications. graphViz can create these from this data frame (actually I think it's a Diagrammer function) :
nodes_edges <-
graphviz_single_df(
df = purine.graph,
edge_between = c("from -> to"),
node_attr = c("from:
shape = circle,
style = filled,
height = 2,
layer = 'all',
fontname = Helvetica,
fontsize = 42,
fillcolor = lightblue",
"to:
shape = circle,
style = filled,
height = 1,
layer = 'all',
fontname = Helvetica,
fontsize = 0,
fillcolor = seagreen3"),
edge_attr = "1:
color = #ff000040,
arrowhead = dot
"
)
# this is for the radial plot (stolen from flights example)
grViz("
digraph adenine {
# Graph statements
graph [layout = twopi,
overlap = false,
fixedsize = true,
ranksep = 11,
outputorder = edgesfirst]
# Nodes and edges
@@1
}
[1]: nodes_edges
")