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

#include <precursor.h>

Public Member Functions

void fromCbor (CborStreamReader &reader)
 
void fromQCborMap (const QCborMap &reader)
 
QJsonObject toJsonObject () const
 write the structure to a JSON object
 
double getTargetMz () const
 get isolation window target m/z given cvParam informations
 
double getLowerMz () const
 compute isolation window lower m/z given cvParam informations
 
double getUpperMz () const
 compute isolation window upper m/z given cvParam informations
 

Public Attributes

CvParamMap cvParamMap
 

Detailed Description

Definition at line 42 of file precursor.h.

Member Function Documentation

◆ fromCbor()

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

Definition at line 50 of file precursor.cpp.

51{
52 QString txt_value;
53 reader.enterContainer();
54 qDebug() << txt_value;
55 while(reader.hasNext() && (!reader.isInvalid()))
56 {
57 if(reader.isString())
58 {
59 if(reader.decodeString(txt_value))
60 {
61 qDebug() << txt_value;
62 if(txt_value == "cvParam")
63 {
64 cvParamMap.fromCbor(reader);
65 // reader.next();
66 }
67 else
68 {
69 reader.next();
70 }
71 }
72 else
73 {
74 reader.next();
75 }
76 }
77 else
78 {
79 reader.next();
80 }
81 }
82 reader.leaveContainer();
83}
void fromCbor(CborStreamReader &reader)
fill the structure reading data from a CBOR stream

References pappso::cbor::CborStreamReader::decodeString().

◆ fromQCborMap()

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

Definition at line 35 of file precursor.cpp.

36{
37 QString txt_value;
38 for(auto it_binarr = cbor_map.cbegin(); it_binarr != cbor_map.cend(); it_binarr++)
39 {
40 txt_value = it_binarr.key().toString();
41 qDebug() << txt_value;
42 if(txt_value == "cvParam")
43 {
44 cvParamMap.fromQCborArray(it_binarr.value().toArray());
45 // reader.next();
46 }
47 }
48}
void fromQCborArray(const QCborArray &reader)

References cvParamMap, and pappso::cbor::mzcbor::CvParamMap::fromQCborArray().

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

◆ getLowerMz()

double pappso::cbor::mzcbor::IsolationWindow::getLowerMz ( ) const

compute isolation window lower m/z given cvParam informations

Definition at line 104 of file precursor.cpp.

105{
106 double mz = getTargetMz();
107
108 auto it = cvParamMap.find("MS:1000828");
109
110 if(it == cvParamMap.end())
111 {
113 QObject::tr("isolation window lower offset MS:1000828 not found in cvParam map"));
114 }
115
116 if(std::isnan(it->second.valueDouble))
117 {
118 return mz - (double)it->second.valueInt;
119 }
120 return mz - it->second.valueDouble;
121}
double getTargetMz() const
get isolation window target m/z given cvParam informations
Definition precursor.cpp:86

Referenced by FilterMs1WindowSelection::FilterMs1WindowSelection().

◆ getTargetMz()

double pappso::cbor::mzcbor::IsolationWindow::getTargetMz ( ) const

get isolation window target m/z given cvParam informations

Definition at line 86 of file precursor.cpp.

87{
88 auto it = cvParamMap.find("MS:1000827");
89
90 if(it == cvParamMap.end())
91 {
93 QObject::tr("isolation window target m/z MS:1000827 not found in cvParam map"));
94 }
95
96 if(std::isnan(it->second.valueDouble))
97 {
98 return (double)it->second.valueInt;
99 }
100 return it->second.valueDouble;
101}

Referenced by FilterMs1WindowSelection::FilterMs1WindowSelection().

◆ getUpperMz()

double pappso::cbor::mzcbor::IsolationWindow::getUpperMz ( ) const

compute isolation window upper m/z given cvParam informations

Definition at line 141 of file precursor.cpp.

142{
143
144 double mz = getTargetMz();
145
146 auto it = cvParamMap.find("MS:1000829");
147
148 if(it == cvParamMap.end())
149 {
151 QObject::tr("isolation window upper offset MS:1000829 not found in cvParam map"));
152 }
153
154 if(std::isnan(it->second.valueDouble))
155 {
156 return mz + (double)it->second.valueInt;
157 }
158 return mz + it->second.valueDouble;
159}

Referenced by FilterMs1WindowSelection::FilterMs1WindowSelection().

◆ toJsonObject()

QJsonObject pappso::cbor::mzcbor::IsolationWindow::toJsonObject ( ) const

write the structure to a JSON object

Returns
QJsonObject

Definition at line 124 of file precursor.cpp.

125{
126 QJsonObject isolationWindow;
127 isolationWindow.insert("cvParam", cvParamMap.toJsonArray());
128 return isolationWindow;
129}
QJsonArray toJsonArray() const
write the structure to a JSON array

Member Data Documentation

◆ cvParamMap

CvParamMap pappso::cbor::mzcbor::IsolationWindow::cvParamMap

Definition at line 68 of file precursor.h.

Referenced by fromQCborMap().


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