-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathSearchRequest.py
28 lines (21 loc) · 979 Bytes
/
SearchRequest.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
import utils
import sys
def get_data(in_param_datasource, in_param_searchQuery, in_param_maxResults):
result = None
error = None
response_status = 200
qryStr = "MATCH (ds:Datasource {label: '" + in_param_datasource + "'})-[:DATASOURCE_OF]->(:Feature)-[:PARENT_OF*]->(f:Feature) WHERE f.label contains '" + in_param_searchQuery + "' " \
"RETURN f.label as gene, f.start as start, f.end as end, 'neo4j' as seqName, f.id as nodeId, f.taxonomy as level " \
"ORDER BY f.depth limit " + in_param_maxResults
try:
rq_res = utils.cypher_call(qryStr)
df = utils.process_result(rq_res)
result = []
for index, row in df.iterrows():
temp = row.to_dict()
result.append(temp)
except:
error_info = sys.exc_info()
error = str(error_info[0]) + " " + str(error_info[1]) + " " + str(error_info[2])
response_status = 500
return result, error, response_status