Passing a javascript JSON string to locally installed Cytoscape Software

I am trying to understand Cytoscape automation for communicating browser application with Cytoscape desktop software. cyBrowser may be useful as I read. My intention is to pass a json string from the browser application to cytoscape. As indicated at https://github.com/cytoscape/cytoscape-automation/wiki/App-Developers:-Adding-Automation-to-Web-Pages following may be useful, however, I have a string at hand (not a server side url).

<input type="button" class="btn btn-primary" onclick="cybrowser.executeCyCommand('network load url url=http://nrnb.org/data/2017_keserci_biorxiv.xgmml');" value="Load network in Cytoscape">

In addition, I am not able to find a specific documentation similar to the command mentioned above for usage in cyBrowser (please pardon my naivety, I am still getting my head around the cyRest API). My requirement is not limited to above, I would rather like to get network names from the cytoscape software and use them in the browser app, alongwith the possibility to use their edge list data within the browser app. So basically trying establish a two way communication.

It may be pretty easy if I could understand the API well, but given a beginner nature in working on the cyREST API, I would be privileged to get some assistance in the right direction.

Thank you

Upvotes: 1

Views: 77

Answers (1)

Scooter Morris
Scooter Morris

Reputation: 1400

There are a couple of things at play here. First, the cybrowser.executeCommand() doesn't go through CyREST -- it uses the command syntax. To see what commands are available, you can bring up Cytoscape's command window and type "help" to see the namespaces (e.g."network") and "help namespace" to see the commands (e.g. "help network"). In your case, there really isn't a good command to directly send a JSON string to Cytoscape. You would need to use a lower-layer REST call to do that. On the other hand -- it's a good idea and probably something we could implement. There definitely are commands to get edge and node lists from Cytoscape, so you could easily embed those in your Javascript app. Also, there are commands to create a network and add nodes and edges to that network, which is probably how you would need to build the network from your JSON string at this point.

Upvotes: 1

Related Questions