cytoscape / py2cytoscape

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

Cytoscape default style settings #69

Closed kzhang529 closed 6 years ago

kzhang529 commented 6 years ago

I'm trying to use py2cytoscape to create network on Cytoscape. However, "lock width and height" is always applied on Cytoscape network Node-Style after I run the program, I tried to add some statements like " 'NODE_LOCK_NODE_WIDTH_AND_HEIGHT': False " or "'NODE_VISUAL_PROPERTY_DEPENDENCY': False" to basic_settings dict to avoid locking, but all of them don't work. Could someone tell me how to update default setting to make height and width unlocked?

In addition, it seems that py2cytoscape is still python2 incompatible when I install it by command "pip install py2cytoscape"(Issue #63 has talked about this). I was wondering when will it be updated in master branch.

Cytoscape:

CyRest:

Java:

Code:

 network_style = cy.style.create('Mapping Style') 
 basic_settings = {
    'NODE_WIDTH': 80,
    'NODE_HEIGHT': 35,
    'NODE_BORDER_WIDTH': 0,
    'NODE_VISUAL_DEPENDENCY': False,

    'EDGE_WIDTH': 1,
    'EDGE_TRANSPARENCY': 255,
    'EDGE_STROKE_UNSELECTED_PAINT': '#848484',
    'NETWORK_BACKGROUND_PAINT': '#FFFFFF'}

network_style.update_defaults(basic_settings)

error:

jorgeboucas commented 6 years ago

please use the cyrest module and check out the advanced-cancer-networks-and-data notebook

for eg.:

defaults_dic={"NODE_SHAPE":"ellipse",\
               "NODE_SIZE":"60",\
               "NODE_FILL_COLOR":"#AAAAAA",\
               "EDGE_TRANSPARENCY":"120"}
defaults_list=cytoscape.vizmap.simple_defaults(defaults_dic)

NODE_LABEL=cytoscape.vizmap.mapVisualProperty(visualProperty="NODE_LABEL",mappingType="passthrough",mappingColumn="display name")

cytoscape.vizmap.create_style(title="dataStyle",defaults=defaults_list,mappings=[NODE_LABEL])
sleep(2)
cytoscape.vizmap.apply(styles="dataStyle")
kzhang529 commented 6 years ago

Thanks for your reply, I’ll try that.

Best, Ke

On Aug 7, 2018, at 4:01 PM, Jorge Boucas notifications@github.com wrote:

please use the cyrest module and check out the advanced-cancer-networks-and-data notebook https://github.com/cytoscape/cytoscape-automation/blob/master/for-scripters/Python/advanced-cancer-networks-and-data.ipynb for eg.:

defaults_dic={"NODE_SHAPE":"ellipse",\ "NODE_SIZE":"60",\ "NODE_FILL_COLOR":"#AAAAAA",\ "EDGE_TRANSPARENCY":"120"} defaults_list=cytoscape.vizmap.simple_defaults(defaults_dic)

NODE_LABEL=cytoscape.vizmap.mapVisualProperty(visualProperty="NODE_LABEL",mappingType="passthrough",mappingColumn="display name")

cytoscape.vizmap.create_style(title="dataStyle",defaults=defaults_list,mappings=[NODE_LABEL]) sleep(2) cytoscape.vizmap.apply(styles="dataStyle") — You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/cytoscape/py2cytoscape/issues/69#issuecomment-411183267, or mute the thread https://github.com/notifications/unsubscribe-auth/Am5Ore70JYJ83_tP3VmblUoytkzOOkWEks5uOfIzgaJpZM4VDC2N.

jorgeboucas commented 6 years ago

deprecated