Skip to content

Commit ae7b0b0

Browse files
committed
isolationWindow fix
1 parent 57f8b50 commit ae7b0b0

File tree

1 file changed

+16
-5
lines changed

1 file changed

+16
-5
lines changed

Writer/MzMlSpectrumWriter.cs

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1148,6 +1148,8 @@ private SpectrumType ConstructMSSpectrum(int scanNumber)
11481148
double? ionInjectionTime = null;
11491149
double? FAIMSCV = null;
11501150
List<double> SPSMasses = new List<double>();
1151+
double? isolationWidth = null;
1152+
11511153
for (var i = 0; i < trailerData.Length; i++)
11521154
{
11531155
if (trailerData.Labels[i] == "Charge State:")
@@ -1170,6 +1172,12 @@ private SpectrumType ConstructMSSpectrum(int scanNumber)
11701172
CultureInfo.CurrentCulture);
11711173
}
11721174

1175+
if (trailerData.Labels[i] == "MS" + (int) scanFilter.MSOrder + " Isolation Width:")
1176+
{
1177+
isolationWidth = double.Parse(trailerData.Values[i], NumberStyles.Any,
1178+
CultureInfo.CurrentCulture);
1179+
}
1180+
11731181
if (trailerData.Labels[i] == "FAIMS CV:")
11741182
{
11751183
FAIMSCV = double.Parse(trailerData.Values[i], NumberStyles.Any,
@@ -1237,7 +1245,7 @@ private SpectrumType ConstructMSSpectrum(int scanNumber)
12371245

12381246
// Construct and set the precursor list element of the spectrum
12391247
var precursorListType =
1240-
ConstructPrecursorList(scanEvent, charge, scanFilter.MSOrder, monoisotopicMz, SPSMasses);
1248+
ConstructPrecursorList(scanEvent, charge, scanFilter.MSOrder, monoisotopicMz, isolationWidth, SPSMasses);
12411249
spectrum.precursorList = precursorListType;
12421250
break;
12431251
case MSOrderType.Ms3:
@@ -1248,7 +1256,7 @@ private SpectrumType ConstructMSSpectrum(int scanNumber)
12481256
name = "MSn spectrum",
12491257
value = ""
12501258
});
1251-
precursorListType = ConstructPrecursorList(scanEvent, charge, scanFilter.MSOrder, monoisotopicMz, SPSMasses);
1259+
precursorListType = ConstructPrecursorList(scanEvent, charge, scanFilter.MSOrder, monoisotopicMz, isolationWidth, SPSMasses);
12521260
spectrum.precursorList = precursorListType;
12531261
break;
12541262
default:
@@ -1791,9 +1799,10 @@ private SpectrumType ConstructPDASpectrum(int scanNumber, int instrumentNumber)
17911799
/// <param name="msLevel">the MS level</param>
17921800
/// <param name="monoisotopicMz">the monoisotopic m/z value</param>
17931801
/// <param name="isolationWidth">the isolation width</param>
1802+
/// <param name="SPSMasses">List of masses selected for SPS</param>
17941803
/// <returns>the precursor list</returns>
17951804
private PrecursorListType ConstructPrecursorList(IScanEventBase scanEvent, int? charge, MSOrderType msLevel,
1796-
double? monoisotopicMz, List<double> SPSMasses)
1805+
double? monoisotopicMz, double? isolationWidth, List<double> SPSMasses)
17971806
{
17981807
// Construct the precursor
17991808
var precursorList = new PrecursorListType
@@ -1806,7 +1815,6 @@ private PrecursorListType ConstructPrecursorList(IScanEventBase scanEvent, int?
18061815
int precursorScanNumber = _precursorMs1ScanNumber;
18071816
IReaction reaction = null;
18081817
var precursorMz = 0.0;
1809-
double? isolationWidth = null;
18101818
try
18111819
{
18121820
switch (msLevel)
@@ -1836,7 +1844,10 @@ private PrecursorListType ConstructPrecursorList(IScanEventBase scanEvent, int?
18361844
}
18371845

18381846
precursorMz = reaction.PrecursorMass;
1839-
isolationWidth = reaction.IsolationWidth;
1847+
1848+
//if isolation width was not found in the trailer, try to get one from the reaction
1849+
if (isolationWidth == null) isolationWidth = reaction.IsolationWidth;
1850+
18401851
}
18411852
catch (ArgumentOutOfRangeException)
18421853
{

0 commit comments

Comments
 (0)