[BioC] problem with manipulating graphs created from dot files read by agread()

Kasper Daniel Hansen kasperdanielhansen at gmail.com
Fri Dec 21 00:07:02 CET 2012


The issue is that agread() returns an object of class Ragraph and not
a standard graph.  Ragraph is really an internal class.
Unfortunately, you cannot convert from Ragraph to a standard graph
(which is quite unfortunately).

What you are doing, is using the
  edgeRenderInfo()
paradigm as described in the vignette "newRgraphvizInterface".  This
works on graph objects, but not Ragraph.

Instead, you need to use the old style layout functions, like
  plot( , nodeAttrs = list(), edgeAttrs = list())

Let me end by saying that your request is completely reasonable and it
is unfortunate that it is not easy to do.  Recently, I spent a lot of
time fixing up the C code for Rgraphviz and the next step is cleaning
up the R code.  However, due to other commitments, this may take a
while to materialize.

Best,
Kasper

On Wed, Dec 19, 2012 at 4:32 PM, Alexis Dinno <alexis.dinno at pdx.edu> 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



More information about the Bioconductor mailing list