Skip to content

Commit

Permalink
add mztab validation to dbsearch test
Browse files Browse the repository at this point in the history
  • Loading branch information
VarunAnanth2003 committed Sep 14, 2024
1 parent e474eee commit 4e696b4
Showing 1 changed file with 29 additions and 5 deletions.
34 changes: 29 additions & 5 deletions tests/test_integration.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,25 +20,25 @@ def test_db_search(
CliRunner().invoke, casanovo.main, catch_exceptions=False
)

output_path = tmp_path / "db_search.mztab"
output_filename = tmp_path / "db_search.mztab"

search_args = [
"db-search",
"--config",
tiny_config,
"--output",
str(output_path),
str(output_filename),
str(mgf_medium),
str(tiny_fasta_file),
]

result = run(search_args)

assert result.exit_code == 0
assert output_path.exists()
assert output_path.is_file()
assert output_filename.exists()
assert output_filename.is_file()

mztab = pyteomics.mztab.MzTab(str(output_path))
mztab = pyteomics.mztab.MzTab(str(output_filename))

psms = mztab.spectrum_match_table
assert list(psms.sequence) == [
Expand All @@ -51,6 +51,30 @@ def test_db_search(
"FSGSGSGTDFTLTISSLQPEDFAVYYC+57.021QQDYNLP",
]

# Validate mztab output
validate_args = [
"java",
"-jar",
f"{TEST_DIR}/jmzTabValidator.jar",
"--check",
f"inFile={output_filename}",
]

validate_result = subprocess.run(
validate_args,
stdout=subprocess.PIPE,
stderr=subprocess.PIPE,
text=True,
)

assert validate_result.returncode == 0
assert not any(
[
line.startswith("[Error-")
for line in validate_result.stdout.splitlines()
]
)


def test_train_and_run(
mgf_small, mzml_small, tiny_config, tmp_path, monkeypatch
Expand Down

0 comments on commit 4e696b4

Please sign in to comment.