cytoscape / py2cytoscape

Python utilities for Cytoscape and Cytoscape.js
https://py2cytoscape.readthedocs.io
MIT License
178 stars 45 forks source link

How to obtain a CyNetwork object from a remote server #13

Closed brownmk closed 8 years ago

brownmk commented 9 years ago

cy = CyRestClient(ip="remote.host.org", port="1234", version="v1") X=cy.network.get_all() for x in X: print cy.network.get(x) # okay, we can get the network in json format

The question is how can be obtain the network as a CyNetwork() object instead. How do I set the ip to "remote.host.org" for the CyNetwork() class? It connects to localhost by default. Thanks!

keiono commented 9 years ago

Yes, this is a bit confusing, but here is how:

all_suid = cy.network.get_all()
net1 = cy.network.create(all_suid[0])

Now net1 is the CyNetwork object and you have access to all API available for the network.

brownmk commented 9 years ago

This does not seem to work, NetworkClient.create() calls CyNetwork(network_id). However, CyNetwork still has its BASE_URL set to localhost. We somehow need to pass "remote.host.org" to CyNetwork class. Thanks.