@@ -221,7 +221,7 @@ public override void Write(IRawDataPlus rawFile, int firstScanNumber, int lastSc
221221 _writer . WriteEndElement ( ) ; // software
222222 _writer . WriteEndElement ( ) ; // softwareList
223223
224- PopulateInstrumentConfigurationList ( firstScanNumber , instrumentModel ) ;
224+ PopulateInstrumentConfigurationList ( firstScanNumber , lastScanNumber , instrumentModel ) ;
225225
226226 // dataProcessingList
227227 _writer . WriteStartElement ( "dataProcessingList" ) ;
@@ -451,7 +451,7 @@ private int GetOsOffset()
451451 /// </summary>
452452 /// <param name="firstScanNumber"></param>
453453 /// <param name="instrumentModel"></param>
454- private void PopulateInstrumentConfigurationList ( int firstScanNumber , CVParamType instrumentModel )
454+ private void PopulateInstrumentConfigurationList ( int firstScanNumber , int lastScanNumber , CVParamType instrumentModel )
455455 {
456456 // go over the first scans until an MS2 scan is encountered
457457 // to collect all mass analyzer and ionization types
@@ -460,40 +460,52 @@ private void PopulateInstrumentConfigurationList(int firstScanNumber, CVParamTyp
460460 do
461461 {
462462 // Get the scan filter for this scan number
463- var scanFilter = _rawFile . GetFilterForScanNumber ( scanNumber ) ;
464463
465- // Add the ionization type if necessary
466464 try
467465 {
468- if ( ! _ionizationTypes . ContainsKey ( scanFilter . IonizationMode ) )
466+ var scanFilter = _rawFile . GetFilterForScanNumber ( scanNumber ) ;
467+
468+ // Add the ionization type if necessary
469+ try
470+ {
471+ if ( ! _ionizationTypes . ContainsKey ( scanFilter . IonizationMode ) )
472+ {
473+ _ionizationTypes . Add ( scanFilter . IonizationMode ,
474+ OntologyMapping . IonizationTypes [ scanFilter . IonizationMode ] ) ;
475+ }
476+ }
477+ catch ( Exception e )
478+ {
479+ Log . Warn ( "The IonizationMode does not contains the following property --" + e . Message ) ;
480+ if ( ! ParseInput . IgnoreInstrumentErrors )
481+ {
482+ throw e ;
483+ }
484+ }
485+
486+ // Add the mass analyzer if necessary
487+ if ( ! _massAnalyzers . ContainsKey ( scanFilter . MassAnalyzer ) &&
488+ OntologyMapping . MassAnalyzerTypes . ContainsKey ( scanFilter . MassAnalyzer ) )
469489 {
470- _ionizationTypes . Add ( scanFilter . IonizationMode ,
471- OntologyMapping . IonizationTypes [ scanFilter . IonizationMode ] ) ;
490+ _massAnalyzers . Add ( scanFilter . MassAnalyzer , "IC" + ( _massAnalyzers . Count + 1 ) ) ;
472491 }
492+
493+ if ( scanFilter . MSOrder == MSOrderType . Ms2 )
494+ {
495+ encounteredMs2 = true ;
496+ }
497+
473498 }
474499 catch ( Exception e )
475500 {
476- Log . Warn ( "The IonizationMode does not contains the following property --" + e . Message ) ;
501+ Log . Warn ( "No Scan Filter found for the following scan --" + scanNumber ) ;
477502 if ( ! ParseInput . IgnoreInstrumentErrors )
478503 {
479504 throw e ;
480505 }
481506 }
482-
483- // Add the mass analyzer if necessary
484- if ( ! _massAnalyzers . ContainsKey ( scanFilter . MassAnalyzer ) &&
485- OntologyMapping . MassAnalyzerTypes . ContainsKey ( scanFilter . MassAnalyzer ) )
486- {
487- _massAnalyzers . Add ( scanFilter . MassAnalyzer , "IC" + ( _massAnalyzers . Count + 1 ) ) ;
488- }
489-
490- if ( scanFilter . MSOrder == MSOrderType . Ms2 )
491- {
492- encounteredMs2 = true ;
493- }
494-
495507 scanNumber ++ ;
496- } while ( ! encounteredMs2 ) ;
508+ } while ( ! encounteredMs2 && scanNumber <= lastScanNumber ) ;
497509
498510 // Add a default analyzer if none were found
499511 if ( _massAnalyzers . Count == 0 )
0 commit comments