Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MRG: update to (prospective) sourmash r0.18.0 #548

Merged
merged 9 commits into from
Dec 21, 2024
Merged
Show file tree
Hide file tree
Changes from 8 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
82 changes: 40 additions & 42 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@ crate-type = ["cdylib"]
pyo3 = { version = "0.23.3", features = ["extension-module", "anyhow"] }
rayon = "1.10.0"
serde = { version = "1.0.216", features = ["derive"] }
sourmash = { version = "0.17.2", features = ["branchwater"] }
#sourmash = { version = "0.17.2", features = ["branchwater"] }
sourmash = { git = "https://github.com/sourmash-bio/sourmash.git", branch = "latest", features = ["branchwater"] }
serde_json = "1.0.133"
niffler = "2.4.0"
log = "0.4.22"
Expand Down
34 changes: 0 additions & 34 deletions src/python/tests/test_fastgather.py
Original file line number Diff line number Diff line change
Expand Up @@ -427,40 +427,6 @@ def test_bad_against_2(runtmp, capfd):
)


def test_bad_against_3(runtmp, capfd):
# test with a bad against (a .sig.gz file renamed as zip file)
query = get_test_data("SRR606249.sig.gz")

sig2 = get_test_data("2.fa.sig.gz")
against_zip = runtmp.output("against.zip")
# cp sig2 into against_zip
with open(against_zip, "wb") as fp:
with open(sig2, "rb") as fp2:
fp.write(fp2.read())

g_output = runtmp.output("gather.csv")
p_output = runtmp.output("prefetch.csv")

with pytest.raises(utils.SourmashCommandFailed):
runtmp.sourmash(
"scripts",
"fastgather",
query,
against_zip,
"-o",
g_output,
"--output-prefetch",
p_output,
"-s",
"100000",
)

captured = capfd.readouterr()
print(captured.err)

assert "InvalidArchive" in captured.err


@pytest.mark.xfail(reason="should work, bug")
def test_against_multisigfile(runtmp, zip_against):
# test against a sigfile that contains multiple sketches
Expand Down
55 changes: 0 additions & 55 deletions src/python/tests/test_fastmultigather.py
Original file line number Diff line number Diff line change
Expand Up @@ -561,34 +561,6 @@ def test_sig_query(runtmp, capfd, indexed):
}.issubset(keys)


def test_bad_query(runtmp, capfd, indexed):
# test with a bad query (a .sig.gz file renamed as zip file)
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")

query_zip = runtmp.output("query.zip")
# cp sig2 into query_zip
with open(query_zip, "wb") as fp:
with open(sig2, "rb") as fp2:
fp.write(fp2.read())

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

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

with pytest.raises(utils.SourmashCommandFailed):
runtmp.sourmash("scripts", "fastmultigather", query_zip, against_list)

captured = capfd.readouterr()
print(captured.err)

assert "InvalidArchive" in captured.err


def test_missing_query(runtmp, capfd, indexed):
# test missing query
query_list = runtmp.output("query.txt")
Expand Down Expand Up @@ -736,33 +708,6 @@ def test_bad_against(runtmp, capfd):
)


def test_bad_against_2(runtmp, capfd, zip_query):
# test with a bad against (a .sig.gz file renamed as zip file)
query = get_test_data("SRR606249.sig.gz")
query_list = runtmp.output("query.txt")
make_file_list(query_list, [query])

sig2 = get_test_data("2.fa.sig.gz")
against_zip = runtmp.output("against.zip")
# cp sig2 into query_zip
with open(against_zip, "wb") as fp:
with open(sig2, "rb") as fp2:
fp.write(fp2.read())

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

with pytest.raises(utils.SourmashCommandFailed):
runtmp.sourmash(
"scripts", "fastmultigather", query_list, against_zip, "-s", "100000"
)

captured = capfd.readouterr()
print(captured.err)

assert "InvalidArchive" in captured.err


def test_empty_against(runtmp, capfd):
# test bad 'against' file - in this case, an empty one
query = get_test_data("SRR606249.sig.gz")
Expand Down
45 changes: 24 additions & 21 deletions src/python/tests/test_index.py
Original file line number Diff line number Diff line change
Expand Up @@ -429,27 +429,6 @@ def test_index_zipfile_multiparam(runtmp, capfd, toggle_internal_storage):
runtmp.sourmash("scripts", "index", zipf, "-o", output, toggle_internal_storage)


def test_index_zipfile_bad(runtmp, capfd):
# test with a bad input zipfile (a .sig.gz file renamed as zip file)
sig2 = get_test_data("2.fa.sig.gz")

query_zip = runtmp.output("query.zip")
# cp sig2 into query_zip
with open(query_zip, "wb") as fp:
with open(sig2, "rb") as fp2:
fp.write(fp2.read())

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

with pytest.raises(utils.SourmashCommandFailed):
runtmp.sourmash("scripts", "index", query_zip, "-o", output)

captured = capfd.readouterr()
print(captured.err)

assert "Couldn't find End Of Central Directory Record" in captured.err


def test_index_check(runtmp, toggle_internal_storage):
# test check index
siglist = runtmp.output("db-sigs.txt")
Expand Down Expand Up @@ -506,3 +485,27 @@ def test_index_subdir(runtmp, toggle_internal_storage):
print(runtmp.last_result.err)

runtmp.sourmash("scripts", "check", output)


def test_index_misnamed_zipfile(runtmp, capfd):
# test with a misnamed input zipfile (a .sig.gz file renamed as zip file)
# (This is a generic test that checks to make sure misnamed zip files
# can be loaded. It's not really specific to index. See
# https://github.com/sourmash-bio/sourmash_plugin_branchwater/issues/551)
sig2 = get_test_data("2.fa.sig.gz")

query_zip = runtmp.output("query.zip")
# cp sig2 into query_zip
with open(query_zip, "wb") as fp:
with open(sig2, "rb") as fp2:
fp.write(fp2.read())

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

runtmp.sourmash("scripts", "index", query_zip, "-o", output)

captured = capfd.readouterr()
print(captured.err)

assert os.path.exists(output)
assert os.path.isdir(output)
Loading
Loading