@@ -159,16 +159,16 @@ public List<ProxiSpectrum> Retrieve()
159159 proxiSpectrum . AddAttribute ( accession : "MS:10000512" , name : "filter string" ,
160160 value : scanEvent . ToString ( ) ) ;
161161
162- if ( ! queryParameters . noPeakPicking ) //centroiding requested
162+ if ( ! queryParameters . noPeakPicking ) // centroiding requested
163163 {
164- proxiSpectrum . AddAttribute ( accession : "MS:1000525" , name : "spectrum representation" ,
165- value : "centroid spectrum" , valueAccession : "MS:1000127" ) ;
166-
167- // Check if the scan has a centroid stream
164+ // check if the scan has a centroid stream
168165 if ( scan . HasCentroidStream )
169166 {
170167 if ( scan . CentroidScan . Length > 0 )
171168 {
169+ proxiSpectrum . AddAttribute ( accession : "MS:1000525" , name : "spectrum representation" ,
170+ value : "centroid spectrum" , valueAccession : "MS:1000127" ) ;
171+
172172 proxiSpectrum . AddMz ( scan . CentroidScan . Masses ) ;
173173 proxiSpectrum . AddIntensities ( scan . CentroidScan . Intensities ) ;
174174 }
@@ -180,28 +180,38 @@ public List<ProxiSpectrum> Retrieve()
180180 ? Scan . ToCentroid ( scan ) . SegmentedScan
181181 : scan . SegmentedScan ;
182182
183- proxiSpectrum . AddMz ( segmentedScan . Positions ) ;
184- proxiSpectrum . AddIntensities ( segmentedScan . Intensities ) ;
183+ if ( segmentedScan . PositionCount > 0 )
184+ {
185+ proxiSpectrum . AddAttribute ( accession : "MS:1000525" , name : "spectrum representation" ,
186+ value : "centroid spectrum" , valueAccession : "MS:1000127" ) ;
187+
188+ proxiSpectrum . AddMz ( segmentedScan . Positions ) ;
189+ proxiSpectrum . AddIntensities ( segmentedScan . Intensities ) ;
190+ }
185191 }
186192 }
187193 else // use the segmented data as is
188194 {
189- switch ( scanEvent . ScanData ) //check if the data is centroided already
195+ if ( scan . SegmentedScan . Positions . Length > 0 )
190196 {
191- case ScanDataType . Centroid :
192- proxiSpectrum . AddAttribute ( accession : "MS:1000525" , name : "spectrum representation" ,
193- value : "centroid spectrum" , valueAccession : "MS:1000127" ) ;
194- break ;
197+ switch ( scanEvent . ScanData ) //check if the data is centroided already
198+ {
199+ case ScanDataType . Centroid :
200+ proxiSpectrum . AddAttribute ( accession : "MS:1000525" ,
201+ name : "spectrum representation" ,
202+ value : "centroid spectrum" , valueAccession : "MS:1000127" ) ;
203+ break ;
204+
205+ case ScanDataType . Profile :
206+ proxiSpectrum . AddAttribute ( accession : "MS:1000525" ,
207+ name : "spectrum representation" ,
208+ value : "profile spectrum" , valueAccession : "MS:1000128" ) ;
209+ break ;
210+ }
195211
196- case ScanDataType . Profile :
197- proxiSpectrum . AddAttribute ( accession : "MS:1000525" , name : "spectrum representation" ,
198- value : "profile spectrum" , valueAccession : "MS:1000128" ) ;
199- break ;
212+ proxiSpectrum . AddMz ( scan . SegmentedScan . Positions ) ;
213+ proxiSpectrum . AddIntensities ( scan . SegmentedScan . Intensities ) ;
200214 }
201-
202- // Get the segmented (low res and profile) scan data
203- proxiSpectrum . AddMz ( scan . SegmentedScan . Positions ) ;
204- proxiSpectrum . AddIntensities ( scan . SegmentedScan . Intensities ) ;
205215 }
206216
207217 resultList . Add ( proxiSpectrum ) ;
0 commit comments