Search
Question: Problem using Rgraphviz (edge weights going missing).
0
gravatar for Dan Bolser
9.1 years ago by
Dan Bolser20
Dan Bolser20 wrote:
Hi all, After successfully installing Rgraphviz on this Centos 5.2 (RHEL 4) box (basically with yum install *graphviz*** ..., then using the standard BioC install procedure) and then navigating the packaging error (that actually caused R to crash) described here: http://lists.rpmforge.net/pipermail/users/2007-August/000958.html (Just manually run dot -c as root) I finally got to produce some nice graphs of my data. However, I found that when I tried to write my graphs to file in dot format, the edge weights go missing. I load my graph like this: library(Rgraphviz) myNodes <- paste(nodes$MAPC) myG <- new("graphNEL", nodes=myNodes) for(i in 1:nrow(dat)){ paste(dat[i,"A"], dat[i,"B"]) myG <- addEdge(paste(dat[i,"A"]), paste(dat[i,"B"]), myG, dat[i,"N"]) } plot(myG, "neato") and all well and good (except that I couldn't get the edge weights to translate into line thickness - more on that below). Then I (foolishly?) tried: agwrite(agopen(myG,"test"), filename="test") This produced a file, but the weight attribute of the edges (in dot format?) were all clearly set to 1 (and not the range of values that I have stored in dat$N). I confirmed that my loop was putting the weights somewhere with the following one-liner: lapply(myG at edgeData@data, function(l){l$weight}) but I don't really know what this means. So I think its a bug. The graph should be written to file with the correct weight attributes. AFAICT. Poking around in the data structure I was confused by the apparent number of edges... ew <- unlist(edgeWeights(myG)) length(ew) Why is this not equal to the number of edges that I put in (and the number reported by just printing the graph object)? I tried to set the width of the edges plotted on the graph by using the penwidth attribute, but it had no effect, and was not written to file as an attribute of the graph. ## Try defining some EDGE attributes eAttrs <- list() ## Get the edge weights ew <- unlist(edgeWeights(myG)) length(ew) ## Some need removing for some reason somehow... ew <- ew[setdiff(seq(along = ew), removedEdges(myG))] length(ew) ## Label the attributes vector (so it can be used properly) names(ew) <- edgeNames(myG) eAttrs$penwidth <- ew plot(myG, "neato", edgeAttrs=eAttrs) toFile(agopen(myG, name="test"), filename="test", edgeAttrs=eAttrs) So I read in the vignette, " A list of all available attributes is accessible online at: http://www.graphviz.org/pub/scm/graphviz2/doc/info/attrs. html. Note that there are some di?erences between default values and also some attributes will not have an e?ect in Rgraphviz. Please see the man page for graphvizAttributes for more details." Where is the "man page for graphvizAttributes for more details" ?? It would be good to know what attributes Rgraphviz is ignoring and if penwidth is one of them in particular. Also the vignette didn't tell me who to contact in case of feedback, bugs, questions, etc. Who else should I be bugging with this email? Thanks for reading! Dan. -- R2spec --bioc -u http://www.bioconductor.org/packages/release/bioc/src/contrib/Rgraphvi z_1.18.1.tar.gz
ADD COMMENTlink written 9.1 years ago by Dan Bolser20
Please log in to add an answer.

Help
Access

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.
Powered by Biostar version 2.2.0
Traffic: 238 users visited in the last hour