paul-shannon / RCyjs

A Bioconductor package to display and manipulate graphs in cytoscape.js from R
MIT License
6 stars 1 forks source link

addGraphFromFile() documentation example does not work #4

Open kyleweise opened 6 years ago

kyleweise commented 6 years ago

The example given in the documentation for the addGraphFromFile() function is:

if(interactive()){
  filename <- system.file(package="RCyjs", "extdata", "sampleGraph.json")
  addGraphFromFile(rcy, filename)
  layout(rcy, "cose")
  fit(rcy, 200)
  }

The rcy variable is never defined, so it is unclear how to use this function.

paul-shannon commented 6 years ago

@kyleweise This is another casualty of the disabled tests at bioc. Working on this now. Fix coming within the hour.

paul-shannon commented 6 years ago

@kyleweise fixed on the master branch, version 2.3.9. Do a fresh pull, fresh R CMD INSTALL

The missing line of code added here:

rcy <- RCyjs()
filename <- system.file(package="RCyjs", "extdata", "sampleGraph.json")
addGraphFromFile(rcy, filename)
layout(rcy, "cose")
fit(rcy, 200)

You might find that RCyjs/inst/unitTests/test_RCyjs.R is your best guide to the package. For the capability demonstrated above, see the function test_addGraphFromFile

Many thanks for the bug report. I'd be delighted to receive more. It will be at least a few days, maybe a couple of weeks, before I have time to add travis/ci (and Promises) in order to ensure comprehensive testing.

kyleweise commented 6 years ago

No worries Paul, glad to help. I'll open issues as I run into them.

Cheers

kyleweise commented 6 years ago

Hi Paul, re-installed the updated package and no errors. However, when I run

library(RCyjs)
rcy <- RCyjs()
filename <- system.file(package = "RCyjs", "extdata", "sampleGraph.json")
addGraphFromFile(rcy, filename)
layout(rcy, "cose")
fit(rcy, 200)

I can see the network, but no labels on the nodes/edges, as I would assume there would be looking at the example JSON (see below). screen shot 2018-07-04 at 12 00 21 pm

Is this intended (i.e. I need to call some other function(s) to add labels, etc.), or is this another bug?

Thanks!

paul-shannon commented 6 years ago

Hi Kyle,

You see the very plain default visual style.

In inst/unitTests/test_RCyjs.R one of the many functions is test_loadStyleFile, from which these lines come:

setBrowserWindowTitle(rcy, "loadStyleFile")

setGraph(rcy, simpleDemoGraph()) layout(rcy, "cola") selectNodes(rcy, c("A", "B")) styleFile.1 <- system.file(package="RCyjs", "extdata", "sampleStyle1.js"); styleFile.2 <- system.file(package="RCyjs", "extdata", "sampleStyle2.js");

for(i in 1:3){ loadStyleFile(rcy, styleFile.1) waitForDisplay(500) loadStyleFile(rcy, styleFile.2) waitForDisplay(500) } # for i

Individual style rules can be called directly from R. See, for starters, test_setNodeLabelRule.

Let me know how it goes.

On Jul 4, 2018, at 3:05 AM, kyleweise notifications@github.com wrote:

Hi Paul, re-installed the updated package and no errors. However, when I run

library(RCyjs) rcy <- RCyjs() filename <- system.file(package = "RCyjs", "extdata", "sampleGraph.json") addGraphFromFile(rcy, filename) layout(rcy, "cose") fit(rcy, 200)

I can see the network, but no labels on the nodes/edges, as I would assume there would be looking at the example JSON (see below).

Is this intended (i.e. I need to call some other function(s) to add labels, etc.), or is this another bug?

Thanks!

— You are receiving this because you commented. Reply to this email directly, view it on GitHub, or mute the thread.