Skip to content
This repository was archived by the owner on Oct 23, 2023. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion beacon_api/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"""
import datetime

from .conf import CONFIG_INFO
from .conf import CONFIG_INFO, SAMPLE_QUERIES

__title__ = CONFIG_INFO.title
__version__ = CONFIG_INFO.version
Expand Down Expand Up @@ -34,3 +34,5 @@
__org_contactUrl__ = CONFIG_INFO.org_contactUrl
__org_logoUrl__ = CONFIG_INFO.org_logoUrl
__org_info__ = {'orgInfo': CONFIG_INFO.org_info}

__sample_queries__ = SAMPLE_QUERIES
5 changes: 3 additions & 2 deletions beacon_api/api/info.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
from .. import __apiVersion__, __title__, __version__, __description__, __url__, __alturl__, __handover_beacon__
from .. import __createtime__, __updatetime__, __org_id__, __org_name__, __org_description__
from .. import __org_address__, __org_logoUrl__, __org_welcomeUrl__, __org_info__, __org_contactUrl__
from .. import __handover_drs__
from .. import __sample_queries__, __handover_drs__
from ..utils.data_query import fetch_dataset_metadata
from ..extensions.handover import make_handover
from aiocache import cached
Expand All @@ -25,6 +25,7 @@ async def beacon_info(host, pool):
beacon_dataset = await fetch_dataset_metadata(pool)

# If one sets up a beacon it is recommended to adjust these sample requests
# for instance by adding a list of other samples in beacon_api/conf/sample_queries.json
sample_allele_request = [{
"alternateBases": "G",
"referenceBases": "A",
Expand Down Expand Up @@ -75,7 +76,7 @@ async def beacon_info(host, pool):
'createDateTime': __createtime__,
'updateDateTime': __updatetime__,
'datasets': beacon_dataset,
'sampleAlleleRequests': sample_allele_request,
'sampleAlleleRequests': __sample_queries__ or sample_allele_request,
'info': {"achievement": "World's first 1.0 Beacon"},
}

Expand Down
4 changes: 4 additions & 0 deletions beacon_api/conf/__init__.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
"""Beacon Python Application Configuration."""

import json
import os
from configparser import ConfigParser
from collections import namedtuple
Expand Down Expand Up @@ -58,3 +59,6 @@ def parse_oauth2_config_file(path):


OAUTH2_CONFIG = parse_oauth2_config_file(os.environ.get('CONFIG_FILE', os.path.join(os.path.dirname(__file__), 'config.ini')))
# Sample query file should be of format [{BeaconAlleleRequest}] https://github.com/ga4gh-beacon/specification/
sampleq_file = os.environ.get('SAMPLEQUERY_FILE', os.path.join(os.path.dirname(__file__), 'sample_queries.json'))
SAMPLE_QUERIES = json.load(open(sampleq_file)) if os.path.isfile(sampleq_file) else []