@@ -105,6 +105,16 @@ def terminate_subprocess():
105105 if not selected_mzML_files :
106106 st .warning ("Please select at least one experiment (mzML/raw file) for generating the library." )
107107 else :
108+ if uploaded_file is not None :
109+ uploaded_stem = Path (uploaded_file .name ).stem
110+
111+ if user_library_name == uploaded_stem :
112+ st .error (
113+ "The library output file name tag cannot be the same as the uploaded library file name. "
114+ "Please choose a different library output file name tag."
115+ )
116+ st .stop ()
117+
108118 # Extract base names (without extension) for matching
109119 mzml_basenames = {os .path .splitext (os .path .basename (f ))[0 ] for f in selected_mzML_files }
110120
@@ -234,49 +244,50 @@ def log(msg: str):
234244
235245 #--------------- File Info---------------------
236246 log ("====> mzML file Info with FileInfo OpenMS <====\n " )
237-
238- FileInfo_exec = os .path .join (os .getcwd (), 'FileInfo' )
239- #st.write(selected_mzML_files)
240- for mzml_file in selected_mzML_files :
241- # Input file: from result-files folder
242- mzml_path_in = Path (st .session_state .workspace , "mzML-files" , mzml_file )
243-
244- # Append current file being processed
245- log (f"---> Processing mzml file FileInfo: { mzml_file } \n " )
246-
247- if os .name == 'nt' :
248- args_FileInfo = [
249- FileInfo_exec ,
250- "-in" , str (mzml_path_in )
251- ]
252- else :
253- args_FileInfo = [
254- "FileInfo" ,
255- "-in" , str (mzml_path_in )
256- ]
257-
258- #st.info(f"Running: {' '.join(args_FileInfo)}")
259-
260- result_FileInfo = subprocess .run (
261- args_FileInfo ,
262- stdout = subprocess .PIPE ,
263- stderr = subprocess .PIPE ,
264- text = True
265- )
266-
267- if result_FileInfo .returncode != 0 :
268- console_output .text ("FileInfo failed" )
269- st .text (result .stderr )
270- st .error ("FileInfo failed" )
271- st .stop ()
272- else :
273- log (f"{ result_FileInfo .stdout } \n " )
274-
275- #-------------------check FileInfo output-----------------
276- if "ion mobility: <none> .. <none>" in result_FileInfo .stdout :
277- log ("\n ====> WARNING: No ion mobility information found in mzML files. Please ensure your data contains ion mobility for library generation. <====\n " )
278- st .error ("No ion mobility information found in mzML files. Please ensure your data contains ion mobility for library generation." )
279- st .stop ()
247+ fileinfo = False
248+ if fileinfo :
249+ FileInfo_exec = os .path .join (os .getcwd (), 'FileInfo' )
250+ #st.write(selected_mzML_files)
251+ for mzml_file in selected_mzML_files :
252+ # Input file: from result-files folder
253+ mzml_path_in = Path (st .session_state .workspace , "mzML-files" , mzml_file )
254+
255+ # Append current file being processed
256+ log (f"---> Processing mzml file FileInfo: { mzml_file } \n " )
257+
258+ if os .name == 'nt' :
259+ args_FileInfo = [
260+ FileInfo_exec ,
261+ "-in" , str (mzml_path_in )
262+ ]
263+ else :
264+ args_FileInfo = [
265+ "FileInfo" ,
266+ "-in" , str (mzml_path_in )
267+ ]
268+
269+ #st.info(f"Running: {' '.join(args_FileInfo)}")
270+
271+ result_FileInfo = subprocess .run (
272+ args_FileInfo ,
273+ stdout = subprocess .PIPE ,
274+ stderr = subprocess .PIPE ,
275+ text = True
276+ )
277+
278+ if result_FileInfo .returncode != 0 :
279+ console_output .text ("FileInfo failed" )
280+ st .text (result .stderr )
281+ st .error ("FileInfo failed" )
282+ st .stop ()
283+ else :
284+ log (f"{ result_FileInfo .stdout } \n " )
285+
286+ #-------------------check FileInfo output-----------------
287+ if "ion mobility: <none> .. <none>" in result_FileInfo .stdout :
288+ log ("\n ====> WARNING: No ion mobility information found in mzML files. Please ensure your data contains ion mobility for library generation. <====\n " )
289+ st .error ("No ion mobility information found in mzML files. Please ensure your data contains ion mobility for library generation." )
290+ st .stop ()
280291
281292 #---------------upload the library file from MSFragger---------------------
282293 if uploaded_file is not None :
@@ -375,8 +386,9 @@ def log(msg: str):
375386
376387 #--------------- Save log file---------------------
377388 if success_pipline :
389+
378390 # copy library output folder to result-files for download
379- copy_folder_library_to_results (output_folder_library )
391+ copy_folder_library_to_results (output_folder_library , filename_dont_copy = uploaded_file )
380392
381393 # Provide download link
382394 st .info (f"Preparing download link for library output files ..." , icon = "ℹ️" )
0 commit comments