Skip to content

Commit

Permalink
Merge pull request #96 from bento-platform/features/graceful-no-varia…
Browse files Browse the repository at this point in the history
…nts-handling

handle variants queries gracefully when not using gohan
  • Loading branch information
gsfk authored Jun 19, 2024
2 parents 1341709 + 800bf2f commit 9e173fc
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions bento_beacon/utils/search.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
from flask import current_app
from functools import reduce
from .gohan_utils import query_gohan
from .katsu_utils import katsu_filters_query, search_from_config, biosample_ids_for_individuals
from .beacon_response import add_info_to_response


# TODO: search by linked field set elements instead of hardcoding
Expand All @@ -11,6 +13,10 @@ def biosample_id_search(variants_query=None, phenopacket_filters=None, experimen
return []

if variants_query:
if not current_app.config["BEACON_CONFIG"].get("useGohan"):
# variants query even though there are no variants in this beacon, this can happen in a network context
add_info_to_response("No variants available at this beacon, query by metadata values only")
return []
variant_sample_ids = query_gohan(variants_query, "count", ids_only=True)
if not variant_sample_ids:
return []
Expand Down

0 comments on commit 9e173fc

Please sign in to comment.