In [2]:
# import data from url
from py2cytoscape.data.cyrest_client import CyRestClient
from IPython.display import Image
import json
# Create REST client for Cytoscape
cy = CyRestClient()
# Reset current session for fresh start
cy.session.delete()
# Load a sample network
network = cy.network.create_from('../sampleData/galFiltered.gml')
# Apply layout to the cytoscape network object
cy.layout.apply(network = network)
#Fit an existing network view to current window.
cy.layout.fit(network=network)
# Show it!!
Image(network.get_png(height=400))
Out[2]:
In [8]:
# Get list of available layout algorithms
layouts = cy.layout.get_all()
print(json.dumps(layouts, indent=4))
In [4]:
# Apply layout
cy.layout.apply(name='circular', network=network)
In [24]:
#Fit an existing network view to current window.
cy.layout.fit(network=network)