@@ -1142,40 +1142,12 @@ private SpectrumType ConstructMSSpectrum(int scanNumber)
11421142 } ;
11431143
11441144 // Trailer extra data list
1145- var trailerData = new ScanTrailer ( _rawFile . GetTrailerExtraInformation ( scanNumber ) ) ;
1145+ var trailerData = _rawFile . GetTrailerExtraInformation ( scanNumber ) ;
11461146 int ? charge = null ;
11471147 double ? monoisotopicMz = null ;
11481148 double ? ionInjectionTime = null ;
1149- double ? isolationWidth = null ;
11501149 double ? FAIMSCV = null ;
11511150 List < double > SPSMasses = new List < double > ( ) ;
1152-
1153- charge = trailerData . AsPositiveInt ( "Charge State:" ) ;
1154- monoisotopicMz = trailerData . AsDouble ( "Monoisotopic M/Z:" ) ;
1155- ionInjectionTime = trailerData . AsDouble ( "Ion Injection Time (ms):" ) ;
1156- if ( trailerData . AsBool ( "FAIMS Voltage On:" ) . GetValueOrDefault ( false ) )
1157- FAIMSCV = trailerData . AsDouble ( "FAIMS CV:" ) ;
1158-
1159- //tune version < 3 produced trailer entry like "SPS Mass #", one entry per mass
1160- foreach ( var label in trailerData . MatchKeys ( SPSentry ) )
1161- {
1162- var mass = trailerData . AsDouble ( label ) . GetValueOrDefault ( 0 ) ;
1163- if ( mass > 0 ) SPSMasses . Add ( ( double ) mass ) ; //zero means mass does not exist
1164- }
1165-
1166- //tune version == 3 produces trailer entry "SPS Masses", comma separated list of masses
1167- foreach ( var label in trailerData . MatchKeys ( SPSentry3 ) )
1168- {
1169- foreach ( var mass in trailerData . Get ( label ) . Trim ( ) . Split ( new char [ ] { ',' } , StringSplitOptions . RemoveEmptyEntries ) )
1170- {
1171- SPSMasses . Add ( double . Parse ( mass ) ) ;
1172- }
1173-
1174- }
1175-
1176- /*var trailerData = _rawFile.GetTrailerExtraInformation(scanNumber);
1177- double? isolationWidth = null;
1178- List<double> SPSMasses = new List<double>();
11791151 for ( var i = 0 ; i < trailerData . Length ; i ++ )
11801152 {
11811153 if ( trailerData . Labels [ i ] == "Charge State:" )
@@ -1186,11 +1158,6 @@ private SpectrumType ConstructMSSpectrum(int scanNumber)
11861158 }
11871159 }
11881160
1189- if (trailerData.Labels[i] == "MS" + (int)scanFilter.MSOrder + " Isolation Width:")
1190- {
1191- isolationWidth = double.Parse(trailerData.Values[i], NumberStyles.Any);
1192- }
1193-
11941161 if ( trailerData . Labels [ i ] == "Monoisotopic M/Z:" )
11951162 {
11961163 monoisotopicMz = double . Parse ( trailerData . Values [ i ] , NumberStyles . Any ,
@@ -1225,15 +1192,13 @@ private SpectrumType ConstructMSSpectrum(int scanNumber)
12251192 }
12261193
12271194 }
1228- }*/
1195+ }
12291196
12301197 // Construct and set the scan list element of the spectrum
12311198 var scanListType = ConstructScanList ( scanNumber , scan , scanFilter , scanEvent , monoisotopicMz ,
12321199 ionInjectionTime ) ;
12331200 spectrum . scanList = scanListType ;
12341201
1235- int ? trailerMasterScan ;
1236-
12371202 switch ( scanFilter . MSOrder )
12381203 {
12391204 case MSOrderType . Ms :
@@ -1246,8 +1211,7 @@ private SpectrumType ConstructMSSpectrum(int scanNumber)
12461211 } ) ;
12471212
12481213 // Keep track of scan number for precursor reference
1249- trailerMasterScan = trailerData . AsInt ( "Master Scan Number:" ) ;
1250- _precursorMs1ScanNumber = trailerMasterScan . HasValue ? trailerMasterScan . Value : scanNumber ;
1214+ _precursorMs1ScanNumber = scanNumber ;
12511215
12521216 break ;
12531217 case MSOrderType . Ms2 :
@@ -1268,14 +1232,12 @@ private SpectrumType ConstructMSSpectrum(int scanNumber)
12681232 _precursorMs2ScanNumbers . Remove ( result . Groups [ 1 ] . Value ) ;
12691233 }
12701234
1271- trailerMasterScan = trailerData . AsInt ( "Master Scan Number:" ) ;
1272- _precursorMs2ScanNumbers . Add ( result . Groups [ 1 ] . Value ,
1273- trailerMasterScan . HasValue ? trailerMasterScan . Value : scanNumber ) ;
1235+ _precursorMs2ScanNumbers . Add ( result . Groups [ 1 ] . Value , scanNumber ) ;
12741236 }
12751237
12761238 // Construct and set the precursor list element of the spectrum
12771239 var precursorListType =
1278- ConstructPrecursorList ( scanEvent , charge , scanFilter . MSOrder , monoisotopicMz , isolationWidth , SPSMasses ) ;
1240+ ConstructPrecursorList ( scanEvent , charge , scanFilter . MSOrder , monoisotopicMz , SPSMasses ) ;
12791241 spectrum . precursorList = precursorListType ;
12801242 break ;
12811243 case MSOrderType . Ms3 :
@@ -1286,7 +1248,7 @@ private SpectrumType ConstructMSSpectrum(int scanNumber)
12861248 name = "MSn spectrum" ,
12871249 value = ""
12881250 } ) ;
1289- precursorListType = ConstructPrecursorList ( scanEvent , charge , scanFilter . MSOrder , monoisotopicMz , isolationWidth , SPSMasses ) ;
1251+ precursorListType = ConstructPrecursorList ( scanEvent , charge , scanFilter . MSOrder , monoisotopicMz , SPSMasses ) ;
12901252 spectrum . precursorList = precursorListType ;
12911253 break ;
12921254 default :
@@ -1829,10 +1791,9 @@ private SpectrumType ConstructPDASpectrum(int scanNumber, int instrumentNumber)
18291791 /// <param name="msLevel">the MS level</param>
18301792 /// <param name="monoisotopicMz">the monoisotopic m/z value</param>
18311793 /// <param name="isolationWidth">the isolation width</param>
1832- /// <param name="SPSMasses">masses selected for SPS</param>
18331794 /// <returns>the precursor list</returns>
18341795 private PrecursorListType ConstructPrecursorList ( IScanEventBase scanEvent , int ? charge , MSOrderType msLevel ,
1835- double ? monoisotopicMz , double ? isolationWidth , List < double > SPSMasses )
1796+ double ? monoisotopicMz , List < double > SPSMasses )
18361797 {
18371798 // Construct the precursor
18381799 var precursorList = new PrecursorListType
@@ -1845,7 +1806,7 @@ private PrecursorListType ConstructPrecursorList(IScanEventBase scanEvent, int?
18451806 int precursorScanNumber = _precursorMs1ScanNumber ;
18461807 IReaction reaction = null ;
18471808 var precursorMz = 0.0 ;
1848-
1809+ double ? isolationWidth = null ;
18491810 try
18501811 {
18511812 switch ( msLevel )
@@ -1875,6 +1836,7 @@ private PrecursorListType ConstructPrecursorList(IScanEventBase scanEvent, int?
18751836 }
18761837
18771838 precursorMz = reaction . PrecursorMass ;
1839+ isolationWidth = reaction . IsolationWidth ;
18781840 }
18791841 catch ( ArgumentOutOfRangeException )
18801842 {
@@ -1918,24 +1880,23 @@ private PrecursorListType ConstructPrecursorList(IScanEventBase scanEvent, int?
19181880 }
19191881
19201882 //Precursor intensity is disabled for now
1921- if ( selectedIonMz > ZeroDelta )
1922- {
1923- var selectedIonIntensity = CalculatePrecursorPeakIntensity ( _rawFile , precursorScanNumber , selectedIonMz , isolationWidth , ParseInput . NoPeakPicking ) ; //new Pwiz way
1924- //var selectedIonIntensity = CalculatePrecursorPeakIntensity2(_rawFile, precursorScanNumber, selectedIonMz, isolationWidth); //old Pwiz way
1925- if ( selectedIonIntensity != null )
1926- {
1927- ionCvParams . Add ( new CVParamType
1928- {
1929- name = "peak intensity" ,
1930- value = selectedIonIntensity . ToString ( ) ,
1931- accession = "MS:1000042" ,
1932- cvRef = "MS" ,
1933- unitAccession = "MS:1000131" ,
1934- unitCvRef = "MS" ,
1935- unitName = "number of detector counts"
1936- } ) ;
1937- }
1938- }
1883+ //if (selectedIonMz > ZeroDelta)
1884+ //{
1885+ // var selectedIonIntensity = CalculatePrecursorPeakIntensity(_rawFile, precursorScanNumber, selectedIonMz);
1886+ // if (selectedIonIntensity != null)
1887+ // {
1888+ // ionCvParams.Add(new CVParamType
1889+ // {
1890+ // name = "peak intensity",
1891+ // value = selectedIonIntensity.ToString(),
1892+ // accession = "MS:1000042",
1893+ // cvRef = "MS",
1894+ // unitAccession = "MS:1000131",
1895+ // unitCvRef = "MS",
1896+ // unitName = "number of detector counts"
1897+ // });
1898+ // }
1899+ //}
19391900
19401901 precursor . selectedIonList . selectedIon [ 0 ] . cvParam = ionCvParams . ToArray ( ) ;
19411902
0 commit comments