Skip to content

Commit

Permalink
Merge pull request #176 from dib-lab/ctb/update_sourmash_411
Browse files Browse the repository at this point in the history
[MRG] update to sourmash v4.1.1
  • Loading branch information
taylorreiter authored May 24, 2021
2 parents 9d1a895 + cef2195 commit 16bc5bc
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 13 deletions.
4 changes: 1 addition & 3 deletions charcoal/compare_taxonomy.py
Original file line number Diff line number Diff line change
Expand Up @@ -124,9 +124,7 @@ def get_genome_taxonomy(matches_filename, genome_sig_filename, provided_lineage,
tax_assign, match_rank, min_f_ident, min_f_major):
try:
siglist = list(sourmash.load_file_as_signatures(matches_filename))
# TR for empty signatures; update when sourmash#1537 is fixed.
# TR AssertionError covers "assert db" from sourmash _load_database() in sourmash_args.py
except (IndexError, AssertionError) as e:
except (ValueError, AssertionError) as e:
siglist = None

if not siglist:
Expand Down
3 changes: 1 addition & 2 deletions charcoal/contigs_list_contaminants.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,8 +84,7 @@ def main(args):
# load all of the matches from search --containment in the database
try:
siglist = list(sourmash.load_file_as_signatures(args.matches_sig))
# TR for empty signatures; update when sourmash#1537 is fixed.
except IndexError:
except ValueError:
siglist = []
print(f"loaded {len(siglist)} matches from '{args.matches_sig}'")

Expand Down
5 changes: 1 addition & 4 deletions charcoal/contigs_search_taxonomy.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,9 @@ def main(args):
genome_sig = sourmash.load_one_signature(args.genome_sig)

# load all of the matches from search --containment in the database
#with open(args.matches_sig, 'rt') as fp:
try:
siglist = list(sourmash.load_file_as_signatures(args.matches_sig))
# TR for cases with empty sigs that return IndexError; update when sourmash#1537 is fixed
# TR AssertionError covers "assert db" from sourmash _load_database() in sourmash_args.py
except (IndexError, AssertionError) as e:
except (ValueError, AssertionError) as e:
siglist = []
print(f"loaded {len(siglist)} matches from '{args.matches_sig}'")

Expand Down
5 changes: 1 addition & 4 deletions charcoal/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -146,10 +146,7 @@ def close(self):

def gather_at_rank(mh, lca_db, lin_db, match_rank):
"Run gather, and aggregate at given rank."
import copy
# needed for sourmash 4.1.1, instead of copy.copy:
#minhash = mh.to_mutable()
minhash = copy.copy(mh)
minhash = mh.to_mutable()
query_sig = sourmash.SourmashSignature(minhash)

# do the gather:
Expand Down

0 comments on commit 16bc5bc

Please sign in to comment.