vfbquery 0.5.1__py3-none-any.whl → 0.5.3__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- test/term_info_queries_test.py +7 -4
- vfbquery/__init__.py +1 -1
- vfbquery/vfb_queries.py +47 -15
- {vfbquery-0.5.1.dist-info → vfbquery-0.5.3.dist-info}/METADATA +1 -1
- {vfbquery-0.5.1.dist-info → vfbquery-0.5.3.dist-info}/RECORD +8 -8
- {vfbquery-0.5.1.dist-info → vfbquery-0.5.3.dist-info}/WHEEL +1 -1
- {vfbquery-0.5.1.dist-info → vfbquery-0.5.3.dist-info}/LICENSE +0 -0
- {vfbquery-0.5.1.dist-info → vfbquery-0.5.3.dist-info}/top_level.txt +0 -0
test/term_info_queries_test.py
CHANGED
|
@@ -70,7 +70,7 @@ class TermInfoQueriesTest(unittest.TestCase):
|
|
|
70
70
|
|
|
71
71
|
self.assertEqual(0, len(terminfo.xrefs))
|
|
72
72
|
|
|
73
|
-
self.assertEqual(
|
|
73
|
+
self.assertEqual(8, len(terminfo.pub_syn))
|
|
74
74
|
|
|
75
75
|
# Check that we have the expected synonym labels (order-independent)
|
|
76
76
|
synonym_labels = [entry.synonym.label for entry in terminfo.pub_syn]
|
|
@@ -151,7 +151,7 @@ class TermInfoQueriesTest(unittest.TestCase):
|
|
|
151
151
|
self.assertFalse("link" in serialized)
|
|
152
152
|
self.assertEqual(4, len(serialized["types"]))
|
|
153
153
|
self.assertTrue("Anatomy" in serialized["types"])
|
|
154
|
-
self.assertEqual("Cyst composed of two cyst cells following the division of a newly-formed cystoblast in the germarium. The two cells are connected by a cytoplasmic bridge.\n([King, 1970](FBrf0021038))", serialized["description"])
|
|
154
|
+
self.assertEqual("Cyst composed of two cyst cells following the division of a newly-formed cystoblast in the germarium. The two cells are connected by a cytoplasmic bridge.\n([Spradling, 1993](FBrf0064777), [King, 1970](FBrf0021038))", serialized["description"])
|
|
155
155
|
self.assertTrue("synonyms" in serialized)
|
|
156
156
|
self.assertEqual(1, len(serialized["synonyms"]))
|
|
157
157
|
self.assertEqual("has_exact_synonym: germarial 2-cell cluster ([King, 1970](FBrf0021038))", serialized["synonyms"][0])
|
|
@@ -172,10 +172,13 @@ class TermInfoQueriesTest(unittest.TestCase):
|
|
|
172
172
|
self.assertFalse("examples" in serialized)
|
|
173
173
|
self.assertFalse("thumbnail" in serialized)
|
|
174
174
|
self.assertTrue("references" in serialized)
|
|
175
|
-
self.assertEqual(
|
|
175
|
+
self.assertEqual(2, len(serialized["references"]))
|
|
176
|
+
self.assertEqual({'link': '[Spradling, 1993, Bate, Martinez Arias, 1993: 1--70](FBrf0064777)',
|
|
177
|
+
'refs': ['http://flybase.org/reports/FBrf0064777'],
|
|
178
|
+
'types': ' pub'}, serialized["references"][0])
|
|
176
179
|
self.assertEqual({'link': '[King, 1970, Ovarian Development in Drosophila melanogaster. ](FBrf0021038)',
|
|
177
180
|
'refs': ['http://flybase.org/reports/FBrf0021038'],
|
|
178
|
-
'types': ' pub'}, serialized["references"][
|
|
181
|
+
'types': ' pub'}, serialized["references"][1])
|
|
179
182
|
self.assertFalse("targetingSplits" in serialized)
|
|
180
183
|
self.assertFalse("targetingNeurons" in serialized)
|
|
181
184
|
|
vfbquery/__init__.py
CHANGED
vfbquery/vfb_queries.py
CHANGED
|
@@ -2698,7 +2698,7 @@ def get_neuron_neuron_connectivity(short_form: str, return_dataframe=True, limit
|
|
|
2698
2698
|
}
|
|
2699
2699
|
return {
|
|
2700
2700
|
'headers': headers,
|
|
2701
|
-
'
|
|
2701
|
+
'rows': rows,
|
|
2702
2702
|
'count': len(rows)
|
|
2703
2703
|
}
|
|
2704
2704
|
|
|
@@ -2756,7 +2756,7 @@ def get_neuron_region_connectivity(short_form: str, return_dataframe=True, limit
|
|
|
2756
2756
|
}
|
|
2757
2757
|
return {
|
|
2758
2758
|
'headers': headers,
|
|
2759
|
-
'
|
|
2759
|
+
'rows': rows,
|
|
2760
2760
|
'count': len(rows)
|
|
2761
2761
|
}
|
|
2762
2762
|
|
|
@@ -3087,19 +3087,37 @@ def _owlery_query_to_results(owl_query_string: str, short_form: str, return_data
|
|
|
3087
3087
|
owlery_url = f"{owlery_base}{endpoint}?{urlencode(params)}"
|
|
3088
3088
|
|
|
3089
3089
|
import sys
|
|
3090
|
-
|
|
3091
|
-
|
|
3092
|
-
|
|
3093
|
-
|
|
3094
|
-
|
|
3095
|
-
|
|
3096
|
-
|
|
3097
|
-
|
|
3098
|
-
|
|
3099
|
-
|
|
3100
|
-
|
|
3101
|
-
|
|
3102
|
-
|
|
3090
|
+
import requests
|
|
3091
|
+
|
|
3092
|
+
# Check if this is a 400 Bad Request (invalid query) vs other errors
|
|
3093
|
+
is_bad_request = isinstance(e, requests.exceptions.HTTPError) and hasattr(e, 'response') and e.response.status_code == 400
|
|
3094
|
+
|
|
3095
|
+
if is_bad_request:
|
|
3096
|
+
# 400 Bad Request means the term isn't valid for this type of query (e.g., anatomical query on expression pattern)
|
|
3097
|
+
# Return 0 results instead of error
|
|
3098
|
+
print(f"INFO: Owlery query returned 400 Bad Request (invalid for this term type): {owl_query_string}", file=sys.stderr)
|
|
3099
|
+
if return_dataframe:
|
|
3100
|
+
return pd.DataFrame()
|
|
3101
|
+
return {
|
|
3102
|
+
"headers": _get_standard_query_headers(),
|
|
3103
|
+
"rows": [],
|
|
3104
|
+
"count": 0
|
|
3105
|
+
}
|
|
3106
|
+
else:
|
|
3107
|
+
# Other errors (500, network issues, etc.) - return error indication
|
|
3108
|
+
print(f"ERROR: Owlery {'instances' if query_instances else 'subclasses'} query failed: {e}", file=sys.stderr)
|
|
3109
|
+
print(f" Full URL: {owlery_url}", file=sys.stderr)
|
|
3110
|
+
print(f" Query string: {owl_query_string}", file=sys.stderr)
|
|
3111
|
+
import traceback
|
|
3112
|
+
traceback.print_exc()
|
|
3113
|
+
# Return error indication with count=-1
|
|
3114
|
+
if return_dataframe:
|
|
3115
|
+
return pd.DataFrame()
|
|
3116
|
+
return {
|
|
3117
|
+
"headers": _get_standard_query_headers(),
|
|
3118
|
+
"rows": [],
|
|
3119
|
+
"count": -1
|
|
3120
|
+
}
|
|
3103
3121
|
|
|
3104
3122
|
|
|
3105
3123
|
def get_anatomy_scrnaseq(anatomy_short_form: str, return_dataframe=True, limit: int = -1):
|
|
@@ -3906,6 +3924,20 @@ def fill_query_results(term_info):
|
|
|
3906
3924
|
filtered_item = item
|
|
3907
3925
|
filtered_result.append(filtered_item)
|
|
3908
3926
|
|
|
3927
|
+
if 'headers' in result:
|
|
3928
|
+
if 'preview_columns' in query.keys() and len(query['preview_columns']) > 0:
|
|
3929
|
+
filtered_headers = {col: result['headers'][col] for col in query['preview_columns']}
|
|
3930
|
+
else:
|
|
3931
|
+
filtered_headers = result['headers']
|
|
3932
|
+
elif isinstance(result, dict) and 'data' in result:
|
|
3933
|
+
# Handle legacy 'data' key as alias for 'rows'
|
|
3934
|
+
for item in result['data']:
|
|
3935
|
+
if 'preview_columns' in query.keys() and len(query['preview_columns']) > 0:
|
|
3936
|
+
filtered_item = {col: item[col] for col in query['preview_columns']}
|
|
3937
|
+
else:
|
|
3938
|
+
filtered_item = item
|
|
3939
|
+
filtered_result.append(filtered_item)
|
|
3940
|
+
|
|
3909
3941
|
if 'headers' in result:
|
|
3910
3942
|
if 'preview_columns' in query.keys() and len(query['preview_columns']) > 0:
|
|
3911
3943
|
filtered_headers = {col: result['headers'][col] for col in query['preview_columns']}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
test/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
2
2
|
test/readme_parser.py,sha256=Y5cGYaFaTBfUflpQFZh-zMpRFpYu78wUawIjwmFfBp4,5485
|
|
3
|
-
test/term_info_queries_test.py,sha256=
|
|
3
|
+
test/term_info_queries_test.py,sha256=MTp9FnGZWMT0ak49lPqOGhYYIja19m5xtaHFlt-Aw20,37322
|
|
4
4
|
test/test_dataset_template_queries.py,sha256=rRKcgYn8elNfHI0SQBzvCJwkSw4bhoqKrEf3cUjsggg,5291
|
|
5
5
|
test/test_default_caching.py,sha256=rr6LLHiGjUHOtqNpFYXjCzJKjed8iavjYrjWycef5oI,6963
|
|
6
6
|
test/test_examples_code.py,sha256=CCX9aYGofopjTdrrfPrx0sSLB2ZKJCrEp6bJcGx35ew,293
|
|
@@ -22,7 +22,7 @@ test/test_query_performance.py,sha256=0T4qybM2GRInUmpKCQV4Q-cl6sCfxi6PjIodpirQtf
|
|
|
22
22
|
test/test_similar_morphology.py,sha256=SRtr1Zj2_RW55Qe8O6m6SCvb9QfltWgAmxPEzMX-7hg,7390
|
|
23
23
|
test/test_tracts_nerves_innervating.py,sha256=k9l-XlrvLfqzKJNyPhuJq8qBfhhrU5b8QLRnAPv1LMI,8077
|
|
24
24
|
test/test_transcriptomics.py,sha256=VZf3Tgh2XgyGZpojM87j04y42RT2Dbca6xP46h_fQHg,9969
|
|
25
|
-
vfbquery/__init__.py,sha256=
|
|
25
|
+
vfbquery/__init__.py,sha256=pesugXM2yE-UKr9uC0zj5xOjjLUUlMYWFP3Dr6rvpGE,3754
|
|
26
26
|
vfbquery/cache_enhancements.py,sha256=-PCM0YZHPjwUJwJODZLgmz91sDyFGuYz_QRph_kTbB8,17341
|
|
27
27
|
vfbquery/cached_functions.py,sha256=P0YMkKxqWsB7ZNW2AZ8uCoPlD6dMNqh9foqiYiXv1QM,45067
|
|
28
28
|
vfbquery/neo4j_client.py,sha256=zyekidmosybvR5_Qcf18W4rLJt16d-kYMojbeOEkZWY,3904
|
|
@@ -32,9 +32,9 @@ vfbquery/solr_fetcher.py,sha256=_6Cb6W7JmMwZxytDPwB8ydUqZ7MNN7j2YmaF6gpBn0Y,5696
|
|
|
32
32
|
vfbquery/solr_result_cache.py,sha256=sR17d-0V7-TfVf9b0MFmJORXginfg3rDb0mFS-yy8iI,50441
|
|
33
33
|
vfbquery/term_info_queries.py,sha256=GHf1nFFJ32be7-h26EBgE8gRrfIN0XRR5qSlgDxUD9w,42010
|
|
34
34
|
vfbquery/test_utils.py,sha256=7wUA3xgaGu3eLnjC98msNYt1wL538nOimVJjkC0ZLjU,5791
|
|
35
|
-
vfbquery/vfb_queries.py,sha256=
|
|
36
|
-
vfbquery-0.5.
|
|
37
|
-
vfbquery-0.5.
|
|
38
|
-
vfbquery-0.5.
|
|
39
|
-
vfbquery-0.5.
|
|
40
|
-
vfbquery-0.5.
|
|
35
|
+
vfbquery/vfb_queries.py,sha256=zM7e1nwk0iXZ1kp68zjRXrkxha6j0Z5WBX_h6Divql8,199924
|
|
36
|
+
vfbquery-0.5.3.dist-info/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
|
|
37
|
+
vfbquery-0.5.3.dist-info/METADATA,sha256=mn1jsDexJ0NPUSXhVWiC0zWwZWyD8UVQ_lLNXMacgUc,114719
|
|
38
|
+
vfbquery-0.5.3.dist-info/WHEEL,sha256=hPN0AlP2dZM_3ZJZWP4WooepkmU9wzjGgCLCeFjkHLA,92
|
|
39
|
+
vfbquery-0.5.3.dist-info/top_level.txt,sha256=UgaRTTOy4JBdKbkr_gkeknT4eaibm3ztF520G4NTQZs,14
|
|
40
|
+
vfbquery-0.5.3.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|