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)
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 41 of file precursor.h.

Member Function Documentation

◆ fromCbor()

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

Definition at line 34 of file precursor.cpp.

35{
36 QString txt_value;
37 reader.enterContainer();
38 qDebug() << txt_value;
39 while(reader.hasNext() && (!reader.isInvalid()))
40 {
41 if(reader.isString())
42 {
43 if(reader.decodeString(txt_value))
44 {
45 qDebug() << txt_value;
46 if(txt_value == "cvParam")
47 {
48 cvParamMap.fromCbor(reader);
49 // reader.next();
50 }
51 else
52 {
53 reader.next();
54 }
55 }
56 else
57 {
58 reader.next();
59 }
60 }
61 else
62 {
63 reader.next();
64 }
65 }
66 reader.leaveContainer();
67}

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

◆ getLowerMz()

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

compute isolation window lower m/z given cvParam informations

Definition at line 84 of file precursor.cpp.

85{
86 double mz = getTargetMz();
87
88 auto it = cvParamMap.find("MS:1000828");
89
90 if(it == cvParamMap.end())
91 {
92 throw pappso::ExceptionNotFound(
93 QObject::tr("isolation window lower offset MS:1000828 not found in cvParam map"));
94 }
95
96 return mz - it->second.valueDouble;
97}
double getTargetMz() const
get isolation window target m/z given cvParam informations
Definition precursor.cpp:70

References cvParamMap, and getTargetMz().

◆ getTargetMz()

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

get isolation window target m/z given cvParam informations

Definition at line 70 of file precursor.cpp.

71{
72 auto it = cvParamMap.find("MS:1000827");
73
74 if(it == cvParamMap.end())
75 {
76 throw pappso::ExceptionNotFound(
77 QObject::tr("isolation window target m/z MS:1000827 not found in cvParam map"));
78 }
79
80 return it->second.valueDouble;
81}

References cvParamMap.

Referenced by getLowerMz(), and getUpperMz().

◆ getUpperMz()

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

compute isolation window upper m/z given cvParam informations

Definition at line 117 of file precursor.cpp.

118{
119
120 double mz = getTargetMz();
121
122 auto it = cvParamMap.find("MS:1000829");
123
124 if(it == cvParamMap.end())
125 {
126 throw pappso::ExceptionNotFound(
127 QObject::tr("isolation window upper offset MS:1000829 not found in cvParam map"));
128 }
129
130 return mz + it->second.valueDouble;
131}

References cvParamMap, and getTargetMz().

◆ toJsonObject()

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

write the structure to a JSON object

Returns
QJsonObject

Definition at line 100 of file precursor.cpp.

101{
102 QJsonObject isolationWindow;
103 isolationWindow.insert("cvParam", cvParamMap.toJsonArray());
104 return isolationWindow;
105}

References cvParamMap.

Member Data Documentation

◆ cvParamMap

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

Definition at line 66 of file precursor.h.

Referenced by fromCbor(), getLowerMz(), getTargetMz(), getUpperMz(), and toJsonObject().


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