-
Notifications
You must be signed in to change notification settings - Fork 15
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
string protein query gives errors when there are too many proteins #137
Comments
@scootermorris What's the recommendation for use cases like this? |
@mehmetdirenc Thanks for your question. It appears that this error may be coming from the String application. We have asked the String maintainer/guru for information. We'll get back to you as soon as we can. |
Thank you both for the swift replies! |
@mehmetdirenc Hi ... I have tried this with Cytoscape 3.10.2, stringApp v2.1.1 and py4cytoscape 1.8.0. I don't have exactly the network you're working with, but I have no problem passing 500 terms to "string protein query" and then getting subnetworks. Can you give me a self-contained example so I can investigate further? Thanks. |
@mehmetdirenc is working with around 3.5k proteins that he wants to query using py4cytoscape. When he limits his input to 500 proteins, the query works fine. However, when he tries to query all 3.5k proteins at once, he encounters a "URI Too Long" error. |
@GeneCodeSavvy Hi ... sorry to be unclear. I can certainly investigate the py4cytoscape and CyREST links, but I have no expertise with String, This use case seems legitimate and important, and I'm happy to pursue it ... however, I can't generate the network myself. Can you generate the network and a self-contained test script? If you can get me that far, I can take it from there. Thanks. |
Hello ... I have worked on this and can report the following: The reason this is failing is that A good workaround is to use The drawback is that In truth, the Either Can you try |
Hello @bdemchak , I have successfully tested the workaround by using Given that commands_post() does not have the same limitations as commands_run() and provides a more reliable way to handle large queries, could we consider incorporating this logic directly into the library? Automating this fallback mechanism could enhance user experience and streamline operations for cases where large commands are involved. |
Great, Harsh ... thanks for the report. Your suggestion is very reasonable and I'd be taking it if this were early in the py4cytoscape development. The values returned by It's pretty easy to argue that no application depends on the I can't make that argument, though, because py4cytoscape has been out for a couple of years now, and I don't know how For a more rigorous discussion of this, our project follows semantic versioning, which instructs us that any breaking change to the API would require us to bump the major version (i.e., 2.0.0 instead of 1.10.0) as a warning to everyone that their py4cytoscape application may break. For such a small change, a major version bump would be hard to justify. Instead, I propose both a documentation improvement and improvement to the exception message you reported. The idea would be to steer a As it turns out, we're near the end of the v1.10.0 checkout, and such a change would be easy to make. Agree? |
Hi @bdemchak, Thank you for your thoughtful response! I completely agree with your approach. Enhancing the exception message and improving the documentation to guide users towards I'd be happy to work on this enhancement if that works for you. My plan is to add an except requests.exceptions.RequestException as e:
# Check if the error is due to the URI being too long
if e.response.status_code == 414:
# Provide a more informative error message
raise CyError(f"URI Too Long: The command you attempted to execute is too large to be handled via GET request. "
f"Consider switching to commands_post() for larger queries.")
else:
_handle_error(e, force_cy_error=True) Additionally, I'm happy to assist with updating the documentation. If you could provide some guidance on how to get started with that, it would be greatly appreciated. Thank you. |
@GeneCodeSavvy Thanks! I have already gotten this coded and with test suites on my end. I'll check it in tomorrow. I took a slightly different and more focused approach. The idea is to avoid messing up any caller that might depend on a result. As I was working on this, I realized that this would apply even to changes relating to the URI Too Long error. So, I (of course) changed the documentation. I also changed commands_run() so that it issues a "narrate" for this case. A "narrate" is output to the console that doesn't affect what the Python function returns. So, if you're in a Notebook, you'll see the suggestion ... and any code that relies on the old behavior will still work. Your suggestion about having this check in commands_get() is sounding better and better to me, though ... I might relocate the narrate as you suggest. Thanks for the idea! |
Thank you for acknowledging my suggestion! I’m glad to hear the update is coming together smoothly. I'd love to assist with any future updates or ideas you might have. This library is fantastic, and being able to contribute will be a rewarding experience for me. Thanks again for the opportunity! Best regards, |
@GeneCodeSavvy Hi, Harsh ... this change has been committed in branch 1.10.0 ... care to take a look to see what I did?? Take note that the test suite is very substantial, and provides are large part of the value of this package. I'd say that as a portion of the entire project, the py4cytoscape code is about 20%, the documentation is another 20%, and the tests are about 60%. This is fairly typical of a mature, well-executed project, and py4cytoscape strives to be that. |
Hi Bary, I’m curious the expected timeline for merging and releasing this branch as an updated library version. It would be exciting to see these improvements go live. Thanks again for the opportunity to contribute! Best regards, |
Hi, Harsh -- I'm glad you got a look at this ... it seems like you have no problem with the changes. If so, I'll go live with it today or tomorrow. v1.10.0 has had lots of time to cure. I'm happy to see you work on this project, though I think it's fairly mature. I coordinate py4cytoscape changes with the RCy3 group so we can keep our APIs in sync and take best advantage of what we learn. I'm happy to introduce you to the RCy3 group. Can you tell me more about yourself? Particularly, what your biological and computational interests and experiences are. Thanks! BTW, it's OK to shift this conversation to e-mail ... mine is [email protected] |
@bdemchak, Thank you for the message! I'll follow up via email shortly ([email protected]). |
Hi, I have around 3.5k proteins that i want to query from py4cytoscape. When I limit my input to 500 proteins it works fine however when I dont, I get URI Too Long error. Is there a way to get around this issue? Here's the code I use below. Thanks for any help!
The text was updated successfully, but these errors were encountered: