Skip to content

Commit

Permalink
some scaled stuff
Browse files Browse the repository at this point in the history
  • Loading branch information
ctb committed Nov 10, 2024
1 parent e2e33a8 commit b85caf2
Show file tree
Hide file tree
Showing 3 changed files with 56 additions and 2 deletions.
30 changes: 30 additions & 0 deletions src/python/tests/test_manysearch.py
Original file line number Diff line number Diff line change
Expand Up @@ -379,6 +379,36 @@ def test_simple_threshold(runtmp, indexed, zip_query):
assert len(df) == 3


def test_simple_scaled(runtmp, indexed, zip_query):
# test with a different scaled
query_list = runtmp.output("query.txt")
against_list = runtmp.output("against.txt")

sig2 = get_test_data("2.fa.sig.gz")
sig47 = get_test_data("47.fa.sig.gz")
sig63 = get_test_data("63.fa.sig.gz")

make_file_list(query_list, [sig2, sig47, sig63])
make_file_list(against_list, [sig2, sig47, sig63])

if indexed:
against_list = index_siglist(runtmp, against_list, runtmp.output("db"))

if zip_query:
query_list = zip_siglist(runtmp, query_list, runtmp.output("query.zip"))

output = runtmp.output("out.csv")

runtmp.sourmash(
"scripts", "manysearch", query_list, against_list, "-o", output, "-s", "10_000"
)
assert os.path.exists(output)

df = pandas.read_csv(output)
assert len(df) == 3
assert set(list(df['scaled'])) == {10000}


def test_simple_manifest(runtmp, indexed):
# test with a simple threshold => only 3 results
query_list = runtmp.output("query.txt")
Expand Down
6 changes: 4 additions & 2 deletions src/python/tests/test_multisearch.py
Original file line number Diff line number Diff line change
Expand Up @@ -1195,9 +1195,11 @@ def test_mismatched_scaled_query(runtmp):

output = runtmp.output("out.csv")

runtmp.sourmash("scripts", "multisearch", query_list, against_list, "-o", output)
runtmp.sourmash("scripts", "multisearch", query_list, against_list, "-o", output, '-s', '10_000')
assert os.path.exists(output)

df = pandas.read_csv(output)
assert len(df) == 5
assert set(list(df['scaled'])) == {10_000}

def test_mismatched_scaled_against(runtmp):
# test what happens if against scaled is too high
Expand Down
22 changes: 22 additions & 0 deletions src/python/tests/test_pairwise.py
Original file line number Diff line number Diff line change
Expand Up @@ -728,3 +728,25 @@ def test_simple_below_threshold_write_all_no_ani(runtmp):
assert float(row["jaccard"]) == 1.0
assert row["query_name"] == row["match_name"]
assert row["query_md5"] == row["match_md5"]


def test_simple_scaled(runtmp):
# test basic execution w/scaled!
query_list = runtmp.output("query.txt")
against_list = runtmp.output("against.txt")

sig2 = get_test_data("2.fa.sig.gz")
sig47 = get_test_data("47.fa.sig.gz")
sig63 = get_test_data("63.fa.sig.gz")

make_file_list(query_list, [sig2, sig47, sig63])

output = runtmp.output("out.csv")

runtmp.sourmash(
"scripts", "pairwise", query_list, "-o", output, "-s", "10_000"
)
assert os.path.exists(output)
df = pandas.read_csv(output)
assert len(df) == 1
assert set(list(df['scaled'])) == {10_000}

0 comments on commit b85caf2

Please sign in to comment.