RCy 1.7.11 edgeAttributes bug

29 views
Skip to first unread message

Robert M. Flight

unread,
Jul 23, 2012, 10:40:31 AM7/23/12
to rcyto...@googlegroups.com
In RCy 1.7.11, adding edge attributes causes a failure, in that the
attributes cannot be sent to the Cytoscape connection.

Examples below.

-Robert


Robert M. Flight, Ph.D.
robertmflight.blogspot.com
bioinformatics.louisville.edu/lab
github.com/rmflight/general/wiki

The most exciting phrase to hear in science, the one that heralds new
discoveries, is not "Eureka!" (I found it!) but "That's funny ..." -
Isaac Asimov


> options(save.defaults=list(compress="xz"), stringsAsFactors=FALSE)
> require(RCytoscape)
Loading required package: RCytoscape
Loading required package: graph
Loading required package: XMLRPC
Warning message:
package ‘RCytoscape’ was built under R version 2.15.1
> # note that is directly from Pauls 'makeSimpleGraph' function
> g = new("graphNEL", edgemode = "directed")
> nodeDataDefaults(g, attr = "type") = "undefined"
> attr(nodeDataDefaults(g, attr = "type"), "class") = "STRING"
> nodeDataDefaults(g, attr = "lfc") = 1
> attr(nodeDataDefaults(g, attr = "lfc"), "class") = "DOUBLE"
> nodeDataDefaults(g, attr = "label") = "default node label"
> attr(nodeDataDefaults(g, attr = "label"), "class") = "STRING"
> nodeDataDefaults(g, attr = "count") = "0"
> attr(nodeDataDefaults(g, attr = "count"), "class") = "INTEGER"
> edgeDataDefaults(g, attr = "edgeType") = "undefined"
> attr(edgeDataDefaults(g, attr = "edgeType"), "class") = "STRING"
> edgeDataDefaults(g, attr = "score") = 0
> attr(edgeDataDefaults(g, attr = "score"), "class") = "DOUBLE"
> edgeDataDefaults(g, attr = "misc") = ""
> attr(edgeDataDefaults(g, attr = "misc"), "class") = "STRING"
> g = graph::addNode("A", g)
> g = graph::addNode("B", g)
> g = graph::addNode("C", g)
> nodeData(g, "A", "type") = "kinase"
> nodeData(g, "B", "type") = "transcription factor"
> nodeData(g, "C", "type") = "glycoprotein"
> nodeData(g, "A", "lfc") = "-3.0"
> nodeData(g, "B", "lfc") = "0.0"
> nodeData(g, "C", "lfc") = "3.0"
> nodeData(g, "A", "count") = "2"
> nodeData(g, "B", "count") = "30"
> nodeData(g, "C", "count") = "100"
> nodeData(g, "A", "label") = "Gene A"
> nodeData(g, "B", "label") = "Gene B"
> nodeData(g, "C", "label") = "Gene C"
> g = graph::addEdge("A", "B", g)
> g = graph::addEdge("B", "C", g)
> g = graph::addEdge("C", "A", g)
> edgeData(g, "A", "B", "edgeType") = "phosphorylates"
> edgeData(g, "B", "C", "edgeType") = "synthetic lethal"
> edgeData(g, "A", "B", "score") = 35
> edgeData(g, "B", "C", "score") = -12
> cw1 <- CytoscapeWindow("test1", graph=g, rpcPort=9000)
> displayGraph(cw1)
entering RCytoscape::displayGraph
estimated displayGraph time: 15.1 seconds
adding 3 nodes...
sending 3 nodes
ending sendNodes
adding 3 edges...
transforming (3) graph edges to nodePairTable
sending 3 edges
adding node attributes...
[1] "type"
[1] "lfc"
[1] "label"
[1] "count"
adding edge attributes...
[1] "edgeType"
entering setEdgeAttributesDirect, edgeType, with 3 names and 3 values
Error in file(file, ifelse(append, "a", "w")) :
cannot open the connection
In addition: Warning message:
In file(file, ifelse(append, "a", "w")) :
cannot open file 'data': Permission denied
> g = new("graphNEL", edgemode = "directed")
> nodeDataDefaults(g, attr = "type") = "undefined"
> attr(nodeDataDefaults(g, attr = "type"), "class") = "STRING"
> nodeDataDefaults(g, attr = "lfc") = 1
> attr(nodeDataDefaults(g, attr = "lfc"), "class") = "DOUBLE"
> nodeDataDefaults(g, attr = "label") = "default node label"
> attr(nodeDataDefaults(g, attr = "label"), "class") = "STRING"
> nodeDataDefaults(g, attr = "count") = "0"
> attr(nodeDataDefaults(g, attr = "count"), "class") = "INTEGER"
> # edgeDataDefaults(g, attr = "edgeType") = "undefined"
> # attr(edgeDataDefaults(g, attr = "edgeType"), "class") = "STRING"
> # edgeDataDefaults(g, attr = "score") = 0
> # attr(edgeDataDefaults(g, attr = "score"), "class") = "DOUBLE"
> # edgeDataDefaults(g, attr = "misc") = ""
> # attr(edgeDataDefaults(g, attr = "misc"), "class") = "STRING"
> g = graph::addNode("A", g)
> g = graph::addNode("B", g)
> g = graph::addNode("C", g)
> nodeData(g, "A", "type") = "kinase"
> nodeData(g, "B", "type") = "transcription factor"
> nodeData(g, "C", "type") = "glycoprotein"
> nodeData(g, "A", "lfc") = "-3.0"
> nodeData(g, "B", "lfc") = "0.0"
> nodeData(g, "C", "lfc") = "3.0"
> nodeData(g, "A", "count") = "2"
> nodeData(g, "B", "count") = "30"
> nodeData(g, "C", "count") = "100"
> nodeData(g, "A", "label") = "Gene A"
> nodeData(g, "B", "label") = "Gene B"
> nodeData(g, "C", "label") = "Gene C"
> g = graph::addEdge("A", "B", g)
> g = graph::addEdge("B", "C", g)
> g = graph::addEdge("C", "A", g)
> # edgeData(g, "A", "B", "edgeType") = "phosphorylates"
> # edgeData(g, "B", "C", "edgeType") = "synthetic lethal"
> cw2 <- CytoscapeWindow("test2", graph=g, rpcPort=9000)
> displayGraph(cw2)
entering RCytoscape::displayGraph
estimated displayGraph time: 15.1 seconds
adding 3 nodes...
sending 3 nodes
ending sendNodes
adding 3 edges...
transforming (3) graph edges to nodePairTable
sending 3 edges
adding node attributes...
[1] "type"
[1] "lfc"
[1] "label"
[1] "count"
adding edge attributes...
> g = new("graphNEL", edgemode = "directed")
> nodeDataDefaults(g, attr = "type") = "undefined"
> attr(nodeDataDefaults(g, attr = "type"), "class") = "STRING"
> nodeDataDefaults(g, attr = "lfc") = 1
> attr(nodeDataDefaults(g, attr = "lfc"), "class") = "DOUBLE"
> nodeDataDefaults(g, attr = "label") = "default node label"
> attr(nodeDataDefaults(g, attr = "label"), "class") = "STRING"
> nodeDataDefaults(g, attr = "count") = "0"
> attr(nodeDataDefaults(g, attr = "count"), "class") = "INTEGER"
> edgeDataDefaults(g, attr = "edgeType") = "undefined"
> attr(edgeDataDefaults(g, attr = "edgeType"), "class") = "STRING"
> # edgeDataDefaults(g, attr = "score") = 0
> # attr(edgeDataDefaults(g, attr = "score"), "class") = "DOUBLE"
> # edgeDataDefaults(g, attr = "misc") = ""
> # attr(edgeDataDefaults(g, attr = "misc"), "class") = "STRING"
> g = graph::addNode("A", g)
> g = graph::addNode("B", g)
> g = graph::addNode("C", g)
> nodeData(g, "A", "type") = "kinase"
> nodeData(g, "B", "type") = "transcription factor"
> nodeData(g, "C", "type") = "glycoprotein"
> nodeData(g, "A", "lfc") = "-3.0"
> nodeData(g, "B", "lfc") = "0.0"
> nodeData(g, "C", "lfc") = "3.0"
> nodeData(g, "A", "count") = "2"
> nodeData(g, "B", "count") = "30"
> nodeData(g, "C", "count") = "100"
> nodeData(g, "A", "label") = "Gene A"
> nodeData(g, "B", "label") = "Gene B"
> nodeData(g, "C", "label") = "Gene C"
> g = graph::addEdge("A", "B", g)
> g = graph::addEdge("B", "C", g)
> g = graph::addEdge("C", "A", g)
> # edgeData(g, "A", "B", "edgeType") = "phosphorylates"
> # edgeData(g, "B", "C", "edgeType") = "synthetic lethal"
> cw3 <- CytoscapeWindow("test3", graph=g, rpcPort=9000)
> displayGraph(cw3)
entering RCytoscape::displayGraph
estimated displayGraph time: 15.1 seconds
adding 3 nodes...
sending 3 nodes
ending sendNodes
adding 3 edges...
transforming (3) graph edges to nodePairTable
sending 3 edges
adding node attributes...
[1] "type"
[1] "lfc"
[1] "label"
[1] "count"
adding edge attributes...
[1] "edgeType"
entering setEdgeAttributesDirect, edgeType, with 3 names and 3 values
Error in file(file, ifelse(append, "a", "w")) :
cannot open the connection
In addition: Warning message:
In file(file, ifelse(append, "a", "w")) :
cannot open file 'data': Permission denied
> sessionInfo()
R version 2.15.0 (2012-03-30)
Platform: x86_64-pc-mingw32/x64 (64-bit)

locale:
[1] LC_COLLATE=English_United States.1252 LC_CTYPE=English_United
States.1252
[3] LC_MONETARY=English_United States.1252 LC_NUMERIC=C
[5] LC_TIME=English_United States.1252

attached base packages:
[1] stats graphics grDevices utils datasets methods base

other attached packages:
[1] RCytoscape_1.7.11 XMLRPC_0.2-4 graph_1.35.1

loaded via a namespace (and not attached):
[1] BiocGenerics_0.3.0 RCurl_1.91-1.1 tools_2.15.0 XML_3.9-4.1
> Sys.time()
[1] "2012-07-23 10:38:05 EDT"

Paul Shannon

unread,
Jul 23, 2012, 11:25:55 AM7/23/12
to rcyto...@googlegroups.com, Robert M. Flight, Paul Shannon
Hi Robert,

This is a mystery. I know of no call to append in RCytoscape. Could you call 'traceback ()' when the error occurs? That should reveal where the failed call is coming from.

I checked in your improvements to "remove.redundancies.in.undirected.graph" on Saturday. They should show up as 1.17.12 by tomorrow morning.

Looking forward to seeing what traceback () says --

- Paul

Robert M. Flight

unread,
Jul 23, 2012, 11:36:51 AM7/23/12
to Paul Shannon, rcyto...@googlegroups.com
Hi Paul,

The results of traceback() are:

> traceback()
12: file(file, ifelse(append, "a", "w"))
11: cat(x, file = file, sep = c(rep.int(sep, ncolumns - 1), "\n"),
append = append)
10: write(sprintf("leaving setEdgeAttributesDirect"))
9: setEdgeAttributesDirect(obj, attribute.name,
caller.specified.attribute.class,
edge.names, values)
8: setEdgeAttributesDirect(obj, attribute.name,
caller.specified.attribute.class,
edge.names, values)
7: setEdgeAttributes(obj, name)
6: setEdgeAttributes(obj, name)
5: FUN("edgeType"[[1L]], ...)
4: lapply(X = X, FUN = FUN, ...)
3: sapply(eda.names(obj@graph), function(name) {
print(name)
setEdgeAttributes(obj, name)
})
2: displayGraph(cw3)
1: displayGraph(cw3)

It appears to be the point at which the edge attributes are appended
to the connection to Cy using "cat". Is there a bad value of "append"
there?

-Robert

Paul Shannon

unread,
Jul 23, 2012, 11:41:32 AM7/23/12
to rcyto...@googlegroups.com, Paul Shannon
My dumb mistake in a residual trace statement.

write (sprintf ('format', args))

should be

write (sprintf ('format', args), stderr ())

If not given a specific argument (like stderr) apparently write () will write to 'data'.

I will fix this and update the repo. In the meantime, you can either delete the whole line, or add "stderr ()" as the last argument.

Sorry!

- Paul
Reply all
Reply to author
Forward
0 new messages