Skip to content

Commit

Permalink
more refactor - filename stuff
Browse files Browse the repository at this point in the history
  • Loading branch information
ctb committed Mar 6, 2021
1 parent c43c6e8 commit 23eea6d
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/sourmash/search.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,13 @@ def search_databases(query, databases, threshold, do_containment, best_only,
ignore_abundance, unload_data=False):
results = []
found_md5 = set()
for (obj, filename) in databases:
for (obj, _) in databases:
search_iter = obj.search(query, threshold=threshold,
do_containment=do_containment,
ignore_abundance=ignore_abundance,
best_only=best_only,
unload_data=unload_data)

for (similarity, match, filename) in search_iter:
md5 = match.md5sum()
if md5 not in found_md5:
Expand Down Expand Up @@ -96,7 +97,7 @@ def _find_best(dblist, query, threshold_bp):
best_match = match

# some objects may not have associated filename (e.g. SBTs)
best_filename = fname or filename
best_filename = fname or filename # @CTB

if not best_match:
return None, None, None
Expand Down Expand Up @@ -215,7 +216,7 @@ def gather_databases(query, databases, threshold_bp, ignore_abundance):
average_abund=average_abund,
median_abund=median_abund,
std_abund=std_abund,
filename=filename,
filename=filename, # @CTB
md5=best_match.md5sum(),
name=str(best_match),
match=best_match,
Expand Down

0 comments on commit 23eea6d

Please sign in to comment.