@@ -9,7 +9,6 @@ use sage_core::mass::Tolerance;
9
9
use sage_core:: scoring:: { Feature , Scorer } ;
10
10
use sage_core:: spectrum:: { ProcessedSpectrum , SpectrumProcessor } ;
11
11
use sage_core:: tmt:: TmtQuant ;
12
- use std:: path:: PathBuf ;
13
12
use std:: time:: Instant ;
14
13
15
14
mod input;
@@ -192,34 +191,25 @@ impl Runner {
192
191
self . parameters . deisotope ,
193
192
) ;
194
193
195
- let bruker_extensions = [ "d" , "tdf" , "tdf_bin" ] ;
194
+ let bruker_extensions = [ ". d" , ". tdf" , ". tdf_bin" ] ;
196
195
let spectra = chunk
197
196
. par_iter ( )
198
197
. enumerate ( )
199
198
. flat_map ( |( idx, path) | {
200
- let res = match path {
201
- path if bruker_extensions. contains (
202
- & PathBuf :: from ( path)
203
- . extension ( )
204
- . unwrap_or_default ( )
205
- . to_str ( )
206
- . unwrap_or_default ( ) ,
207
- ) =>
208
- {
209
- sage_cloudpath:: util:: read_tdf ( path, chunk_idx * batch_size + idx)
210
- }
211
- path if PathBuf :: from ( path)
212
- . extension ( )
213
- . unwrap_or_default ( )
214
- . to_str ( )
215
- . unwrap_or_default ( )
216
- . to_lowercase ( )
217
- == "mgf" =>
218
- {
219
- sage_cloudpath:: util:: read_mgf ( path, chunk_idx * batch_size + idx)
220
- }
221
- _ => sage_cloudpath:: util:: read_mzml ( path, chunk_idx * batch_size + idx, sn) ,
199
+ let file_id = chunk_idx * batch_size + idx;
200
+
201
+ let path_lower = path. to_lowercase ( ) ;
202
+ let res = if path_lower. ends_with ( ".mgf.gz" ) || path_lower. ends_with ( ".mgf" ) {
203
+ sage_cloudpath:: util:: read_mgf ( path_lower, file_id)
204
+ } else if bruker_extensions
205
+ . iter ( )
206
+ . any ( |ext| path_lower. ends_with ( ext) )
207
+ {
208
+ sage_cloudpath:: util:: read_tdf ( path, file_id)
209
+ } else {
210
+ sage_cloudpath:: util:: read_mzml ( path, file_id, sn)
222
211
} ;
212
+
223
213
match res {
224
214
Ok ( s) => {
225
215
log:: trace!( "- {}: read {} spectra" , path, s. len( ) ) ;
0 commit comments