cytoscape / RCy3

New version of RCy3, redesigned and collaboratively maintained by Cytoscape developer community
MIT License
49 stars 20 forks source link

setNodeColorBypass errors #63

Closed kkami1115 closed 5 years ago

kkami1115 commented 5 years ago

When I ran the following script, an error occurred in setNodeColorBypass(). https://github.com/kkami1115/ForOpen/blob/master/Visualization%20of%20metabolites%20using%20rWikiPathways%20and%20RCy3.R

Error message: RCy3::cyrestPUT, HTTP Error Code: 500 url=http://localhost:1234/v1/networks/1340/views/1350/nodes?bypass=TRUE body=[ { "SUID": null, "view": [ { "visualProperty": "NODE_FILL_COLOR", "value": "#FFFFFF" } ] }, { "SUID": null, "view": [ { "visualProperty": "NODE_FILL_COLOR", "value": "#FFFFFF" } ] }, { "SUID": null, "view": [ { "visualProperty": "NODE_FILL_COLOR", "value": "#FFFFFF" } ] }, { "SUID": 1386, "view": [ { "visualProperty": "NODE_FILL_COLOR", "value": "#FFFFFF" } ] }, { "SUID": null, "view": [ { "visualProperty": "NODE_FILL_COLOR", "value": "#FFFFFF" } ] }, { "SUID": null, "view": [ { "visualProperty": "NODE_FILL_COLOR", "value": "#FFFFFF" } ] }, { "SUID": null, "view": [ { "visualProperty": "NODE_FILL_COLOR", "value": "#FFFFFF" } ] }, { "SUID": null, "view": [ { "visualProperty": "NODE_FILL_COLOR", "value": "#FFFFFF" } ] }, { "SUID": null, "view": [ { "visualProperty": "NODE_FILL_COLOR", "value": "#FFFFFF" } ] }, { "SUID": null, "view": [ { "visualProperty": "NODE_FILL_COLOR", "value": "#FFFFFF" } ] }, { "SUID": null, "view": [ { "visualProperty": "NODE_FILL_COLOR", "value": "#FFFFFF" } ] } ] cyrestPUT(paste("networks", net.SUID, "views", view.SUID, "nodes", でエラー:

A similar bug happened with Issue #45 , but I can't solve it by my side, so I set up this topic. I'm sorry I'm newbie about this package, so I can't tell what information we need. Let me know if you want any necessary information about my environment.

sessionInfo()
R version 3.6.0 (2019-04-26)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Ubuntu 16.04.6 LTS

AlexanderPico commented 5 years ago

Cool script! This is not a "newbie" usage :)

We need to isolate the problem, however, since setNodeBorderColorBypass() seems to run fine in this example (in my hands). Can you try to reproduce just these steps:

commandsRun('wikipathways import-as-pathway id=WP3622')
setNodeBorderColorBypass(node.names = "Methionine", new.colors = "#FF0000")

When I run these two lines, I see the pathway with Methionine's border colored red. What do you see?

kkami1115 commented 5 years ago

I don't know why but I deleted the line where the error occurred, so I restored. Please take a look at the script again, and at the very end there is a line for setNodeColorBypass (). If you run this, the above error will appear.

AlexanderPico commented 5 years ago

Your script is too advanced to use as a test case. Can you reduce the problem to a few lines? For example, I can run the following with no error, suggeting that there is not a problem with setNodeColorBypass():

commandsRun('wikipathways import-as-pathway id=WP3622')
setNodeBorderColorBypass(node.names = "Methionine", new.colors = "#FF0000")
setNodeColorBypass(node.names = "Methionine", new.colors = "#FF0000")

Do these 3 lines work for you or do you get an error? What is different about your script that leads to the error?

AlexanderPico commented 5 years ago

Based on your error message, my guess would be that the list of node.names you are passing in includes a bunch of null entries. These would be rejected by cyREST. Not a RCy3 bug.

kkami1115 commented 5 years ago

The wrong way to pass names to node.bames in R? I’ll confirm.

AlexanderPico commented 5 years ago

The node.names have to either match the values in the name column or the SUID column of the Node Table. If some of the name column vaues are not unique or are blank, then SUID values might work better in your case.

Regardless of what you supply, they are ultimately translated to node SUIDs which, as you can see from your error report, include a lot of null values, e.g., "SUID": null. So, supplying the correct SUIDs directly can get around issues like this.

kkami1115 commented 5 years ago

I managed to get correspondence between SUID and node.names and names using RCy3::getTableColumns() and grayed out only the unsupported graphIds. It was just my misconception, thank you for your commenting carefully.