Skip to content

Commit

Permalink
Only create an oncoKB cache if it is being used
Browse files Browse the repository at this point in the history
  • Loading branch information
iainrb committed Oct 23, 2024
1 parent c55e639 commit 13252e3
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 additions & 8 deletions src/lib/djerba/util/oncokb/annotator.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,20 +84,21 @@ def __init__(self, tumour_id, oncotree_code, report_dir, scratch_dir=None,
cache_params = oncokb_cache_params() # default values
else:
self.logger.debug("Using supplied OncoKB cache parameters: {}".format(cache_params))
self.apply_cache = cache_params.get_apply_cache()
self.update_cache = cache_params.get_update_cache()
# Read the oncokb access token, if needed
if cache_params.get_apply_cache():
with open(os.environ[self.ONCOKB_TOKEN_VARIABLE]) as token_file:
self.oncokb_token = token_file.read().strip()
else:
if self.apply_cache:
self.logger.debug('Apply-cache enabled, no OncoKB access token required')
self.oncokb_token = None
cache_dir = cache_params.get_cache_dir()
if cache_dir:
else:
with open(os.environ[self.ONCOKB_TOKEN_VARIABLE]) as token_file:
self.oncokb_token = token_file.read().strip()
# Set up the cache, if needed
if self.apply_cache or self.update_cache:
cache_dir = cache_params.get_cache_dir()
self.cache = oncokb_cache(cache_dir, oncotree_code, log_level, log_path)
else:
self.cache = None
self.apply_cache = cache_params.get_apply_cache()
self.update_cache = cache_params.get_update_cache()

def _run_annotator_script(self, command, description):
"""Redact the OncoKB token (-b argument) from logging"""
Expand Down

0 comments on commit 13252e3

Please sign in to comment.