Skip to content

Commit 35709fe

Browse files
committed
Centroid/Profile in PROXI
Centroid/Profile detection in PROXI when profile spectrum requested
1 parent 6e84792 commit 35709fe

File tree

3 files changed

+22
-17
lines changed

3 files changed

+22
-17
lines changed

Query/ProxiSpectrumReader.cs

Lines changed: 16 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -72,8 +72,6 @@ public List<ProxiSpectrum> Retrieve()
7272
// Get the scan event for this scan number
7373
var scanEvent = rawFile.GetScanEventForScanNumber(scanNumber);
7474

75-
var isCentroid = true;
76-
7775
IReaction reaction = null;
7876
if (scanEvent.MSOrder != MSOrderType.Ms)
7977
{
@@ -161,7 +159,7 @@ public List<ProxiSpectrum> Retrieve()
161159
proxiSpectrum.AddAttribute(accession: "MS:10000512", name: "filter string",
162160
value: scanEvent.ToString());
163161

164-
if (!queryParameters.noPeakPicking)
162+
if (!queryParameters.noPeakPicking) //centroiding requested
165163
{
166164
proxiSpectrum.AddAttribute(accession: "MS:1000525", name: "spectrum representation",
167165
value: "centroid spectrum", valueAccession: "MS:1000127");
@@ -175,9 +173,8 @@ public List<ProxiSpectrum> Retrieve()
175173
proxiSpectrum.AddIntensities(scan.CentroidScan.Intensities);
176174
}
177175
}
178-
else // otherwise take the profile data
176+
else // otherwise take the low res segmented data
179177
{
180-
// Get the segmented (low res and profile) scan data
181178
// if the spectrum is profile perform centroiding
182179
var segmentedScan = scanEvent.ScanData == ScanDataType.Profile
183180
? Scan.ToCentroid(scan).SegmentedScan
@@ -187,11 +184,21 @@ public List<ProxiSpectrum> Retrieve()
187184
proxiSpectrum.AddIntensities(segmentedScan.Intensities);
188185
}
189186
}
190-
else // use the profile data as is
187+
else // use the segmented data as is
191188
{
192-
proxiSpectrum.AddAttribute(accession: "MS:1000525", name: "spectrum representation",
193-
value: "profile spectrum", valueAccession: "MS:1000128");
194-
189+
switch (scanEvent.ScanData) //check if the data is centroided already
190+
{
191+
case ScanDataType.Centroid:
192+
proxiSpectrum.AddAttribute(accession: "MS:1000525", name: "spectrum representation",
193+
value: "centroid spectrum", valueAccession: "MS:1000127");
194+
break;
195+
196+
case ScanDataType.Profile:
197+
proxiSpectrum.AddAttribute(accession: "MS:1000525", name: "spectrum representation",
198+
value: "profile spectrum", valueAccession: "MS:1000128");
199+
break;
200+
}
201+
195202
// Get the segmented (low res and profile) scan data
196203
proxiSpectrum.AddMz(scan.SegmentedScan.Positions);
197204
proxiSpectrum.AddIntensities(scan.SegmentedScan.Intensities);

Writer/MgfSpectrumWriter.cs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -141,9 +141,8 @@ public override void Write(IRawDataPlus rawFile, int firstScanNumber, int lastSc
141141
}
142142
}
143143
}
144-
else // otherwise take the profile data
144+
else // otherwise take segmented (low res) scan data
145145
{
146-
// Get the segmented (low res and profile) scan data
147146
// if the spectrum is profile perform centroiding
148147
var segmentedScan = scanEvent.ScanData == ScanDataType.Profile
149148
? Scan.ToCentroid(scan).SegmentedScan
@@ -160,7 +159,7 @@ public override void Write(IRawDataPlus rawFile, int firstScanNumber, int lastSc
160159
}
161160
}
162161
}
163-
else // use the profile data as is
162+
else // use the segmented data as is
164163
{
165164
// Get the segmented (low res and profile) scan data
166165
for (var i = 0; i < scan.SegmentedScan.Positions.Length; i++)

Writer/MzMlSpectrumWriter.cs

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -993,12 +993,11 @@ private SpectrumType ConstructSpectrum(int scanNumber)
993993
intensities = scan.CentroidScan.Intensities;
994994
}
995995
}
996-
else // otherwise take the profile data
996+
else // otherwise take the segmented (low res) scan
997997
{
998998
basePeakMass = scan.ScanStatistics.BasePeakMass;
999999
basePeakIntensity = scan.ScanStatistics.BasePeakIntensity;
10001000

1001-
// Get the segmented (low res and profile) scan data
10021001
// if the spectrum is profile perform centroiding
10031002
var segmentedScan = scanEvent.ScanData == ScanDataType.Profile
10041003
? Scan.ToCentroid(scan).SegmentedScan
@@ -1013,15 +1012,15 @@ private SpectrumType ConstructSpectrum(int scanNumber)
10131012
}
10141013
}
10151014
}
1016-
else // use the profile data as is
1015+
else // use the segmented data as is
10171016
{
10181017
basePeakMass = scan.ScanStatistics.BasePeakMass;
10191018
basePeakIntensity = scan.ScanStatistics.BasePeakIntensity;
10201019

1021-
// Get the segmented (low res and profile) scan data
1020+
// Get the segmented scan data
10221021
if (scan.SegmentedScan.Positions.Length > 0)
10231022
{
1024-
switch (scanEvent.ScanData)
1023+
switch (scanEvent.ScanData) //check if the data centroided already
10251024
{
10261025
case ScanDataType.Centroid:
10271026
spectrumCvParams.Add(new CVParamType

0 commit comments

Comments
 (0)