libpappsomspp
Library for mass spectrometry
Loading...
Searching...
No Matches
pappso::cbor::mzcbor::SelectedIon Struct Reference

#include <precursor.h>

Public Member Functions

void fromCbor (CborStreamReader &reader)
void fromQCborMap (const QCborMap &reader)
int getChargeState () const
double getIntensity (bool *isok) const
double getMz () const

Public Attributes

CvParamMap cvParamMap

Detailed Description

Definition at line 71 of file precursor.h.

Member Function Documentation

◆ fromCbor()

void pappso::cbor::mzcbor::SelectedIon::fromCbor ( CborStreamReader & reader)

Definition at line 177 of file precursor.cpp.

178{
179 QString txt_value;
180 reader.enterContainer();
181 qDebug() << txt_value;
182 while(reader.hasNext() && (!reader.isInvalid()))
183 {
184 if(reader.isString())
185 {
186 if(reader.decodeString(txt_value))
187 {
188 qDebug() << txt_value;
189 if(txt_value == "cvParam")
190 {
191 cvParamMap.fromCbor(reader);
192 // reader.next();
193 }
194 else
195 {
196 reader.next();
197 }
198 }
199 else
200 {
201 reader.next();
202 }
203 }
204 else
205 {
206 reader.next();
207 }
208 }
209 reader.leaveContainer();
210}

References cvParamMap, and pappso::cbor::CborStreamReader::decodeString().

Referenced by pappso::cbor::mzcbor::Precursor::fromCbor().

◆ fromQCborMap()

void pappso::cbor::mzcbor::SelectedIon::fromQCborMap ( const QCborMap & reader)

Definition at line 162 of file precursor.cpp.

163{
164 QString txt_value;
165 for(auto it_binarr = cbor_map.cbegin(); it_binarr != cbor_map.cend(); it_binarr++)
166 {
167 txt_value = it_binarr.key().toString();
168 qDebug() << txt_value;
169 if(txt_value == "cvParam")
170 {
171 cvParamMap.fromQCborArray(it_binarr.value().toArray());
172 // reader.next();
173 }
174 }
175}

References cvParamMap.

Referenced by pappso::cbor::mzcbor::QcborSpectrumPrecursor::getSelectedIonList().

◆ getChargeState()

int pappso::cbor::mzcbor::SelectedIon::getChargeState ( ) const

Definition at line 214 of file precursor.cpp.

215{
216
217 // <cvParam cvRef="MS" accession="MS:1000041" value="3" name="charge state" />
218
219 auto it = cvParamMap.find("MS:1000041");
220 if(it == cvParamMap.end())
221 {
222 throw pappso::ExceptionNotFound(
223 QObject::tr("Charge state not found in SelectedIon cvParam map"));
224 }
225 qDebug() << it->first << " " << it->second.valueInt;
226 return it->second.valueInt;
227}

References cvParamMap.

◆ getIntensity()

double pappso::cbor::mzcbor::SelectedIon::getIntensity ( bool * isok) const

Definition at line 230 of file precursor.cpp.

231{
232
233 // <cvParam cvRef="MS" accession="MS:1000042" value="248032.25" name="peak intensity"
234 // unitAccession="MS:1000131" unitName="number of detector counts" unitCvRef="MS" />
235 // MS:1000042
236 auto it = cvParamMap.find("MS:1000042");
237 if(it == cvParamMap.end())
238 {
239 // throw pappso::ExceptionNotFound(
240 // QObject::tr("Intensity not found in SelectedIon cvParam map"));
241 *isok = false;
242 return 0;
243 }
244 qDebug() << it->first << " " << it->second.valueDouble;
245 double intensity = it->second.valueDouble;
246 *isok = true;
247 if(std::isnan(intensity))
248 {
249 return it->second.valueInt;
250 }
251 return intensity;
252}

References cvParamMap.

◆ getMz()

double pappso::cbor::mzcbor::SelectedIon::getMz ( ) const

Definition at line 255 of file precursor.cpp.

256{
257
258 // <cvParam cvRef="MS" accession="MS:1000744" value="506.2513" name="selected ion m/z"
259 // unitAccession="MS:1000040" unitName="m/z" unitCvRef="MS" />
260
261 auto it = cvParamMap.find("MS:1000744");
262 if(it == cvParamMap.end())
263 {
264 throw pappso::ExceptionNotFound(QObject::tr("m/z not found in SelectedIon cvParam map"));
265 }
266 qDebug() << it->first << " " << it->second.valueDouble;
267 return it->second.valueDouble;
268}

References cvParamMap.

Member Data Documentation

◆ cvParamMap

CvParamMap pappso::cbor::mzcbor::SelectedIon::cvParamMap

Definition at line 80 of file precursor.h.

Referenced by fromCbor(), fromQCborMap(), getChargeState(), getIntensity(), and getMz().


The documentation for this struct was generated from the following files: