Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/merenlab/anvio
Browse files Browse the repository at this point in the history
  • Loading branch information
semiller10 committed Sep 11, 2024
2 parents 3d9398e + 3886912 commit b988166
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions anvio/kegg.py
Original file line number Diff line number Diff line change
Expand Up @@ -459,6 +459,8 @@ def setup_stray_ko_dict(self, add_entries_to_regular_ko_dict=False):
if add_entries_to_regular_ko_dict:
stray_kos = utils.get_TAB_delimited_file_as_dictionary(self.stray_ko_thresholds_file)
self.ko_dict.update(stray_kos)
# initialize it to None so that things don't break if we try to access this downstream
self.stray_ko_dict = None
else:
self.stray_ko_dict = utils.get_TAB_delimited_file_as_dictionary(self.stray_ko_thresholds_file)
else:
Expand Down Expand Up @@ -3700,7 +3702,7 @@ def init_data_from_modules_db(self):

# if we have our own versions of any stray KOs, then we include them here to enable lookups downstream
k_anvio = f"{k}{STRAY_KO_ANVIO_SUFFIX}"
if self.include_stray_kos and k_anvio in self.ko_dict:
if self.include_stray_kos and (k_anvio in self.ko_dict or (self.stray_ko_dict and k_anvio in self.stray_ko_dict)):
if k_anvio not in self.all_kos_in_db:
src = 'KOfam'
func = self.all_modules_in_db[mod]['ORTHOLOGY'][k] if 'ORTHOLOGY' in self.all_modules_in_db[mod] else self.ko_dict[k_anvio]['definition']
Expand Down Expand Up @@ -4211,7 +4213,7 @@ def __init__(self, args, run=run, progress=progress):
# (henceforth referred to as the KO dict, even though it doesn't only contain KOs for user data)
self.setup_ko_dict(exclude_threshold=self.exclude_kos_no_threshold)
if self.include_stray_kos:
self.setup_stray_ko_dict(add_entries_to_regular_ko_dict=True)
self.setup_stray_ko_dict(add_entries_to_regular_ko_dict=False)
annotation_source_set = set(['KOfam'])

# check for kegg modules db
Expand Down

0 comments on commit b988166

Please sign in to comment.