|
19 | 19 | "outputs": [], |
20 | 20 | "source": [ |
21 | 21 | "# Set the base URL for the ARAX reasoner and its endpoint\n", |
22 | | - "endpoint_url = 'https://arax.rtx.ai/api/rtx/v1/query'\n", |
| 22 | + "endpoint_url = 'https://arax.transltr.io/api/arax/v1.4/query'\n", |
23 | 23 | "\n", |
24 | 24 | "# Create a dict of the request, specifying the list of DSL commands\n", |
25 | | - "query = {\"previous_message_processing_plan\": {\"processing_actions\": [\n", |
26 | | - " \"add_qnode(name=DOID:9406, key=n00)\",\n", |
27 | | - " \"add_qnode(type=biolink:ChemicalSubstance, is_set=true, key=n01)\",\n", |
28 | | - " \"add_qnode(type=biolink:Protein, key=n02)\",\n", |
| 25 | + "query = {\"message\":{}, \"operations\": {\"actions\": [\n", |
| 26 | + " \"add_qnode(ids=DOID:9406, key=n00)\",\n", |
| 27 | + " \"add_qnode(categories=biolink:ChemicalEntity, is_set=true, key=n01)\",\n", |
| 28 | + " \"add_qnode(categories=biolink:Protein, key=n02)\",\n", |
29 | 29 | " \"add_qedge(subject=n00, object=n01, key=e00)\", \n", |
30 | 30 | " \"add_qedge(subject=n01, object=n02, key=e01)\",\n", |
31 | 31 | " \"expand(edge_key=[e00,e01])\", \n", |
32 | 32 | " \"overlay(action=overlay_clinical_info, observed_expected_ratio=true, virtual_relation_label=C1, subject_qnode_key=n00, object_qnode_key=n01)\", \n", |
33 | | - " \"filter_kg(action=remove_edges_by_attribute, edge_attribute=observed_expected_ratio, direction=below, threshold=3, remove_connected_nodes=t, qnode_id=n01)\", \n", |
34 | | - " \"filter_kg(action=remove_orphaned_nodes, node_type=protein)\",\n", |
| 33 | + " \"filter_kg(action=remove_edges_by_continuous_attribute, edge_attribute=observed_expected_ratio, \"\n", |
| 34 | + " \"direction=below, threshold=3, remove_connected_nodes=t, qnode_keys=n01)\",\n", |
| 35 | + " \"filter_kg(action=remove_orphaned_nodes, node_category=biolink:Protein)\",\n", |
35 | 36 | " \"overlay(action=compute_ngd, virtual_relation_label=N1, subject_qnode_key=n01, object_qnode_key=n02)\", \n", |
36 | | - " \"filter_kg(action=remove_edges_by_attribute, edge_attribute=ngd, direction=above, threshold=0.85, remove_connected_nodes=t, qnode_id=n02)\",\n", |
| 37 | + " \"filter_kg(action=remove_edges_by_continuous_attribute, edge_attribute=ngd, direction=above, threshold=0.85, \"\n", |
| 38 | + " \"remove_connected_nodes=t, qnode_keys=n02)\",\n", |
37 | 39 | " \"resultify(ignore_edge_direction=true)\",\n", |
38 | 40 | " \"return(message=true, store=true)\"\n", |
39 | 41 | " ]}}" |
|
51 | 53 | "status_code = response_content.status_code\n", |
52 | 54 | "if status_code != 200:\n", |
53 | 55 | " print(\"ERROR returned with status \"+str(status_code))\n", |
54 | | - " print(response_content.json())\n", |
| 56 | + " #print(response_content.json())\n", |
| 57 | + " for x in response_content.json()['logs']:\n", |
| 58 | + " if x['level'] == \"ERROR\":\n", |
| 59 | + " print(x)\n", |
55 | 60 | "else:\n", |
56 | 61 | " print(f\"Response returned with status {status_code}\")" |
57 | 62 | ] |
|
64 | 69 | "source": [ |
65 | 70 | "# Unpack respsonse from JSON and display the information log\n", |
66 | 71 | "response_dict = response_content.json()\n", |
67 | | - "for message in response_dict['log']:\n", |
68 | | - " if message['level'] >= 20:\n", |
69 | | - " print(message['prefix']+message['message'])" |
| 72 | + "for message in response_dict['logs']:\n", |
| 73 | + " if message['level'] == \"INFO\":\n", |
| 74 | + " print(message['level']+\": \"+message['message'])" |
70 | 75 | ] |
71 | 76 | }, |
72 | 77 | { |
|
80 | 85 | " print(f\"Data: {response_dict['id']}\")\n", |
81 | 86 | " match = re.search(r'(\\d+)$', response_dict['id'])\n", |
82 | 87 | " if match:\n", |
83 | | - " print(f\"GUI: https://arax.rtx.ai/?m={match.group(1)}\")\n", |
| 88 | + " print(f\"GUI: https://arax.transltr.io/?m={match.group(1)}\")\n", |
84 | 89 | "else:\n", |
85 | 90 | " print(\"No id was returned in response\")" |
86 | 91 | ] |
|
0 commit comments