@@ -32,6 +32,8 @@ def write_mgf_file(
3232 max_rt : Optional [float ] = None ,
3333 min_ccs : Optional [float ] = None ,
3434 max_ccs : Optional [float ] = None ,
35+ merge_precursors : bool = True ,
36+ merge_tolerance : float = 5.0 ,
3537):
3638
3739 start_time = time .time ()
@@ -55,6 +57,8 @@ def write_mgf_file(
5557 max_rt = max_rt ,
5658 min_ccs = min_ccs ,
5759 max_ccs = max_ccs ,
60+ merge_precursors = merge_precursors ,
61+ merge_tolerance = merge_tolerance
5862 )
5963
6064 time .sleep (1 )
@@ -66,8 +70,8 @@ def write_mgf_file(
6670 mgf_lines .append ("BEGIN IONS" )
6771 mgf_lines .append (
6872 f"TITLE={ Path (analysis_dir ).stem } .{ spectrum .low_scan } .{ spectrum .high_scan } .{ spectrum .charge } "
69- f'FILE ="{ Path (analysis_dir ).stem } ", NativeID="merged={ spectrum .precursor_id } frame={ spectrum .parent_id } '
70- f'scanStart={ spectrum .scan_begin } scanEnd={ spectrum .scan_end } "'
73+ f'File ="{ Path (analysis_dir ).stem } ", NativeID="merged={ spectrum .precursor_id } frame={ spectrum .parent_id } '
74+ f'scanStart={ spectrum .scan_begin } scanEnd={ spectrum .scan_end } scan= { spectrum . low_scan } "'
7175 )
7276 mgf_lines .append (f"RTINSECONDS={ spectrum .rt } " )
7377 mgf_lines .append (f"PEPMASS={ spectrum .mass } " )
@@ -76,7 +80,7 @@ def write_mgf_file(
7680 mgf_lines .append (f"{ mz :.5f} { int (intensity )} " )
7781 mgf_lines .append ("END IONS" )
7882
79- file .write ("\n " .join (mgf_lines ) + "\n " )
83+ file .write ("\n " .join (mgf_lines ) + "\n \n " )
8084
8185 total_time = round (time .time () - start_time , 2 )
8286 logger .info (f"Total Time: { total_time :.2f} seconds" )
0 commit comments