libpappsomspp
Library for mass spectrometry
Loading...
Searching...
No Matches
mzcborreaderbase.cpp
Go to the documentation of this file.
1/**
2 * \file pappsomspp/processing/cbor/mzcbor/mzcborreaderbase.cpp
3 * \date 19/11/2025
4 * \author Olivier Langella
5 * \brief read mzcbor stream or file
6 */
7
8/*******************************************************************************
9 * Copyright (c) 2025 Olivier Langella <Olivier.Langella@universite-paris-saclay.fr>.
10 *
11 * This file is part of PAPPSOms-tools.
12 *
13 * PAPPSOms-tools is free software: you can redistribute it and/or modify
14 * it under the terms of the GNU General Public License as published by
15 * the Free Software Foundation, either version 3 of the License, or
16 * (at your option) any later version.
17 *
18 * PAPPSOms-tools is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU General Public License for more details.
22 *
23 * You should have received a copy of the GNU General Public License
24 * along with PAPPSOms-tools. If not, see <http://www.gnu.org/licenses/>.
25 *
26 ******************************************************************************/
27
28#include "mzcborreaderbase.h"
29#include "cvparam.h"
30
34
38
39void
43
44void
46{
47 qDebug();
48 initCborReader(cborp);
49
50 qDebug();
51 if(mpa_cborReader->isMap())
52 {
53 readRoot(monitor);
54 }
55 qDebug();
56}
57
58void
61{
62 qDebug();
63 initCborReader(cborp);
64
65 qDebug();
66 if(mpa_cborReader->isMap())
67 {
68 readRoot(monitor);
69 }
70 qDebug();
71}
72
73
74void
76 [[maybe_unused]])
77{
78 qDebug();
79 mpa_cborReader->enterContainer();
80
81 while(getExpectedString())
82 {
83
84 if(m_expectedString == "mzCBOR")
85 {
86 m_isMzcbor = true;
87 mpa_cborReader->next();
88 }
89 else if(m_expectedString == "mzML")
90 {
91 m_isMzcbor = true;
92 qDebug() << m_expectedString;
93 mpa_cborReader->next();
94
95 while(getExpectedString())
96 {
97 qDebug() << m_expectedString;
98 if(m_expectedString == "run")
99 {
100 readMsrun();
101 }
102 else if(m_expectedString == "referenceableParamGroupList")
103 {
105 }
106 else
107 {
108 mpa_cborReader->next();
109 }
110 if(m_stopParsing)
111 break;
112 }
113 }
114 }
115 mpa_cborReader->leaveContainer();
116}
117
118
119bool
124
125const QStringList &
130
131
132void
134{
135 mpa_cborReader->enterContainer();
136
137 while(getExpectedString())
138 {
139 if(m_expectedString == "referenceableParamGroup")
140 {
141 mpa_cborReader->next();
142 /*
143 mpa_cborReader->enterContainer();
144
145 while(getExpectedString())
146 {
147 if(m_expectedString == "cvParam")
148 {
149 std::map<QString, pappso::cbor::mzcbor::CvParam> cvParamMap =
150 CvParam::getCvParamsMapFromCbor(*mpa_cborReader);
151 }
152 else
153 {
154 mpa_cborReader->next();
155 }
156 }
157
158 mpa_cborReader->leaveContainer();*/
159 }
160 else
161 {
162 mpa_cborReader->next();
163 }
164 }
165
166 mpa_cborReader->leaveContainer();
167}
168void
170{
171 mpa_cborReader->enterContainer();
172
173 while(getExpectedString())
174 {
175 if(m_expectedString == "id")
176 {
179 }
180 else
181 {
182 mpa_cborReader->next();
183 }
184 }
185
186 mpa_cborReader->leaveContainer();
187}
188
189std::map<QString, pappso::cbor::mzcbor::CvParam>
191{
192 qDebug();
193 std::map<QString, CvParam> accession_values;
194 mpa_cborReader->enterContainer(); // start array
195
196 while(mpa_cborReader->hasNext())
197 {
198
199 CvParam cv_param;
200 cv_param.fromCbor(*mpa_cborReader);
201 accession_values.insert({cv_param.accession, cv_param});
202 }
203
204 mpa_cborReader->leaveContainer(); // end array
205 return accession_values;
206}
virtual void readCbor(QFile *cborp, pappso::UiMonitorInterface &monitor)
read mzCBOR file
void readRoot(pappso::UiMonitorInterface &monitor)
virtual void close()
convenient function to clean pointer before leaving
std::map< QString, CvParam > getCvParamsMap()
read the array containing cvParams to give accessions and values
const QStringList & getMsrunIdList() const
PSI cvParam object for mzML/mzCBOR.
read mzcbor stream or file
void fromCbor(CborStreamReader &reader)
Definition cvparam.cpp:36