Skip to content

Commit

Permalink
Implemented jmzTab mzTab validation unit test
Browse files Browse the repository at this point in the history
  • Loading branch information
Lilferrit committed Aug 6, 2024
1 parent 8b6d41e commit ead0b9d
Show file tree
Hide file tree
Showing 7 changed files with 33 additions and 123 deletions.
16 changes: 5 additions & 11 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,11 @@ jobs:
uses: actions/setup-python@v5
with:
python-version: "3.10"
- name: Set up Java
uses: actions/setup-java@v3
with:
distribution: 'zulu'
java-version: '22'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
Expand All @@ -40,17 +45,6 @@ jobs:
- name: Run unit and system tests
run: |
pytest --cov=casanovo tests/
- name: Set up Java
uses: actions/setup-java@v3
with:
distribution: 'zulu'
java-version: '22'
- name: Run mzTab validation (Windows)
if: runner.os == 'Windows'
run: tests\mzTab_validation\validateMzTab.bat
- name: Run mzTab validation (Linux/macOS)
if: runner.os != 'Windows'
run: tests/mzTab_validation/validateMzTab.sh
- name: Upload coverage to codecov
uses: codecov/codecov-action@v4
with:
Expand Down
File renamed without changes.
64 changes: 0 additions & 64 deletions tests/mzTab_validation/ting_config.yaml

This file was deleted.

Binary file removed tests/mzTab_validation/tiny_model.ckpt
Binary file not shown.
24 changes: 0 additions & 24 deletions tests/mzTab_validation/validateMzTab.bat

This file was deleted.

23 changes: 0 additions & 23 deletions tests/mzTab_validation/validateMzTab.sh

This file was deleted.

29 changes: 28 additions & 1 deletion tests/test_integration.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
import functools
import subprocess
from pathlib import Path

import pyteomics.mztab
from click.testing import CliRunner

from casanovo import casanovo

TEST_DIR = Path(__file__).resolve().parent


def test_train_and_run(
mgf_small, mzml_small, tiny_config, tmp_path, monkeypatch
Expand Down Expand Up @@ -50,7 +53,7 @@ def test_train_and_run(
result = run(eval_args)
assert result.exit_code == 0

# Finally try predicting:
# Try predicting:
output_filename = tmp_path / "test.mztab"
predict_args = [
"sequence",
Expand Down Expand Up @@ -86,6 +89,30 @@ def test_train_and_run(
assert psms.loc[4, "sequence"] == "PEPTLDEK"
assert psms.loc[4, "spectra_ref"] == "ms_run[2]:scan=111"

# 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_auxilliary_cli(tmp_path, monkeypatch):
"""Test the secondary CLI commands"""
Expand Down

0 comments on commit ead0b9d

Please sign in to comment.