6
6
# micha.birklbauer@gmail.com
7
7
8
8
# version tracking
9
- __version = "1.4.10 "
10
- __date = "2025-03-26 "
9
+ __version = "1.4.11 "
10
+ __date = "2025-07-29 "
11
11
12
12
# REQUIREMENTS
13
13
# pip install pandas
@@ -487,12 +487,14 @@ def check_if_xl_in_frag(row, alpha, ion_type, fragment, crosslinker):
487
487
theoretical_fragments = generate_theoretical_fragments (sequence , modifications_processed , ion_types , max_charge )
488
488
489
489
matched_fragments = dict ()
490
+ matched_fragments_theo = dict ()
490
491
491
492
# match fragments
492
493
for peak_mz in spectrum ["peaks" ].keys ():
493
494
for fragment in theoretical_fragments .keys ():
494
495
if round (peak_mz , 4 ) < round (fragment + match_tolerance , 4 ) and round (peak_mz , 4 ) > round (fragment - match_tolerance , 4 ):
495
496
matched_fragments [peak_mz ] = theoretical_fragments [fragment ]
497
+ matched_fragments_theo [peak_mz ] = fragment
496
498
break
497
499
498
500
# get annotations
@@ -502,6 +504,7 @@ def check_if_xl_in_frag(row, alpha, ion_type, fragment, crosslinker):
502
504
fragment_number = int (matched_fragments [match ].split ("+" )[0 ][1 :])
503
505
fragment_pep_id = 0 if alpha else 1
504
506
fragment_mz = match
507
+ fragment_theo_mz = matched_fragments_theo [match ]
505
508
fragment_rel_intensity = float (spectrum ["peaks" ][match ] / spectrum ["max_intensity" ])
506
509
fragment_loss_type = ""
507
510
fragment_contains_xl = check_if_xl_in_frag (row , alpha , fragment_type , matched_fragments [match ].split (":" )[1 ].strip (), crosslinker )
@@ -511,6 +514,7 @@ def check_if_xl_in_frag(row, alpha, ion_type, fragment, crosslinker):
511
514
"FragmentNumber" : fragment_number ,
512
515
"FragmentPepId" : fragment_pep_id ,
513
516
"FragmentMz" : fragment_mz ,
517
+ "FragmentTheoMz" : fragment_theo_mz ,
514
518
"RelativeIntensity" : fragment_rel_intensity ,
515
519
"FragmentLossType" : fragment_loss_type ,
516
520
"CLContainingFragment" : fragment_contains_xl ,
@@ -797,6 +801,7 @@ def check_if_xl_in_frag(decoy_csm, pep_id, ion_type, ion_number, crosslinker) ->
797
801
"FragmentNumber" : fragment_number ,
798
802
"FragmentPepId" : fragment_pep_id ,
799
803
"FragmentMz" : fragment_mz ,
804
+ "FragmentTheoMz" : fragment_mz ,
800
805
"RelativeIntensity" : fragment_rel_intensity ,
801
806
"FragmentLossType" : fragment_loss_type ,
802
807
"CLContainingFragment" : fragment_contains_xl ,
@@ -1111,6 +1116,7 @@ def main(spectra_file: Union[List[str], List[BinaryIO]] = SPECTRA_FILE,
1111
1116
FragmentNumber_s = list ()
1112
1117
FragmentPepId_s = list ()
1113
1118
FragmentMz_s = list ()
1119
+ FragmentTheoMz_s = list ()
1114
1120
RelativeIntensity_s = list ()
1115
1121
FragmentLossType_s = list ()
1116
1122
CLContainingFragment_s = list ()
@@ -1144,6 +1150,7 @@ def main(spectra_file: Union[List[str], List[BinaryIO]] = SPECTRA_FILE,
1144
1150
FragmentNumber_s_decoy = list ()
1145
1151
FragmentPepId_s_decoy = list ()
1146
1152
FragmentMz_s_decoy = list ()
1153
+ FragmentTheoMz_s_decoy = list ()
1147
1154
RelativeIntensity_s_decoy = list ()
1148
1155
FragmentLossType_s_decoy = list ()
1149
1156
CLContainingFragment_s_decoy = list ()
@@ -1177,6 +1184,7 @@ def main(spectra_file: Union[List[str], List[BinaryIO]] = SPECTRA_FILE,
1177
1184
FragmentNumber_s_decoy_dt = list ()
1178
1185
FragmentPepId_s_decoy_dt = list ()
1179
1186
FragmentMz_s_decoy_dt = list ()
1187
+ FragmentTheoMz_s_decoy_dt = list ()
1180
1188
RelativeIntensity_s_decoy_dt = list ()
1181
1189
FragmentLossType_s_decoy_dt = list ()
1182
1190
CLContainingFragment_s_decoy_dt = list ()
@@ -1210,6 +1218,7 @@ def main(spectra_file: Union[List[str], List[BinaryIO]] = SPECTRA_FILE,
1210
1218
FragmentNumber_s_decoy_td = list ()
1211
1219
FragmentPepId_s_decoy_td = list ()
1212
1220
FragmentMz_s_decoy_td = list ()
1221
+ FragmentTheoMz_s_decoy_td = list ()
1213
1222
RelativeIntensity_s_decoy_td = list ()
1214
1223
FragmentLossType_s_decoy_td = list ()
1215
1224
CLContainingFragment_s_decoy_td = list ()
@@ -1271,6 +1280,7 @@ def main(spectra_file: Union[List[str], List[BinaryIO]] = SPECTRA_FILE,
1271
1280
FragmentNumber_s .append (frag ["FragmentNumber" ])
1272
1281
FragmentPepId_s .append (frag ["FragmentPepId" ])
1273
1282
FragmentMz_s .append (frag ["FragmentMz" ])
1283
+ FragmentTheoMz_s .append (frag ["FragmentTheoMz" ])
1274
1284
RelativeIntensity_s .append (frag ["RelativeIntensity" ])
1275
1285
FragmentLossType_s .append (frag ["FragmentLossType" ])
1276
1286
CLContainingFragment_s .append (frag ["CLContainingFragment" ])
@@ -1333,6 +1343,7 @@ def main(spectra_file: Union[List[str], List[BinaryIO]] = SPECTRA_FILE,
1333
1343
FragmentNumber_s_decoy .append (decoy_frag ["FragmentNumber" ])
1334
1344
FragmentPepId_s_decoy .append (decoy_frag ["FragmentPepId" ])
1335
1345
FragmentMz_s_decoy .append (decoy_frag ["FragmentMz" ])
1346
+ FragmentTheoMz_s_decoy .append (decoy_frag ["FragmentTheoMz" ])
1336
1347
RelativeIntensity_s_decoy .append (decoy_frag ["RelativeIntensity" ])
1337
1348
FragmentLossType_s_decoy .append (decoy_frag ["FragmentLossType" ])
1338
1349
CLContainingFragment_s_decoy .append (decoy_frag ["CLContainingFragment" ])
@@ -1396,6 +1407,7 @@ def main(spectra_file: Union[List[str], List[BinaryIO]] = SPECTRA_FILE,
1396
1407
FragmentNumber_s_decoy_dt .append (decoy_frag_dt ["FragmentNumber" ])
1397
1408
FragmentPepId_s_decoy_dt .append (decoy_frag_dt ["FragmentPepId" ])
1398
1409
FragmentMz_s_decoy_dt .append (decoy_frag_dt ["FragmentMz" ])
1410
+ FragmentTheoMz_s_decoy_dt .append (decoy_frag_dt ["FragmentTheoMz" ])
1399
1411
RelativeIntensity_s_decoy_dt .append (decoy_frag_dt ["RelativeIntensity" ])
1400
1412
FragmentLossType_s_decoy_dt .append (decoy_frag_dt ["FragmentLossType" ])
1401
1413
CLContainingFragment_s_decoy_dt .append (decoy_frag_dt ["CLContainingFragment" ])
@@ -1459,6 +1471,7 @@ def main(spectra_file: Union[List[str], List[BinaryIO]] = SPECTRA_FILE,
1459
1471
FragmentNumber_s_decoy_td .append (decoy_frag_td ["FragmentNumber" ])
1460
1472
FragmentPepId_s_decoy_td .append (decoy_frag_td ["FragmentPepId" ])
1461
1473
FragmentMz_s_decoy_td .append (decoy_frag_td ["FragmentMz" ])
1474
+ FragmentTheoMz_s_decoy_td .append (decoy_frag_td ["FragmentTheoMz" ])
1462
1475
RelativeIntensity_s_decoy_td .append (decoy_frag_td ["RelativeIntensity" ])
1463
1476
FragmentLossType_s_decoy_td .append (decoy_frag_td ["FragmentLossType" ])
1464
1477
CLContainingFragment_s_decoy_td .append (decoy_frag_td ["CLContainingFragment" ])
@@ -1496,6 +1509,7 @@ def main(spectra_file: Union[List[str], List[BinaryIO]] = SPECTRA_FILE,
1496
1509
"FragmentNumber" : FragmentNumber_s ,
1497
1510
"FragmentPepId" : FragmentPepId_s ,
1498
1511
"FragmentMz" : FragmentMz_s ,
1512
+ "FragmentTheoMz" : FragmentTheoMz_s ,
1499
1513
"RelativeIntensity" : RelativeIntensity_s ,
1500
1514
"FragmentLossType" : FragmentLossType_s ,
1501
1515
"CLContainingFragment" : CLContainingFragment_s ,
@@ -1530,6 +1544,7 @@ def main(spectra_file: Union[List[str], List[BinaryIO]] = SPECTRA_FILE,
1530
1544
"FragmentNumber" : FragmentNumber_s_decoy ,
1531
1545
"FragmentPepId" : FragmentPepId_s_decoy ,
1532
1546
"FragmentMz" : FragmentMz_s_decoy ,
1547
+ "FragmentTheoMz" : FragmentTheoMz_s_decoy ,
1533
1548
"RelativeIntensity" : RelativeIntensity_s_decoy ,
1534
1549
"FragmentLossType" : FragmentLossType_s_decoy ,
1535
1550
"CLContainingFragment" : CLContainingFragment_s_decoy ,
@@ -1564,6 +1579,7 @@ def main(spectra_file: Union[List[str], List[BinaryIO]] = SPECTRA_FILE,
1564
1579
"FragmentNumber" : FragmentNumber_s_decoy_dt ,
1565
1580
"FragmentPepId" : FragmentPepId_s_decoy_dt ,
1566
1581
"FragmentMz" : FragmentMz_s_decoy_dt ,
1582
+ "FragmentTheoMz" : FragmentTheoMz_s_decoy_dt ,
1567
1583
"RelativeIntensity" : RelativeIntensity_s_decoy_dt ,
1568
1584
"FragmentLossType" : FragmentLossType_s_decoy_dt ,
1569
1585
"CLContainingFragment" : CLContainingFragment_s_decoy_dt ,
@@ -1598,6 +1614,7 @@ def main(spectra_file: Union[List[str], List[BinaryIO]] = SPECTRA_FILE,
1598
1614
"FragmentNumber" : FragmentNumber_s_decoy_td ,
1599
1615
"FragmentPepId" : FragmentPepId_s_decoy_td ,
1600
1616
"FragmentMz" : FragmentMz_s_decoy_td ,
1617
+ "FragmentTheoMz" : FragmentTheoMz_s_decoy_td ,
1601
1618
"RelativeIntensity" : RelativeIntensity_s_decoy_td ,
1602
1619
"FragmentLossType" : FragmentLossType_s_decoy_td ,
1603
1620
"CLContainingFragment" : CLContainingFragment_s_decoy_td ,
0 commit comments