Closed StefanR-github closed 3 years ago
@StefanR-github Very strange. There are lots of unit tests around this topic, and they're all well behaved. So, there must be some unexpected context.
First, thanks for trying py4cytoscape and letting me know about this problem!
This error appears to be occurring in the HTTP python library. And the URL ( http://127.0.0.1:1234/v1/networks/78/views/1044/nodes?bypass=True ) looks plausible. I wish I could see what body= parameter was being passed to the library.
My tests are using both Cytoscape 3.8.2 and the nightly Cytoscape 3.9.0 build. I'm also using py4cytoscape 0.0.9 (just released on PyPI). I'm executing from PyCharm.
It looks like you're using Anaconda ... I'm guessing you're executing from a command line ... maybe on a Mac or Linux? What version of py4cytoscape and Cytoscape are you using?
Your log snippet is helpful, but doesn't tell the whole story. Are you aware of the py4cytoscape-specific logs? I think you might find them in the "logs" folder in your python working directory. The later entries would be very helpful here. They look something like the log at the end of this post .... for "set_node_border_color_bypass(['YGL035C', 'YLR044C', 'YNL216W', 'YIL162W'], '#2AFFD8')". The most important line is in bold (near the end).
Can you send me a log that shows the failure? ... or at least the part of the log that shows the failure?
Also, are you able to execute the sanity test described here? https://py4cytoscape.readthedocs.io/en/latest/install.html#testing-command-line ... a good point of reference.
Is there more of your code you can share with me? If I can reproduce the problem here, we'd be better off.
One thing to consider ... py4cytoscape can execute within Google Colab and it communicates with the Cytoscape on your PC. If you'd like to share your code with me, putting it into a Google Colab notebook might be a good way (though might be a distraction if you're just trying to get something working). I'll leave it to you ... here's an existing Google Colab notebook to give you a flavor: https://colab.research.google.com/github/bdemchak/cytoscape-jupyter/blob/main/gangsu/basic%20protocol%201.ipynb
Are you current on all of your python library modules? Same for Cytoscape ... are you at 3.8.2 or later, and have you updated all of your apps?
Would you be interested in trying the Cytoscape 3.9.0 nightly build? https://cytoscape-builds.ucsd.edu/cytoscape-builds/Cytoscape-3.9.0/nightly/
2021-06-04 11:16:08,768 [DEBUG] py4...: -------------------- 2021-06-04 11:16:22,713 [DEBUG] py4...: Calling set_node_border_color_bypass(['YGL035C', 'YLR044C', 'YNL216W', 'YIL162W'], '#2AFFD8') 2021-06-04 11:16:22,713 [DEBUG] py4...: ǀCalling set_node_property_bypass(['YGL035C', 'YLR044C', 'YNL216W', 'YIL162W'], ['#2AFFD8'], 'NODE_BORDER_PAINT', network=None, base_url='http://127.0.0.1:1234/v1') 2021-06-04 11:16:22,713 [DEBUG] py4...: ǀǀCalling get_network_suid(None, base_url='http://127.0.0.1:1234/v1') 2021-06-04 11:16:22,713 [DEBUG] py4...: ǀǀǀCalling commands_post('network get attribute network="current" namespace="default" columnList="SUID"', base_url='http://127.0.0.1:1234/v1') 2021-06-04 11:16:22,713 [DEBUG] py4...: ǀǀǀHTTP POST(http://127.0.0.1:1234/v1/commands/network/get%20attribute), json: {'network': 'current', 'namespace': 'default', 'columnList': 'SUID'} 2021-06-04 11:16:22,725 [DEBUG] py4...: ǀǀǀOK[200], content: { "data": [ { "SUID": 4317 } ], "errors":[] } 2021-06-04 11:16:22,725 [DEBUG] py4...: ǀǀǀReturning 'commands_post': [{'SUID': 4317}] 2021-06-04 11:16:22,725 [DEBUG] py4...: ǀǀReturning 'get_network_suid': 4317 2021-06-04 11:16:22,725 [DEBUG] py4...: ǀǀCalling get_network_views(4317, base_url='http://127.0.0.1:1234/v1') 2021-06-04 11:16:22,725 [DEBUG] py4...: ǀǀǀCalling get_network_suid(4317, base_url='http://127.0.0.1:1234/v1') 2021-06-04 11:16:22,725 [DEBUG] py4...: ǀǀǀǀCalling cyrest_get('networks', base_url='http://127.0.0.1:1234/v1') 2021-06-04 11:16:22,725 [DEBUG] py4...: ǀǀǀǀHTTP GET(http://127.0.0.1:1234/v1/networks) 2021-06-04 11:16:22,757 [DEBUG] py4...: ǀǀǀǀOK[200], content: [4317] 2021-06-04 11:16:22,757 [DEBUG] py4...: ǀǀǀǀReturning 'cyrest_get': [4317] 2021-06-04 11:16:22,757 [DEBUG] py4...: ǀǀǀReturning 'get_network_suid': 4317 2021-06-04 11:16:22,757 [DEBUG] py4...: ǀǀǀCalling cyrest_get('networks/4317/views', base_url='http://127.0.0.1:1234/v1') 2021-06-04 11:16:22,757 [DEBUG] py4...: ǀǀǀHTTP GET(http://127.0.0.1:1234/v1/networks/4317/views) 2021-06-04 11:16:22,773 [DEBUG] py4...: ǀǀǀOK[200], content: [5033] 2021-06-04 11:16:22,773 [DEBUG] py4...: ǀǀǀReturning 'cyrest_get': [5033] 2021-06-04 11:16:22,773 [DEBUG] py4...: ǀǀReturning 'get_network_views': [5033] 2021-06-04 11:16:22,773 [DEBUG] py4...: ǀǀCalling get_table_columns('node', ['name'], 'default', None, base_url='http://127.0.0.1:1234/v1') 2021-06-04 11:16:22,773 [DEBUG] py4...: ǀǀǀCalling get_network_suid(None, 'http://127.0.0.1:1234/v1') 2021-06-04 11:16:22,773 [DEBUG] py4...: ǀǀǀǀCalling commands_post('network get attribute network="current" namespace="default" columnList="SUID"', base_url='http://127.0.0.1:1234/v1') 2021-06-04 11:16:22,773 [DEBUG] py4...: ǀǀǀǀHTTP POST(http://127.0.0.1:1234/v1/commands/network/get%20attribute), json: {'network': 'current', 'namespace': 'default', 'columnList': 'SUID'} 2021-06-04 11:16:22,799 [DEBUG] py4...: ǀǀǀǀOK[200], content: { "data": [ { "SUID": 4317 } ], "errors":[] } 2021-06-04 11:16:22,799 [DEBUG] py4...: ǀǀǀǀReturning 'commands_post': [{'SUID': 4317}] 2021-06-04 11:16:22,799 [DEBUG] py4...: ǀǀǀReturning 'get_network_suid': 4317 2021-06-04 11:16:22,799 [DEBUG] py4...: ǀǀǀCalling get_table_column_types('node', namespace='default', network=None, base_url='http://127.0.0.1:1234/v1') 2021-06-04 11:16:22,799 [DEBUG] py4...: ǀǀǀǀCalling get_network_suid(None, base_url='http://127.0.0.1:1234/v1') 2021-06-04 11:16:22,799 [DEBUG] py4...: ǀǀǀǀǀCalling commands_post('network get attribute network="current" namespace="default" columnList="SUID"', base_url='http://127.0.0.1:1234/v1') 2021-06-04 11:16:22,799 [DEBUG] py4...: ǀǀǀǀǀHTTP POST(http://127.0.0.1:1234/v1/commands/network/get%20attribute), json: {'network': 'current', 'namespace': 'default', 'columnList': 'SUID'} 2021-06-04 11:16:22,825 [DEBUG] py4...: ǀǀǀǀǀOK[200], content: { "data": [ { "SUID": 4317 } ], "errors":[] } 2021-06-04 11:16:22,825 [DEBUG] py4...: ǀǀǀǀǀReturning 'commands_post': [{'SUID': 4317}] 2021-06-04 11:16:22,825 [DEBUG] py4...: ǀǀǀǀReturning 'get_network_suid': 4317 2021-06-04 11:16:22,825 [DEBUG] py4...: ǀǀǀǀCalling cyrest_get('networks/4317/tables/defaultnode/columns', base_url='http://127.0.0.1:1234/v1') 2021-06-04 11:16:22,825 [DEBUG] py4...: ǀǀǀǀHTTP GET(http://127.0.0.1:1234/v1/networks/4317/tables/defaultnode/columns) 2021-06-04 11:16:22,857 [DEBUG] py4...: ǀǀǀǀOK[200], content: [{"name":"SUID","type":"Long","immutable":true,"primaryKey":true}, {"name":"shared name","type":"String","immutable":true,"primaryKey":false}, ... {"name":"isExcludedFromPaths","type":"Boolean","immutable":false,"primaryKey":false}] 2021-06-04 11:16:22,857 [DEBUG] py4...: ǀǀǀǀReturning 'cyrest_get': [{'name': 'SUID', 'type': 'Long', 'immutable': True, 'primaryKey': True}, {'name': 'shared name', 'type': 'String', 'immutable': True, 'primaryKey': False}, ..., {'name': 'isExcludedFromPaths', 'type': 'Boolean', 'immutable': False, 'primaryKey': False}] 2021-06-04 11:16:22,857 [DEBUG] py4...: ǀǀǀReturning 'get_table_column_types': {'SUID': 'Long', 'shared name': 'String', 'name': 'String', ..., 'isExcludedFromPaths': 'Boolean'} 2021-06-04 11:16:22,857 [DEBUG] py4...: ǀǀǀCalling cyrest_get('networks/4317/tables/defaultnode/columns/SUID', base_url='http://127.0.0.1:1234/v1') 2021-06-04 11:16:22,857 [DEBUG] py4...: ǀǀǀHTTP GET(http://127.0.0.1:1234/v1/networks/4317/tables/defaultnode/columns/SUID) 2021-06-04 11:16:22,874 [DEBUG] py4...: ǀǀǀOK[200], content: {"name":"SUID","values":[4608,4609,...,4607]} 2021-06-04 11:16:22,874 [DEBUG] py4...: ǀǀǀReturning 'cyrest_get': {'name': 'SUID', 'values': [4608, 4609, ..., 4607]} 2021-06-04 11:16:22,874 [DEBUG] py4...: ǀǀǀCalling cyrest_get('networks/4317/tables/defaultnode/columns/name', base_url='http://127.0.0.1:1234/v1') 2021-06-04 11:16:22,874 [DEBUG] py4...: ǀǀǀHTTP GET(http://127.0.0.1:1234/v1/networks/4317/tables/defaultnode/columns/name) 2021-06-04 11:16:22,896 [DEBUG] py4...: ǀǀǀOK[200], content: {"name":"name","values":["YER074W","YBR093C",......,"YIL069C"]} 2021-06-04 11:16:22,896 [DEBUG] py4...: ǀǀǀReturning 'cyrest_get': {'name': 'name', 'values': ['YER074W', 'YBR093C', ..., 'YIL069C']} 2021-06-04 11:16:22,931 [DEBUG] py4...: ǀǀReturning 'get_table_columns': name 4608 YER074W 4609 YBR093C ... 4606 YOL127W 4607 YIL069C
[330 rows x 1 columns] 2021-06-04 11:16:22,947 [DEBUG] py4...: ǀǀCalling cyrest_put('networks/4317/views/5033/nodes', parameters={'bypass': True}, body=[{'SUID': '4566', 'view': [{'visualProperty': 'NODE_BORDER_PAINT', 'value': '#2AFFD8'}]}, {'SUID': '4614', 'view': [{'visualProperty': 'NODE_BORDER_PAINT', 'value': '#2AFFD8'}]}, {'SUID': '4619', 'view': [{'visualProperty': 'NODE_BORDER_PAINT', 'value': '#2AFFD8'}]}, {'SUID': '4440', 'view': [{'visualProperty': 'NODE_BORDER_PAINT', 'value': '#2AFFD8'}]}], base_url='http://127.0.0.1:1234/v1', require_json=False) 2021-06-04 11:16:22,947 [DEBUG] py4...: ǀǀHTTP PUT(http://127.0.0.1:1234/v1/networks/4317/views/5033/nodes), params: {'bypass': True}, json: [{'SUID': '4566', 'view': [{'visualProperty': 'NODE_BORDER_PAINT', 'value': '#2AFFD8'}]}, {'SUID': '4614', 'view': [{'visualProperty': 'NODE_BORDER_PAINT', 'value': '#2AFFD8'}]}, {'SUID': '4619', 'view': [{'visualProperty': 'NODE_BORDER_PAINT', 'value': '#2AFFD8'}]}, {'SUID': '4440', 'view': [{'visualProperty': 'NODE_BORDER_PAINT', 'value': '#2AFFD8'}]}] 2021-06-04 11:16:23,081 [DEBUG] py4...: ǀǀOK[200], content: 2021-06-04 11:16:23,081 [DEBUG] py4...: ǀǀReturning 'cyrest_put': '' 2021-06-04 11:16:23,081 [DEBUG] py4...: ǀReturning 'set_node_property_bypass': '' 2021-06-04 11:16:23,081 [DEBUG] py4...: Returning 'set_node_border_color_bypass': '' 2021-06-04 11:16:23,081 [DEBUG] py4...: --------------------
Thank you for your reply!
I am using Anaconda (v.1.10.0), Cytoscape (v.3.8.2), Jupyter Notebooks (v. 2.2.6) and py4cytoscape (v.0.0.8) and a Windows 10 laptop. All apps are updated in Cytoscape.
I will try out the sanity test and Cytoscape nightly build 3.9.0 right now.
I have made a google drive folder that includes my code in the google colab file. In the folder there is also the log, datafile and cytoscape file.
Fixed
I tried using the suggested sanity test. This one I used: https://github.com/bdemchak/cytoscape-jupyter/tree/main/sanity-test
This repository already gave an error at the code : p4c.cytoscape_version_info()
A similar cy_rest() error. I reinstalled the FileTransfer App in cytoscape. The sanity test also reinstalled my py4cytoscape version. It went from version v.0.0.8. to v.0.0.9.
I think reinstalling py4cytoscape or reinstalling the FileTransfer App or both have somehow fixed the problem.
p4c.set_node_border_color_bypass(col_one_list,'#2AFFD8') Now works correctly
Nice ... thanks! I don't know what the problem was, and I'm glad it's gone. I can imagine something like this coming up with other users, and I'll suggest your path. Still, it nags at me that this happened at all, and I apologize for your lost time. I'll be watchful for possible issues of this sort.
@StefanR-github Hi, Stefan ... I have taken a look at your notebook, and I like what I see ... thanks for exercising these functions. Would you be interested in a few observations about it? I have a few thoughts that might make your life a little easier.
Hi, I am trying to set the border colour of my nodes to a bluegreen colour. I only want the significant nodes to be coloured, for which I have a list. Unfortunately, I keep getting the same error. I tried it with different pathways and different gene lists as well, but I recieve the same error. Also, in cytoscape, some of the significant nodes are given the correct node colour, yet some are not. For example, GSR is coloured, regardless of the error message, and CXCL10 is not......
Code and output is below. I am coding in Jupyter notebooks. Any help is much appreciated. I am relatively new to coding so please use simple words :)
col_one_list = dfSigGene['nodes'].tolist() print(f"\ncol_one_list:\n{col_one_list}\ntype:{type(col_one_list)}")
p4c.set_node_border_color_bypass(col_one_list,'#2AFFD8')
~\anaconda3\lib\site-packages\requests\models.py in raise_for_status(self) 940 if http_error_msg: --> 941 raise HTTPError(http_error_msg, response=self) 942
HTTPError: 500 Server Error: Internal Server Error for url: http://127.0.0.1:1234/v1/networks/78/views/1044/nodes?bypass=True
During handling of the above exception, another exception occurred:
CyError Traceback (most recent call last)