Skip to content

Commit 9c31979

Browse files
authored
Merge pull request #258 from BioAnalyticResource/dev
Sync
2 parents 0168dae + 5336ebd commit 9c31979

File tree

3 files changed

+16
-21
lines changed

3 files changed

+16
-21
lines changed

api/resources/proxy.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,12 @@
99
request_headers = {"user-agent": "BAR API", "accept": "application/json"}
1010

1111

12-
@bar_proxy.route("/atted_api4/<string:gene_id>/<int:top_n>")
13-
class ATTEDApi4(Resource):
12+
@bar_proxy.route("/atted_api5/<string:gene_id>/<int:top_n>")
13+
class ATTEDApi5(Resource):
1414
@bar_proxy.param("gene_id", _in="path", default="At1g01010")
1515
@bar_proxy.param("top_n", _in="path", default=5)
1616
def get(self, gene_id="", top_n=""):
17-
"""This end point is a proxy for ATTED-II api version 4.
17+
"""This end point is a proxy for ATTED-II api version 5.
1818
This is used by ThaleMine.
1919
This end point is currently not cached.
2020
"""
@@ -30,7 +30,7 @@ def get(self, gene_id="", top_n=""):
3030

3131
# Now query the web service
3232
payload = {"gene": gene_id, "topN": top_n}
33-
resp = requests.get("https://atted.jp/cgi-bin/api4.cgi", params=payload, headers=request_headers)
33+
resp = requests.get("https://atted.jp/api5/", params=payload, headers=request_headers)
3434

3535
# I think the remote API always returns status 200, so skip status checking
3636
return resp.json()
Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
"entrez_gene_id": [
66
839580
77
],
8-
"type": null,
98
"value": null,
109
"topN": 5,
1110
"database": "Ath-u.c4-0",
@@ -14,36 +13,32 @@
1413
"result_set": [
1514
{
1615
"entrez_gene_id": 839580,
16+
"type": "z",
1717
"results": [
1818
{
1919
"gene": 842367,
2020
"other_id": "At1g60730",
21-
"mutual_rank": 793.88,
22-
"logit_score": 4.5801
21+
"z": 4.5801
2322
},
2423
{
2524
"gene": 838288,
2625
"other_id": "At1g17170",
27-
"mutual_rank": 968.79,
28-
"logit_score": 4.2795
26+
"z": 4.2795
2927
},
3028
{
3129
"gene": 817498,
3230
"other_id": "At2g29490",
33-
"mutual_rank": 1006.44,
34-
"logit_score": 4.2216
31+
"z": 4.2216
3532
},
3633
{
3734
"gene": 829559,
3835
"other_id": "At4g34131",
39-
"mutual_rank": 1014.08,
40-
"logit_score": 4.2101
36+
"z": 4.2101
4137
},
4238
{
4339
"gene": 825091,
4440
"other_id": "At3g59220",
45-
"mutual_rank": 1119.2,
46-
"logit_score": 4.0597
41+
"z": 4.0597
4742
}
4843
],
4944
"other_id": "At1g01010"

tests/resources/test_proxy.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,29 +7,29 @@ class TestIntegrations(TestCase):
77
def setUp(self):
88
self.app_client = app.test_client()
99

10-
def test_get_atted_api4(self):
10+
def test_get_atted_api5(self):
1111
"""This tests the data returned by the Atted proxy
1212
:return:
1313
"""
1414
# Valid data
15-
response = self.app_client.get("/proxy/atted_api4/At1g01010/5")
15+
response = self.app_client.get("/proxy/atted_api5/At1g01010/5")
1616
# Note: pytest is running from project root. So path is relative to project root
17-
with open("tests/data/get_atted_api4.json") as json_file:
17+
with open("tests/data/get_atted_api5.json") as json_file:
1818
expected = load(json_file)
1919
self.assertEqual(response.json, expected)
2020

2121
# Invalid gene
22-
response = self.app_client.get("/proxy/atted_api4/At1g0101x/5")
22+
response = self.app_client.get("/proxy/atted_api5/At1g0101x/5")
2323
expected = {"wasSuccessful": False, "error": "Invalid gene id"}
2424
self.assertEqual(response.json, expected)
2525

2626
# If no data, the service should return this response
27-
response = self.app_client.get("/proxy/atted_api4/At1g01011/5")
27+
response = self.app_client.get("/proxy/atted_api5/At1g01011/5")
2828

2929
expected = {"error": "No gene ID specified.", "status_code": 400}
3030
self.assertEqual(response.json, expected)
3131

3232
# Invalid topN count
33-
response = self.app_client.get("proxy/atted_api4/At1g01010/9999999999999999999")
33+
response = self.app_client.get("proxy/atted_api5/At1g01010/9999999999999999999")
3434
expected = {"wasSuccessful": False, "error": "Invalid count"}
3535
self.assertEqual(response.json, expected)

0 commit comments

Comments
 (0)