'n_drugs' parameter appears to not function correctly when passing in an integer via a TRAPI Query
Hey all,
I'm playing around with toggling the number of results from a specific TRAPI query. When I run the following query
{ "message": {"query_graph": { "nodes": { "disease": { "ids": ["MONDO:0004975"] }, "chemical": { "categories": ["biolink:ChemicalEntity"] } }, "edges": { "t_edge": { "object": "disease", "subject": "chemical", "predicates": ["biolink:treats"], "knowledge_type": "inferred" } } } }, "operations": {"actions": [ "infer(action=drug_treatment_graph_expansion,node_curie=MONDO:0004975,qedge_id=t_edge,n_drugs=10)", "return(message=true, store=true)" ]} }
I get this response "description": "The n_drugs value must be a positive integer. The provided value was 10.
I'm pretty sure this is being caused by the following section of the code. https://github.com/RTXteam/RTX/blob/5945133b6358c73654102eb2892d47916d01747c/code/ARAX/ARAXQuery/ARAX_infer.py#L396-L405
When testing some of the other "operations":"actions" I was able to get them working. Looking at their parameter parsing I see it executes eval when the parameter passed in is a string, which causes the values to be properly read. https://github.com/RTXteam/RTX/blame/5945133b6358c73654102eb2892d47916d01747c/code/ARAX/ARAXQuery/ARAX_infer.py#L522
https://github.com/RTXteam/RTX/blob/5945133b6358c73654102eb2892d47916d01747c/code/ARAX/ARAXQuery/ARAX_infer.py#L544 https://github.com/RTXteam/RTX/blob/5945133b6358c73654102eb2892d47916d01747c/code/ARAX/ARAXQuery/ARAX_infer.py#L557 https://github.com/RTXteam/RTX/blob/5945133b6358c73654102eb2892d47916d01747c/code/ARAX/ARAXQuery/ARAX_infer.py#L570
Let me know if I can provide any more details for this!
Hi @DnlRKorn, thanks for reporting this error.
@edeutsch, I've fixed this error. Could you please help deploy the latest master code? Thanks!
sure, the latest master has been rolled out to the usual locations following the master branch.
code/ARAX/ARAXQuery/ARAX_infer.py | 61 +++++++++--------
code/ARAX/Documentation/DSL_Documentation.md | 328 +++++++++++++++++++++++++++++++++++++++++++++---------------------------------------------
code/ARAX/test/test_ARAX_infer.py | 51 ++++++++++++--
Thanks @edeutsch! I'm wondering if it has been rolled out to the production server.
I just tested a query on arax.ncats.io:
{
"message": {"query_graph": {
"nodes": {
"disease": {
"ids": ["MONDO:0004975"]
},
"chemical": {
"categories": ["biolink:ChemicalEntity"]
}
},
"edges": {
"t_edge": {
"object": "disease",
"subject": "chemical",
"predicates": ["biolink:treats"],
"knowledge_type": "inferred"
}
}
}
},
"operations": {"actions": [
"infer(action=drug_treatment_graph_expansion,node_curie=MONDO:0004975,qedge_id=t_edge,n_drugs=10,n_paths=10)",
"return(message=true, store=true)"
]}
}
It seems not to work. But when I tested it locally, it works for me (https://arax.ncats.io/?r=456).
@chunyuma will test on /beta to verify that works. Requests to roll out to production will be made this Friday.
Thanks @edeutsch.
Hi @DnlRKorn, we fixed this error on https://arax.ncats.io/beta. Please try it now. I tried it and it works.
Once it is rolled out to the production, we can close this issue.
close it as it has been resolved.