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)
int getChargeState () const
double getIntensity (bool *isok) const
double getMz () const

Public Attributes

CvParamMap cvParamMap

Detailed Description

Definition at line 69 of file precursor.h.

Member Function Documentation

◆ fromCbor()

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

Definition at line 134 of file precursor.cpp.

135{
136 QString txt_value;
137 reader.enterContainer();
138 qDebug() << txt_value;
139 while(reader.hasNext() && (!reader.isInvalid()))
140 {
141 if(reader.isString())
142 {
143 if(reader.decodeString(txt_value))
144 {
145 qDebug() << txt_value;
146 if(txt_value == "cvParam")
147 {
148 cvParamMap.fromCbor(reader);
149 // reader.next();
150 }
151 else
152 {
153 reader.next();
154 }
155 }
156 else
157 {
158 reader.next();
159 }
160 }
161 else
162 {
163 reader.next();
164 }
165 }
166 reader.leaveContainer();
167}

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

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

◆ getChargeState()

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

Definition at line 171 of file precursor.cpp.

172{
173
174 // <cvParam cvRef="MS" accession="MS:1000041" value="3" name="charge state" />
175
176 auto it = cvParamMap.find("MS:1000041");
177 if(it == cvParamMap.end())
178 {
179 throw pappso::ExceptionNotFound(
180 QObject::tr("Charge state not found in SelectedIon cvParam map"));
181 }
182 qDebug() << it->first << " " << it->second.valueInt;
183 return it->second.valueInt;
184}

References cvParamMap.

◆ getIntensity()

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

Definition at line 187 of file precursor.cpp.

188{
189
190 // <cvParam cvRef="MS" accession="MS:1000042" value="248032.25" name="peak intensity"
191 // unitAccession="MS:1000131" unitName="number of detector counts" unitCvRef="MS" />
192 // MS:1000042
193 auto it = cvParamMap.find("MS:1000042");
194 if(it == cvParamMap.end())
195 {
196 // throw pappso::ExceptionNotFound(
197 // QObject::tr("Intensity not found in SelectedIon cvParam map"));
198 *isok = false;
199 return 0;
200 }
201 qDebug() << it->first << " " << it->second.valueDouble;
202 double intensity = it->second.valueDouble;
203 *isok = true;
204 if(std::isnan(intensity))
205 {
206 return it->second.valueInt;
207 }
208 return intensity;
209}

References cvParamMap.

◆ getMz()

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

Definition at line 212 of file precursor.cpp.

213{
214
215 // <cvParam cvRef="MS" accession="MS:1000744" value="506.2513" name="selected ion m/z"
216 // unitAccession="MS:1000040" unitName="m/z" unitCvRef="MS" />
217
218 auto it = cvParamMap.find("MS:1000744");
219 if(it == cvParamMap.end())
220 {
221 throw pappso::ExceptionNotFound(QObject::tr("m/z not found in SelectedIon cvParam map"));
222 }
223 qDebug() << it->first << " " << it->second.valueDouble;
224 return it->second.valueDouble;
225}

References cvParamMap.

Member Data Documentation

◆ cvParamMap

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

Definition at line 77 of file precursor.h.

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


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