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

std::map< QString, pappso::cbor::mzcbor::CvParamcvParamMap

Detailed Description

Definition at line 41 of file precursor.h.

Member Function Documentation

◆ fromCbor()

void pappso::cbor::mzcbor::SelectedIon::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 {
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}
static std::map< QString, pappso::cbor::mzcbor::CvParam > getCvParamsMapFromCbor(CborStreamReader &reader)
Definition cvparam.cpp:182
std::map< QString, pappso::cbor::mzcbor::CvParam > cvParamMap
Definition precursor.h:49

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

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

◆ getChargeState()

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

Definition at line 71 of file precursor.cpp.

72{
73
74 // <cvParam cvRef="MS" accession="MS:1000041" value="3" name="charge state" />
75
76 auto it = cvParamMap.find("MS:1000041");
77 if(it == cvParamMap.end())
78 {
79 throw pappso::ExceptionNotFound(
80 QObject::tr("Charge state not found in SelectedIon cvParam map"));
81 }
82 qDebug() << it->first << " " << it->second.valueInt;
83 return it->second.valueInt;
84}

References cvParamMap.

◆ getIntensity()

qint64 pappso::cbor::mzcbor::SelectedIon::getIntensity ( ) const

Definition at line 87 of file precursor.cpp.

88{
89
90 // <cvParam cvRef="MS" accession="MS:1000042" value="248032.25" name="peak intensity"
91 // unitAccession="MS:1000131" unitName="number of detector counts" unitCvRef="MS" />
92
93 auto it = cvParamMap.find("MS:1000042");
94 if(it == cvParamMap.end())
95 {
96 throw pappso::ExceptionNotFound(
97 QObject::tr("Intensity not found in SelectedIon cvParam map"));
98 }
99 qDebug() << it->first << " " << it->second.valueInt;
100 return it->second.valueInt;
101}

References cvParamMap.

◆ getMz()

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

Definition at line 104 of file precursor.cpp.

105{
106
107 // <cvParam cvRef="MS" accession="MS:1000744" value="506.2513" name="selected ion m/z"
108 // unitAccession="MS:1000040" unitName="m/z" unitCvRef="MS" />
109
110 auto it = cvParamMap.find("MS:1000744");
111 if(it == cvParamMap.end())
112 {
113 throw pappso::ExceptionNotFound(QObject::tr("m/z not found in SelectedIon cvParam map"));
114 }
115 qDebug() << it->first << " " << it->second.valueDouble;
116 return it->second.valueDouble;
117}

References cvParamMap.

Member Data Documentation

◆ cvParamMap

std::map<QString, pappso::cbor::mzcbor::CvParam> pappso::cbor::mzcbor::SelectedIon::cvParamMap

Definition at line 49 of file precursor.h.

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


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