37 reader.enterContainer();
38 qDebug() << txt_value;
39 while(reader.hasNext() && (!reader.isInvalid()))
45 qDebug() << txt_value;
46 if(txt_value ==
"cvParam")
66 reader.leaveContainer();
72 auto it = cvParamMap.find(
"MS:1000827");
74 if(it == cvParamMap.end())
77 QObject::tr(
"isolation window target m/z MS:1000827 not found in cvParam map"));
80 return it->second.valueDouble;
86 double mz = getTargetMz();
88 auto it = cvParamMap.find(
"MS:1000828");
90 if(it == cvParamMap.end())
93 QObject::tr(
"isolation window lower offset MS:1000828 not found in cvParam map"));
96 return mz - it->second.valueDouble;
102 QJsonObject isolationWindow;
103 isolationWindow.insert(
"cvParam", cvParamMap.toJsonArray());
104 return isolationWindow;
109 QJsonObject precursor;
110 if(!spectrumRef.isEmpty())
111 precursor.insert(
"spectrumRef", spectrumRef);
112 precursor.insert(
"isolationWindow", isolationWindow.toJsonObject());
120 double mz = getTargetMz();
122 auto it = cvParamMap.find(
"MS:1000829");
124 if(it == cvParamMap.end())
127 QObject::tr(
"isolation window upper offset MS:1000829 not found in cvParam map"));
130 return mz + it->second.valueDouble;
137 reader.enterContainer();
138 qDebug() << txt_value;
139 while(reader.hasNext() && (!reader.isInvalid()))
141 if(reader.isString())
145 qDebug() << txt_value;
146 if(txt_value ==
"cvParam")
148 cvParamMap.fromCbor(reader);
166 reader.leaveContainer();
176 auto it = cvParamMap.find(
"MS:1000041");
177 if(it == cvParamMap.end())
180 QObject::tr(
"Charge state not found in SelectedIon cvParam map"));
182 qDebug() << it->first <<
" " << it->second.valueInt;
183 return it->second.valueInt;
193 auto it = cvParamMap.find(
"MS:1000042");
194 if(it == cvParamMap.end())
201 qDebug() << it->first <<
" " << it->second.valueDouble;
202 double intensity = it->second.valueDouble;
204 if(std::isnan(intensity))
206 return it->second.valueInt;
218 auto it = cvParamMap.find(
"MS:1000744");
219 if(it == cvParamMap.end())
223 qDebug() << it->first <<
" " << it->second.valueDouble;
224 return it->second.valueDouble;
233 reader.enterContainer();
234 qDebug() << txt_value;
235 while(reader.hasNext() && (!reader.isInvalid()))
237 if(reader.isString())
241 qDebug() << txt_value;
242 if(txt_value ==
"cvParam")
247 else if(txt_value ==
"isolationWindow")
249 isolationWindow.fromCbor(reader);
251 else if(txt_value ==
"selectedIonList")
254 reader.enterContainer();
256 while(reader.hasNext() && (!reader.isInvalid()))
258 if(reader.isString())
262 qDebug() << txt_value;
263 if(txt_value ==
"cvParam")
265 selectedIonListCvParamMap.fromCbor(reader);
267 else if(txt_value ==
"selectedIon")
270 reader.enterContainer();
272 while(reader.hasNext() && (!reader.isInvalid()))
276 selectedIonList.emplace_back(selected_ion);
278 reader.leaveContainer();
295 reader.leaveContainer();
297 else if(txt_value ==
"activation")
303 else if(txt_value ==
"spectrumRef")
306 qDebug() << txt_value;
307 spectrumRef = txt_value;
324 reader.leaveContainer();
simple override of the raw QCborStreamReader This adds convenient functions to put CBOR data into C++...
bool decodeString(QString &the_str)
decode the current cbor value as a string the point to the next value the current value is decoded as...
PSI precursor object for mzML/mzCBOR.
void fromCbor(CborStreamReader &reader)
fill the structure reading data from a CBOR stream
double getUpperMz() const
compute isolation window upper m/z given cvParam informations
double getLowerMz() const
compute isolation window lower m/z given cvParam informations
double getTargetMz() const
get isolation window target m/z given cvParam informations
QJsonObject toJsonObject() const
write the structure to a JSON object
void fromCbor(CborStreamReader &reader)
QJsonObject toJsonObject() const
write the structure to a JSON object
void fromCbor(CborStreamReader &reader)
int getChargeState() const
void fromCbor(CborStreamReader &reader)
double getIntensity(bool *isok) const