[BioC] problem with manipulating graphs created from dot files read by agread()
Paul Murrell
paul at stat.auckland.ac.nz
Fri Dec 21 02:46:42 CET 2012
Hi
There's a 'gridGraphviz' package on R-Forge that is in very early
stages; it has lots of holes, but I have plugged a couple so that you
get a reasonable result for your example below.
With the latest version on ...
https://r-forge.r-project.org/projects/gridgraph/
... try the following code ...
library(gridGraphviz)
g <- agread("Levins.dot")
grid.graph(g)
... which gets the edges better and the following ...
grid.newpage()
pushViewport(viewport(width=.9, height=.9, gp=gpar(lex=4)))
grid.graph(g, newpage=FALSE, nodesOnTop=FALSE)
... makes the "arrows" look better.
Paul
On 20/12/12 10:32, Alexis Dinno wrote:
> Hi,
>
> I would love to integrate interoperability with Rgraphviz in my LoopAnalyst
> package on CRAN. Unfortunately, Rgraphiz does not seem to behave well with
> graphs read from dot files. The dot file
> (http://doyenne.com/personal/files/Levins.dot) can be read an rendered by
> agread(), but does not turn out so nicely, presumably because of how node, edge
> and arrowhead attributes are handled.
>
> Here's how dot from graphviz renders my graph:
> http://doyenne.com/personal/files/Levins.png
>
>
> But if in R I type:
> g <- agread("/Users/Alexis/Desktop/Levins.dot")
> plot(g)
>
> I get: http://doyenne.com/personal/files/Levins2.png
>
> So I would like to edit the various parameters according to Rgraphviz, BUT, I
> get the following errors with the following commands:
>
> edgemode(g) <- "directed"
> Error in function (classes, fdef, mtable) :
> unable to find an inherited method for function ‘edgemode<-’ for
> signature ‘"Ragraph", "character"’
>
>
> edgeRenderInfo(g) <- list(arrowhead=c("R~R"="dot", "R~H"="normal",
> "H~R"="dot", "H~x"="normal", "H~y"="normal", "x~H"="dot", "y~H"="dot",
> "y~y"="dot"), arrowtail="open")
> Error in function (classes, fdef, mtable) :
> unable to find an inherited method for function ‘isDirected’ for
> signature ‘"Ragraph"’
>
>
> Can you help?
>
> Thank you!
>
> Alexis
>
>
> Here's the content of Levins.dot:
>
>
> digraph G {
> graph [bgcolor = "transparent", size = "18!,18!", nodesep="1", ranksep="1",
> rankdir="LR"];
> node [fixedsize=true, fontname="Sans", fontsize="70.85", shape=circle,
> height="2", width="2", style="setlinewidth(5)"];
> edge [style="setlinewidth(4)", arrowsize=3];
> "R" [color="#8000BF"];
> "R" -> "R" [color="#8000BF", arrowhead=dot];
> "R" -> "H" [color="#8000BF"];
> "H" [color="#0000BF"];
> "H" -> "R" [color="#0000BF", arrowhead=dot];
> "H" -> "x" [color="#0000BF"];
> "H" -> "y" [color="#0000BF"];
> "x" [color="#00BF00"];
> "x" -> "H" [color="#00BF00", arrowhead=dot];
> "y" [color="#BF0000"];
> "y" -> "H" [color="#BF0000", arrowhead=dot];
> "y" -> "y" [color="#BF0000", arrowhead=dot];
> }
>
> _______________________________________________
> Bioconductor mailing list
> Bioconductor at r-project.org
> https://stat.ethz.ch/mailman/listinfo/bioconductor
> Search the archives: http://news.gmane.org/gmane.science.biology.informatics.conductor
>
--
Dr Paul Murrell
Department of Statistics
The University of Auckland
Private Bag 92019
Auckland
New Zealand
64 9 3737599 x85392
paul at stat.auckland.ac.nz
http://www.stat.auckland.ac.nz/~paul/
More information about the Bioconductor
mailing list