Skip to content

Commit

Permalink
Update
Browse files Browse the repository at this point in the history
  • Loading branch information
luizirber committed Aug 16, 2018
1 parent a1ec15f commit cb4bf67
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 11 deletions.
4 changes: 1 addition & 3 deletions sourmash/commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -1100,9 +1100,7 @@ def watch(args):
# check ksize from the SBT we are loading
ksize = args.ksize
if ksize is None:
leaf = next(iter(tree.leaves()))
tree_mh = leaf.data.minhash
ksize = tree_mh.ksize
ksize = get_ksize(tree)

E = MinHash(ksize=ksize, n=args.num_hashes, is_protein=is_protein)
streamsig = sig.SourmashSignature(E, filename='stdin', name=args.name)
Expand Down
4 changes: 3 additions & 1 deletion sourmash/sbt.py
Original file line number Diff line number Diff line change
Expand Up @@ -605,7 +605,9 @@ def fill_min_n_below(node, *args, **kwargs):
for child in children:
if child.node is not None:
if isinstance(child.node, Leaf):
min_n_below = min(len(child.node.data.minhash), min_n_below)
# TODO: what if there is more than one?
child_mh = child.node.data[0].minhash
min_n_below = min(len(child_mh), min_n_below)
else:
child_n = child.node.metadata.get('min_n_below', sys.maxsize)
min_n_below = min(child_n, min_n_below)
Expand Down
3 changes: 1 addition & 2 deletions sourmash/sbtmh.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,7 @@ def update(self, parent):
for v in minhash.get_mins():
parent.data.count(v)
min_n_below = parent.metadata.get('min_n_below', sys.maxsize)
min_n_below = min(len(self.data.minhash.get_mins()),
min_n_below)
min_n_below = min(len(minhash), min_n_below)

if min_n_below == 0:
min_n_below = 1
Expand Down
2 changes: 1 addition & 1 deletion sourmash/search.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ def search_databases(query, databases, threshold, do_containment, best_only):
# tree search should always/only return matches above threshold
assert similarity >= threshold

if leaf.data.md5sum() not in found_md5:
if leafdata.md5sum() not in found_md5:
sr = SearchResult(similarity=similarity,
match_sig=leafdata,
md5=leafdata.md5sum(),
Expand Down
8 changes: 4 additions & 4 deletions sourmash/sourmash_args.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

from . import signature as sig
from .sbt import SBT, Node
from .sbtmh import SigLeaf
from .sbtmh import SigLeaf, select_signature

DEFAULT_LOAD_K=31

Expand Down Expand Up @@ -190,11 +190,11 @@ def check_signatures_are_compatible(query, subject):


def check_tree_is_compatible(treename, tree, query, is_similarity_query):
leaf = next(iter(tree.leaves()))
tree_mh = leaf.data.minhash

query_mh = query.minhash

leaf = next(iter(tree.leaves()))
tree_mh = select_signature(leaf, query).minhash

if tree_mh.ksize != query_mh.ksize:
error("ksize on tree '{}' is {};", treename, tree_mh.ksize)
error('this is different from query ksize of {}.', query_mh.ksize)
Expand Down

0 comments on commit cb4bf67

Please sign in to comment.