cytoscape / py4cytoscape

Python library for calling Cytoscape Automation via CyREST
https://Py4Cytoscape.readthedocs.io
Other
70 stars 14 forks source link

Allow full style definition to be fetched and created #86

Closed bdemchak closed 2 years ago

bdemchak commented 2 years ago

While it's possible to fetch all style defaults and mappings, it's hard to fetch or set them all at once.

Create a new function:

def get_visual_style(style_name, format=None, base_url=DEFAULT_BASE_URL):

where format=None returns a dictionary containing title, defaults, and mappings where format='cytoscapejs' returns an array suitable for CytoscapeJS' CSS

Adjust the existing create_visual_style() function to accept 'defaults' parameter in existing dictionary format or in list format returned by new get_visual_style().

Therefore, to use create_visual_style() to create an entire format, this round trip would be possible:

full_style = get_visual_style('myStyle') create_visual_style('newStyle', defaults=full_style['defaults'], mappings=full_style['mappings'])

bdemchak commented 2 years ago

Done ... get_visual_style_JSON was the name used for the new function.