cytoscape / RCy3

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

'no network views selected' error #98

Closed raph06 closed 3 years ago

raph06 commented 3 years ago

Hi,

Thank you for this nice package. I'm facing an issue that I can't figure out.

This occurs when using the function createNetworkFromDataFrames(nodes, all_edges, title = title, collection = collection)

One time out of two, I get

RCy3::commandsPOST, HTTP Error Code: 500
 url=http://localhost:1234/v1/commands/vizmap/apply
 body={
 "styles": "default" 
} : No network views selected.

This occurs when setting default style via commandsPOST("vizmap apply styles=\"default\"")

This has also been reported here : biostars.org/p/449025/

The fact that it occurs one time out of two let me believe that it's due to the parameters I set to make my network. Though it is not reproducible per se here is the sequence of commands I use, hope it might lead somewhere:

Remove duplicate networks

Selecting edges for arrow, color bypass

Create subnetwork if needed (bug occurs although no Subnetwork needs to be created)

Going back to main network

Collapsing groups

selecting and layout'in some nodes for user to move around

Would there be a way to reset default settings afterwards ? I tried to include
setCurrentView(nview) before the createNetwork command, with no luck.

Best Raphael

AlexanderPico commented 3 years ago

Thanks for the bug report. We would really like to track this one down. The error message is suggesting that we are attempting to apply a visual style on a network that does not exist. As you point out, the problem is within the function, createNetworkFromDataFrames, on this line:

commandsPOST("vizmap apply styles="default"")

Theoretically, this line should "wait" until the network is created, but we think there is a synchronicity issue where Cytoscape says it's done, but it's not actually done yet. This minor delay could be due to a lot of factors, including network size and other resources running at the time, etc., so it is not surprizing that such an error would be hard to reproduce.

I'm tempted to introduce a hacky "pause" in the function is a development version just so folks have something that will work while we tackle the real issue (which is not in the RCy3 code). Would this be helpful to you?

AlexanderPico commented 3 years ago

See progress on CyREST issue: https://github.com/cytoscape/cyREST/issues/106

dotasek commented 3 years ago

I will also look into this. My gut says that this is an issue with events in the Cytoscape model.

There were recently a few changes in the Cytoscape 3.8.1 release that may have inadvertently addressed this. I would suggest checking if that update solves the issue.

AlexanderPico commented 3 years ago

Checked 3.8.1 with troubleshooting script: same error.

https://www.dropbox.com/s/q61hg6bqk15d085/cyrest.R?dl=0

raph06 commented 3 years ago

Hi thank you for the explanation :+1:

slfan2013 commented 3 years ago

Hello,

has this issue fixed? When using Cytoscape 3.8.2, I got error from R:

actors <- data.frame(name=c("Alice", "Bob", "Cecil", "David",
                            "Esmeralda"),
                     age=c(48,33,45,34,21),
                     gender=c("F","M","F","M","F"))
relations <- data.frame(from=c("Bob", "Cecil", "Cecil", "David",
                               "David", "Esmeralda"),
                        to=c("Alice", "Bob", "Alice", "Alice", "Bob", "Alice"),
                        same.dept=c(FALSE,FALSE,TRUE,FALSE,FALSE,TRUE),
                        friendship=c(4,5,5,2,1,1), advice=c(4,5,5,4,2,3))
ig <- graph_from_data_frame(relations, directed=TRUE, vertices=actors)

createNetworkFromIgraph(ig,"myIgraph")
**RCy3::commandsPOST, HTTP Error Code: 500
 url=http://localhost:1234/v1/commands/vizmap/apply
 body={
 "styles": "default" 
}
Error in commandsPOST("vizmap apply styles=\"default\"", base.url = base.url) : 
  No network views selected.**
AlexanderPico commented 3 years ago

Yes, this has been fixed with a temporary "pause" introduced into RCy3. Cytosacpe 3.8.2 does not fix the source problem; this fix will be attempted in 3.9 sometime mid-2021.

In the meantime, update to the latest RCy3 (2.10.0+) and you will have a working script. I tested your sample script 10 times and it completed without error each time.