@@ -1146,6 +1146,7 @@ private SpectrumType ConstructMSSpectrum(int scanNumber)
11461146 int ? charge = null ;
11471147 double ? monoisotopicMz = null ;
11481148 double ? ionInjectionTime = null ;
1149+ double ? isolationWidth = null ;
11491150 double ? FAIMSCV = null ;
11501151 List < double > SPSMasses = new List < double > ( ) ;
11511152
@@ -1173,6 +1174,8 @@ private SpectrumType ConstructMSSpectrum(int scanNumber)
11731174 }
11741175
11751176 /*var trailerData = _rawFile.GetTrailerExtraInformation(scanNumber);
1177+ double? isolationWidth = null;
1178+ List<double> SPSMasses = new List<double>();
11761179 for (var i = 0; i < trailerData.Length; i++)
11771180 {
11781181 if (trailerData.Labels[i] == "Charge State:")
@@ -1183,6 +1186,11 @@ private SpectrumType ConstructMSSpectrum(int scanNumber)
11831186 }
11841187 }
11851188
1189+ if (trailerData.Labels[i] == "MS" + (int)scanFilter.MSOrder + " Isolation Width:")
1190+ {
1191+ isolationWidth = double.Parse(trailerData.Values[i], NumberStyles.Any);
1192+ }
1193+
11861194 if (trailerData.Labels[i] == "Monoisotopic M/Z:")
11871195 {
11881196 monoisotopicMz = double.Parse(trailerData.Values[i], NumberStyles.Any,
@@ -1267,7 +1275,7 @@ private SpectrumType ConstructMSSpectrum(int scanNumber)
12671275
12681276 // Construct and set the precursor list element of the spectrum
12691277 var precursorListType =
1270- ConstructPrecursorList ( scanEvent , charge , scanFilter . MSOrder , monoisotopicMz , SPSMasses ) ;
1278+ ConstructPrecursorList ( scanEvent , charge , scanFilter . MSOrder , monoisotopicMz , isolationWidth , SPSMasses ) ;
12711279 spectrum . precursorList = precursorListType ;
12721280 break ;
12731281 case MSOrderType . Ms3 :
@@ -1278,7 +1286,7 @@ private SpectrumType ConstructMSSpectrum(int scanNumber)
12781286 name = "MSn spectrum" ,
12791287 value = ""
12801288 } ) ;
1281- precursorListType = ConstructPrecursorList ( scanEvent , charge , scanFilter . MSOrder , monoisotopicMz , SPSMasses ) ;
1289+ precursorListType = ConstructPrecursorList ( scanEvent , charge , scanFilter . MSOrder , monoisotopicMz , isolationWidth , SPSMasses ) ;
12821290 spectrum . precursorList = precursorListType ;
12831291 break ;
12841292 default :
@@ -1821,9 +1829,10 @@ private SpectrumType ConstructPDASpectrum(int scanNumber, int instrumentNumber)
18211829 /// <param name="msLevel">the MS level</param>
18221830 /// <param name="monoisotopicMz">the monoisotopic m/z value</param>
18231831 /// <param name="isolationWidth">the isolation width</param>
1832+ /// <param name="SPSMasses">masses selected for SPS</param>
18241833 /// <returns>the precursor list</returns>
18251834 private PrecursorListType ConstructPrecursorList ( IScanEventBase scanEvent , int ? charge , MSOrderType msLevel ,
1826- double ? monoisotopicMz , List < double > SPSMasses )
1835+ double ? monoisotopicMz , double ? isolationWidth , List < double > SPSMasses )
18271836 {
18281837 // Construct the precursor
18291838 var precursorList = new PrecursorListType
@@ -1836,7 +1845,7 @@ private PrecursorListType ConstructPrecursorList(IScanEventBase scanEvent, int?
18361845 int precursorScanNumber = _precursorMs1ScanNumber ;
18371846 IReaction reaction = null ;
18381847 var precursorMz = 0.0 ;
1839- double ? isolationWidth = null ;
1848+
18401849 try
18411850 {
18421851 switch ( msLevel )
@@ -1866,7 +1875,6 @@ private PrecursorListType ConstructPrecursorList(IScanEventBase scanEvent, int?
18661875 }
18671876
18681877 precursorMz = reaction . PrecursorMass ;
1869- isolationWidth = reaction . IsolationWidth ;
18701878 }
18711879 catch ( ArgumentOutOfRangeException )
18721880 {
@@ -1910,23 +1918,24 @@ private PrecursorListType ConstructPrecursorList(IScanEventBase scanEvent, int?
19101918 }
19111919
19121920 //Precursor intensity is disabled for now
1913- //if (selectedIonMz > ZeroDelta)
1914- //{
1915- // var selectedIonIntensity = CalculatePrecursorPeakIntensity(_rawFile, precursorScanNumber, selectedIonMz);
1916- // if (selectedIonIntensity != null)
1917- // {
1918- // ionCvParams.Add(new CVParamType
1919- // {
1920- // name = "peak intensity",
1921- // value = selectedIonIntensity.ToString(),
1922- // accession = "MS:1000042",
1923- // cvRef = "MS",
1924- // unitAccession = "MS:1000131",
1925- // unitCvRef = "MS",
1926- // unitName = "number of detector counts"
1927- // });
1928- // }
1929- //}
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+ }
19301939
19311940 precursor . selectedIonList . selectedIon [ 0 ] . cvParam = ionCvParams . ToArray ( ) ;
19321941
0 commit comments