Skip to content

Commit

Permalink
Added test for cleavable crosslinked peptide fragmentation
Browse files Browse the repository at this point in the history
  • Loading branch information
ErBarb committed Jan 3, 2024
1 parent 7b2c126 commit db1f9f9
Show file tree
Hide file tree
Showing 4 changed files with 188 additions and 12 deletions.
162 changes: 162 additions & 0 deletions tests/unit_tests/data/fragments_meta_data_cl_xl.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,162 @@
[
{
"charge": 2,
"ion_type": "b",
"mass": 36.525833467,
"max_mass": 36.52656398366934,
"min_mass": 36.525102950330655,
"no": 1
},
{
"charge": 2,
"ion_type": "y",
"mass": 61.517151302,
"max_mass": 61.51838164502604,
"min_mass": 61.515920958973965,
"no": 1
},
{
"charge": 1,
"ion_type": "b",
"mass": 72.044390467,
"max_mass": 72.04583135480934,
"min_mass": 72.04294957919066,
"no": 1
},
{
"charge": 2,
"ion_type": "b-short",
"mass": 100.573314967,
"max_mass": 100.57532643329934,
"min_mass": 100.57130350070067,
"no": 2
},
{
"charge": 2,
"ion_type": "b-long",
"mass": 100.573314967,
"max_mass": 100.57532643329934,
"min_mass": 100.57130350070067,
"no": 2
},
{
"charge": 1,
"ion_type": "y",
"mass": 122.02702613700001,
"max_mass": 122.02946667752275,
"min_mass": 122.02458559647727,
"no": 1
},
{
"charge": 2,
"ion_type": "y-short",
"mass": 125.564632802,
"max_mass": 125.56714409465604,
"min_mass": 125.56212150934397,
"no": 2
},
{
"charge": 2,
"ion_type": "y-long",
"mass": 125.564632802,
"max_mass": 125.56714409465604,
"min_mass": 125.56212150934397,
"no": 2
},
{
"charge": 2,
"ion_type": "b-short",
"mass": 152.077907467,
"max_mass": 152.08094902514932,
"min_mass": 152.07486590885065,
"no": 3
},
{
"charge": 2,
"ion_type": "b-long",
"mass": 152.077907467,
"max_mass": 152.08094902514932,
"min_mass": 152.07486590885065,
"no": 3
},
{
"charge": 2,
"ion_type": "y-short",
"mass": 161.083189802,
"max_mass": 161.08641146579603,
"min_mass": 161.07996813820395,
"no": 3
},
{
"charge": 2,
"ion_type": "y-long",
"mass": 161.083189802,
"max_mass": 161.08641146579603,
"min_mass": 161.07996813820395,
"no": 3
},
{
"charge": 1,
"ion_type": "b-short",
"mass": 200.139353467,
"max_mass": 200.14335625406935,
"min_mass": 200.13535067993067,
"no": 2
},
{
"charge": 1,
"ion_type": "b-long",
"mass": 200.139353467,
"max_mass": 200.14335625406935,
"min_mass": 200.13535067993067,
"no": 2
},
{
"charge": 1,
"ion_type": "y-long",
"mass": 250.121989137,
"max_mass": 250.12699157678276,
"min_mass": 250.11698669721727,
"no": 2
},
{
"charge": 1,
"ion_type": "y-short",
"mass": 250.121989137,
"max_mass": 250.12699157678276,
"min_mass": 250.11698669721727,
"no": 2
},
{
"charge": 1,
"ion_type": "b-short",
"mass": 303.148538467,
"max_mass": 303.1546014377693,
"min_mass": 303.14247549623065,
"no": 3
},
{
"charge": 1,
"ion_type": "b-long",
"mass": 303.148538467,
"max_mass": 303.1546014377693,
"min_mass": 303.14247549623065,
"no": 3
},
{
"charge": 1,
"ion_type": "y-short",
"mass": 321.159103137,
"max_mass": 321.16552631906274,
"min_mass": 321.15267995493724,
"no": 3
},
{
"charge": 1,
"ion_type": "y-long",
"mass": 321.159103137,
"max_mass": 321.16552631906274,
"min_mass": 321.15267995493724,
"no": 3
}
]
8 changes: 0 additions & 8 deletions tests/unit_tests/test_annotation.py
Original file line number Diff line number Diff line change
Expand Up @@ -121,11 +121,3 @@ def test_handle_multiple_matches(self):
matched_peaks,
sort_by="illegal",
)

# Create a test suite containing only the test_sqrt test
suite = unittest.TestSuite()
suite.addTest(TestAnnotationPipeline('test_annotate_spectra_noncl_xl'))

# Create a test runner that will run our suite
runner = unittest.TextTestRunner()
runner.run(suite)
30 changes: 26 additions & 4 deletions tests/unit_tests/test_fragments.py
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ class TestInitializePeaks(unittest.TestCase):
"""Class to test initialize_peaks function."""

def test_initialize_peaks(self):
"""Test initialize_peaks_xl with basic input."""
"""Test initialize_peaks with basic input."""
fragments_input = {"sequence": "AAAA",
"mass_analyzer": "FTMS",
"charge": 3,
Expand All @@ -133,8 +133,8 @@ def test_initialize_peaks(self):
self.assertEqual(actual_peptide_sequence, expected_peptide_sequence)
assert_almost_equal(actual_calc_mass_s, expected_mass_s, decimal=5)

def test_initialize_peaks_xl(self):
"""Test initialize_peaks_xl with basic input."""
def test_initialize_peaks_non_cl_xl(self):
"""Test initialize_peaks_xl with basic input for non-cleavable crosslinked peptides."""

initialize_peaks_xl_input = {"sequence": "AKC",
"mass_analyzer": "FTMS",
Expand All @@ -143,7 +143,29 @@ def test_initialize_peaks_xl(self):
"sequence_beta": "AKA"
}

with open(Path(__file__).parent / "data/fragments_meta_data_xl.json", 'r') as file:
with open(Path(__file__).parent / "data/fragments_meta_data_non_cl_xl.json", 'r') as file:
expected_fragments_meta_data = json.load(file)
expected_tmt_nt_term = 1
expected_peptide_sequence = "AKC"
expected_mass = 320.15182

actual_fragments_meta_data, actual_tmt_n_term, actual_peptide_sequence, actual_mass = fragments.initialize_peaks_xl(**initialize_peaks_xl_input)
self.assertEqual(actual_fragments_meta_data, expected_fragments_meta_data)
self.assertEqual(actual_tmt_n_term, expected_tmt_nt_term)
self.assertEqual(actual_peptide_sequence, expected_peptide_sequence)
assert_almost_equal(actual_mass, expected_mass, decimal=5)

def test_initialize_peaks_cl_xl(self):
"""Test initialize_peaks_xl with basic input for cleavable crosslinked peptides."""

initialize_peaks_xl_input = {"sequence": "AKC",
"mass_analyzer": "FTMS",
"crosslinker_position": 2,
"crosslinker_type": "DSSO",
"sequence_beta": "AKA"
}

with open(Path(__file__).parent / "data/fragments_meta_data_cl_xl.json", 'r') as file:
expected_fragments_meta_data = json.load(file)
expected_tmt_nt_term = 1
expected_peptide_sequence = "AKC"
Expand Down

0 comments on commit db1f9f9

Please sign in to comment.