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"
31
35
39
40void
44
45void
47{
48 qDebug();
49 initCborReader(cborp);
50
51 qDebug();
52 if(mpa_cborReader->isMap())
53 {
54 readRoot(monitor);
55 }
56 qDebug();
57}
58
59void
62{
63 qDebug();
64 initCborReader(cborp);
65
66 qDebug();
67 if(mpa_cborReader->isMap())
68 {
69 readRoot(monitor);
70 }
71 qDebug();
72}
73
74
75void
77 [[maybe_unused]])
78{
79 qDebug();
80 mpa_cborReader->enterContainer();
81
82 while(getExpectedString())
83 {
84
85 if(m_expectedString == "mzCBOR")
86 {
87 m_isMzcbor = true;
88 mpa_cborReader->next();
89 }
90 else if(m_expectedString == "mzML")
91 {
92 m_isMzcbor = true;
93 qDebug() << m_expectedString;
94 mpa_cborReader->next();
95
96 while(getExpectedString())
97 {
98 qDebug() << m_expectedString;
99 if(m_expectedString == "run")
100 {
101 readMsrun();
102 }
103 else if(m_expectedString == "referenceableParamGroupList")
104 {
106 }
107 else
108 {
109 mpa_cborReader->next();
110 }
111 if(m_stopParsing)
112 break;
113 }
114 }
115 }
116 mpa_cborReader->leaveContainer();
117}
118
119
120bool
125
126const QStringList &
131
132
133void
135{
136 mpa_cborReader->enterContainer();
137
138 while(getExpectedString())
139 {
140 if(m_expectedString == "referenceableParamGroup")
141 {
142 mpa_cborReader->next();
143 /*
144 mpa_cborReader->enterContainer();
145
146 while(getExpectedString())
147 {
148 if(m_expectedString == "cvParam")
149 {
150 std::map<QString, pappso::cbor::mzcbor::CvParam> cvParamMap =
151 CvParam::getCvParamsMapFromCbor(*mpa_cborReader);
152 }
153 else
154 {
155 mpa_cborReader->next();
156 }
157 }
158
159 mpa_cborReader->leaveContainer();*/
160 }
161 else
162 {
163 mpa_cborReader->next();
164 }
165 }
166
167 mpa_cborReader->leaveContainer();
168}
169void
171{
172 mpa_cborReader->enterContainer();
173
174 while(getExpectedString())
175 {
176 if(m_expectedString == "id")
177 {
180 }
181 else
182 {
183 mpa_cborReader->next();
184 }
185 }
186
187 mpa_cborReader->leaveContainer();
188}
189
190std::map<QString, pappso::cbor::mzcbor::CvParam>
192{
193 qDebug();
194 std::map<QString, CvParam> accession_values;
195 mpa_cborReader->enterContainer(); // start array
196
197 while(mpa_cborReader->hasNext())
198 {
199
200 CvParam cv_param;
201 cv_param.fromCbor(*mpa_cborReader);
202 accession_values.insert({cv_param.accession, cv_param});
203 }
204
205 mpa_cborReader->leaveContainer(); // end array
206 return accession_values;
207}
virtual void readCbor(QFile *cborp, pappso::UiMonitorInterface &monitor)
void readRoot(pappso::UiMonitorInterface &monitor)
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:33