tmuetze / Bioconductor_RCy3_the_new_RCytoscape

Update RCytoscape to work for Cytoscape 3.0 and higher using CyREST
16 stars 10 forks source link

Possible bug in getGraphFromCyWindow #43

Open laurent-jacob opened 7 years ago

laurent-jacob commented 7 years ago

Hi,

Thanks for your work on this package.

I tried to load from Cytoscape a network (attached) with two unnamed edges, and obtained an error in my call to RCy3::existing.CytoscapeWindow:

Error in strsplit(g.edge.names, regex) : non-character argument

traceback() 4: strsplit(g.edge.names, regex) 3: getGraphFromCyWindow(cy.window, title) 2: getGraphFromCyWindow(cy.window, title) 1: RCy3::existing.CytoscapeWindow(w, copy.graph.from.cytoscape.to.R = TRUE)

The culprit seems to be the following bit in getGraphFromCyWindow:

g.edge.names = sapply(loc.obj@edge.suid.name.dict, function(e) { e$name })

where the sapply does not simplify its returned values from a list to a vector since two of them are NULL.

A possible fix could be something like:

g.edge.names <- sapply(loc.obj@edge.suid.name.dict, function(e) { if(!is.null(e[["name"]])){ e$name }else{ 'no-name' } })

and maybe something similar for the node part in case a node is unnamed?

Best,

Laurent

100001.owl.gz

AlexanderPico commented 6 years ago

Hi Laurent,

The RCy3 package has been overhauled and the latest version available from bioconductor loads your example .owl file without error.

http://bioconductor.org/packages/release/bioc/html/RCy3.html

File any new issues here: https://github.com/cytoscape/RCy3/issues