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
qint64 getIntensity () 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()

qint64 pappso::cbor::mzcbor::SelectedIon::getIntensity ( ) 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
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 }
199 qDebug() << it->first << " " << it->second.valueInt;
200 return it->second.valueInt;
201}

References cvParamMap.

◆ getMz()

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

Definition at line 204 of file precursor.cpp.

205{
206
207 // <cvParam cvRef="MS" accession="MS:1000744" value="506.2513" name="selected ion m/z"
208 // unitAccession="MS:1000040" unitName="m/z" unitCvRef="MS" />
209
210 auto it = cvParamMap.find("MS:1000744");
211 if(it == cvParamMap.end())
212 {
213 throw pappso::ExceptionNotFound(QObject::tr("m/z not found in SelectedIon cvParam map"));
214 }
215 qDebug() << it->first << " " << it->second.valueDouble;
216 return it->second.valueDouble;
217}

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: