Skip to content

Commit

Permalink
Update tests for matching scan id
Browse files Browse the repository at this point in the history
These currently still fail, as expected.
  • Loading branch information
bittremieux committed Aug 22, 2024
1 parent 2738492 commit cdfc98d
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 8 deletions.
5 changes: 4 additions & 1 deletion tests/test_integration.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,10 @@ def test_train_and_run(
assert psms.loc[3, "sequence"] == "LESLLEK"
assert psms.loc[3, "spectra_ref"] == "ms_run[2]:scan=17"
assert psms.loc[4, "sequence"] == "PEPTLDEK"
assert psms.loc[4, "spectra_ref"] == "ms_run[2]:scan=111"
assert (
psms.loc[4, "spectra_ref"]
== "ms_run[2]:merged=11 frame=12 scanStart=763 scanEnd=787"
)

# Finally, try evaluating:
output_filename = tmp_path / "test-eval.mztab"
Expand Down
14 changes: 7 additions & 7 deletions tests/unit_tests/test_unit.py
Original file line number Diff line number Diff line change
Expand Up @@ -864,23 +864,23 @@ def test_spectrum_id_mgf(mgf_small, tmp_path):


def test_spectrum_id_mzml(mzml_small, tmp_path):
"""Test that spectra from mzML files are specified by their scan number."""
"""Test that spectra from mzML files are specified by their scan id."""
mzml_small2 = tmp_path / "mzml_small2.mzml"
shutil.copy(mzml_small, mzml_small2)

index = SpectrumIndex(
tmp_path / "index.hdf5", [mzml_small, mzml_small2], overwrite=True
)
dataset = SpectrumDataset(index)
for i, (filename, scan_nr) in enumerate(
for i, (filename, scan_id) in enumerate(
[
(mzml_small, 17),
(mzml_small, 111),
(mzml_small2, 17),
(mzml_small2, 111),
(mzml_small, "scan=17"),
(mzml_small, "merged=11 frame=12 scanStart=763 scanEnd=787"),
(mzml_small2, "scan=17"),
(mzml_small2, "merged=11 frame=12 scanStart=763 scanEnd=787"),
]
):
spectrum_id = str(filename), f"scan={scan_nr}"
spectrum_id = str(filename), scan_id
assert dataset.get_spectrum_id(i) == spectrum_id


Expand Down

0 comments on commit cdfc98d

Please sign in to comment.