libpappsomspp
Library for mass spectrometry
Loading...
Searching...
No Matches
mzcbormsrunreader.cpp
Go to the documentation of this file.
1/**
2 * \file pappsomspp/core/msrun/private/mzcbormsrunreader.cpp
3 * \date 21/11/2025
4 * \author Olivier Langella
5 * \brief MSrun file reader for mzcbor
6 */
7
8/*******************************************************************************
9 * Copyright (c) 2025 Olivier Langella <Olivier.Langella@universite-paris-saclay.fr>.
10 *
11 * This file is part of the PAPPSOms++ library.
12 *
13 * PAPPSOms++ 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++ 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++. If not, see <http://www.gnu.org/licenses/>.
25 *
26 ******************************************************************************/
27
28
29#include "mzcbormsrunreader.h"
37#include <qlogging.h>
38
39namespace pappso
40{
42 : pappso::MsRunReader(msrun_id_csp)
43{
44 initialize();
45 qDebug();
46}
47
52
53
54const std::vector<qint64> &
60
61void
63{
64 qDebug();
65 m_cborFileInfo.setFile(mcsp_msRunId->getFileName());
66
67 if(!m_cborFileInfo.exists())
68 throw ExceptionNotFound(m_cborFileInfo.absoluteFilePath());
69
70
71 // build the index
73
74 QString str_index_file = m_cborFileInfo.absoluteFilePath();
75 QFileInfo mzcbor_index_fileinfo(str_index_file.append(".idx"));
76 if(mzcbor_index_fileinfo.exists())
77 {
78 qDebug() << "mzcbor_index_fileinfo.exists()";
79 QFile mzcbor_index_file(mzcbor_index_fileinfo.absoluteFilePath());
80 mzcbor_index_file.open(QIODevice::ReadOnly);
81
83 index_reader.readCbor(&mzcbor_index_file);
84 index_reader.close();
85 mzcbor_index_file.close();
86
87 qDebug();
88 std::vector<QString> run_id_list = index_reader.getRunIdList();
89 if(run_id_list.size() > 0)
90 {
91 std::size_t run_position = 0;
92 if(run_id_list.size() > 1)
93 {
94 std::size_t i_run = 0;
95 for(const QString &run_id : run_id_list)
96 {
97 if(run_id == getMsRunId().get()->getRunId())
98 {
99 run_position = i_run;
100 }
101 i_run++;
102 }
103 }
104
106 index_reader.getRunAndSpectrumOffsetList().at(run_position);
107
108
109 if(index_reader.getRunAndSpectrumTotalIonCountList().size() > run_position)
110 {
112 index_reader.getRunAndSpectrumTotalIonCountList().at(run_position);
113 }
114 if(index_reader.getRunAndSpectrumMsLevelList().size() > run_position)
115 {
116 m_spectrumMsLevelList = index_reader.getRunAndSpectrumMsLevelList().at(run_position);
117 }
118
119 if(index_reader.getRunAndSpectrumRtList().size() > run_position)
120 {
121 m_spectrumRtList = index_reader.getRunAndSpectrumRtList().at(run_position);
122 }
123 // qFatal() << m_spectrumTotalIonCountList.size();
124
125 std::size_t i = 0;
126 for(const QString &native_id : index_reader.getRunAndSpectrumIdList().at(run_position))
127 {
128 m_nativeId2SpectrumIndexMap.insert({native_id, i});
129 i++;
130 }
131 }
132 }
133
134 if(m_spectrumIndexPositionInFile.size() == 0)
135 {
136
137 pappso::UiMonitorVoid monitor;
138 pappso::cbor::mzcbor::MzcborBuildIndexReader mzcbor_build_index_reader(getMsRunId());
139 mzcbor_build_index_reader.readCbor(mpa_mzcborFileDevice, monitor);
140
141
142 qDebug();
143 mzcbor_build_index_reader.close();
144 // releaseDevice();
145 qDebug();
146
148 m_nativeId2SpectrumIndexMap = mzcbor_build_index_reader.getNativeId2SpectrumIndexMap();
149 }
150}
151
152bool
154{
155 if(m_nativeId2SpectrumIndexMap.size() > 0)
156 {
157 if(m_nativeId2SpectrumIndexMap.begin()->first.contains("scan="))
158 return true;
159 }
160 return false;
161}
162
163std::size_t
165{
166 if(m_scan2SpectrumIndexMap.size() == 0)
167 {
168 for(auto &index_pair : m_nativeId2SpectrumIndexMap)
169 {
170 QStringList native_id_list = index_pair.first.split("=");
171 if(native_id_list.size() < 2)
172 {
173 }
174 else
175 {
176 std::size_t scan_number = native_id_list.back().toULong();
178 std::pair<std::size_t, std::size_t>(scan_number, index_pair.second));
179 }
180 }
181 }
182
183 auto it = m_scan2SpectrumIndexMap.find(scan_number);
184
185 if(it == m_scan2SpectrumIndexMap.end())
186 {
187 throw ExceptionNotFound(QObject::tr("error reading file %1 : scan %2 not found")
188 .arg(mcsp_msRunId.get()->getFileName())
189 .arg(scan_number));
190 }
191 return it->second;
192}
193
194bool
195MzcborMsRunReader::accept(const QString &file_name [[maybe_unused]]) const
196{
197
199 QObject::tr("%1 %2 %3 not implemented").arg(__FILE__).arg(__FUNCTION__).arg(__LINE__));
200}
201
202
203const OboPsiModTerm
205{
207 QObject::tr("%1 %2 %3 not implemented").arg(__FILE__).arg(__FUNCTION__).arg(__LINE__));
208}
209
210bool
212{
213 if(mpa_mzcborFileDevice == nullptr)
214 {
215 mpa_mzcborFileDevice = new QFile(m_cborFileInfo.absoluteFilePath());
216 mpa_mzcborFileDevice->open(QIODevice::ReadOnly);
217 }
218 return true;
219}
220
221
222bool
224{
225 if(mpa_mzcborFileDevice != nullptr)
226 {
227 mpa_mzcborFileDevice->close();
229 mpa_mzcborFileDevice = nullptr;
230 }
231 return true;
232}
233
234
237 const pappso::QualifiedMassSpectrum &mass_spectrum, pappso::PrecisionPtr precision) const
238{
239
240 XicCoordSPtr xic_coord = std::make_shared<XicCoord>();
241
242 xic_coord.get()->rtTarget = mass_spectrum.getRtInSeconds();
243 xic_coord.get()->mzRange = MzRange(mass_spectrum.getPrecursorMz(), precision);
244 return xic_coord;
245}
246
249 pappso::PrecisionPtr precision) const
250{
251
252 pappso::cbor::mzcbor::Spectrum cbor_spectrum;
253
254 fillMzcborSpectrum(spectrum_index, cbor_spectrum, false);
255
256 XicCoordSPtr xic_coord = std::make_shared<XicCoord>();
257
258 xic_coord.get()->rtTarget = cbor_spectrum.getRtInSeconds();
259
260 bool get_mz = false;
261 if(cbor_spectrum.precursorList.size() > 0)
262 {
263
264 for(auto &precursor : cbor_spectrum.precursorList)
265 {
266 for(auto &ion : precursor.selectedIonList)
267 {
268 xic_coord.get()->mzRange = MzRange(ion.getMz(), precision);
269 get_mz = true;
270 }
271 }
272 if(!get_mz)
273 {
275 QObject::tr("precursor m/z not found for this spectrum index %1").arg(spectrum_index));
276 }
277 }
278 else
279 {
281 QObject::tr("no precursor found for this spectrum index %1").arg(spectrum_index));
282 }
283
284 return xic_coord;
285}
286
289{
290 return massSpectrumSPtr(spectrum_index);
291}
292
295{
296 MassSpectrumSPtr mass_spectrum_sp;
297 try
298 {
300 pappso::cbor::mzcbor::Spectrum cbor_spectrum;
301
302 fillMzcborSpectrum(spectrum_index, cbor_spectrum, true);
303 if(cbor_spectrum.binaryDataArrayList.size() == 2)
304 {
305 mass_spectrum_sp = std::make_shared<MassSpectrum>();
306 cbor_spectrum.decodeTrace(*(mass_spectrum_sp.get()));
307 }
308 else
309 {
311 QObject::tr("cbor_spectrum.binaryDataArrayList.size() != 2"));
312 }
313 }
314 catch(const pappso::PappsoException &pappso_error)
315 {
316 qDebug() << "Going to throw";
317
318 throw pappso::PappsoException(QObject::tr("Error reading data (massSpectrumSPtr) using the "
319 "mzcbor reader: %1")
320 .arg(pappso_error.what()));
321 }
322 return mass_spectrum_sp;
323}
324
327 bool want_binary_data) const
328{
329 qDebug();
330 try
331 {
332 pappso::cbor::mzcbor::Spectrum cbor_spectrum;
333
334 fillMzcborSpectrum(spectrum_index, cbor_spectrum, want_binary_data);
335 qDebug() << cbor_spectrum.index;
336 QualifiedMassSpectrum qualified_mass_spectrum;
337
338 MassSpectrumId spectrum_id(mcsp_msRunId, spectrum_index);
339 spectrum_id.setNativeId(cbor_spectrum.id);
340
341 spectrum_id.setSpectrumIndex(cbor_spectrum.index);
342
343 qualified_mass_spectrum.setMassSpectrumId(spectrum_id);
344 qualified_mass_spectrum.setRtInSeconds(cbor_spectrum.getRtInSeconds());
345 if(cbor_spectrum.precursorList.size() > 0)
346 {
347 qualified_mass_spectrum.setPrecursorNativeId(
348 cbor_spectrum.precursorList.at(0).spectrumRef);
349 qualified_mass_spectrum.setPrecursorSpectrumIndex(
350 m_nativeId2SpectrumIndexMap.at(cbor_spectrum.precursorList.at(0).spectrumRef));
351 // qWarning() << "pappso::MzcborMsRunReader::qualifiedMassSpectrum";
352
353 for(auto &precursor : cbor_spectrum.precursorList)
354 {
355
356 // *****************************************************
357 // get isolation window (very simplified)
358 // *****************************************************
359
360 try
361 {
362 // qWarning() << "pappso::MzcborMsRunReader::qualifiedMassSpectrum";
363 qualified_mass_spectrum.setParameterValue(
365 precursor.isolationWindow.getTargetMz());
366
367
368 auto it = precursor.isolationWindow.cvParamMap.find("MS:1000828");
369
370 if(it == precursor.isolationWindow.cvParamMap.end())
371 {
372 throw pappso::ExceptionNotFound(QObject::tr(
373 "isolation window lower offset MS:1000828 not found in cvParam map"));
374 }
375 qualified_mass_spectrum.setParameterValue(
377 it->second.valueDouble);
378
379
380 it = precursor.isolationWindow.cvParamMap.find("MS:1000829");
381
382 if(it == precursor.isolationWindow.cvParamMap.end())
383 {
384 throw pappso::ExceptionNotFound(QObject::tr(
385 "isolation window upper offset MS:1000829 not found in cvParam map"));
386 }
387
388 qualified_mass_spectrum.setParameterValue(
390 it->second.valueDouble);
391 }
392 catch(const pappso::ExceptionNotFound &not_found)
393 {
394 // isolation window not available
395 // throw not_found;
396 }
397 // *****************************************************
398 // end get isolation window (very simplified)
399 // *****************************************************
400
401 for(auto &ion : precursor.selectedIonList)
402 {
403 PrecursorIonData precursor_ion_data;
404 precursor_ion_data.charge = ion.getChargeState();
405 bool is_ok;
406 precursor_ion_data.intensity = ion.getIntensity(&is_ok);
407 precursor_ion_data.mz = ion.getMz();
408 qualified_mass_spectrum.appendPrecursorIonData(precursor_ion_data);
409 }
410 }
411 }
412
413
414 qDebug();
415 qualified_mass_spectrum.setMsLevel(cbor_spectrum.getMsLevel());
416
417 qDebug();
418 qualified_mass_spectrum.setEmptyMassSpectrum(!cbor_spectrum.defaultArrayLength);
419 if(cbor_spectrum.binaryDataArrayList.size() == 2)
420 {
421 MassSpectrumSPtr mass_spectrum_sp = std::make_shared<MassSpectrum>();
422 cbor_spectrum.decodeTrace(*(mass_spectrum_sp.get()));
423 qualified_mass_spectrum.setMassSpectrumSPtr(mass_spectrum_sp);
424 }
425
426 qDebug() << "spectrum id=" << cbor_spectrum.id;
427
428 return qualified_mass_spectrum;
429 }
430
431 catch(const pappso::PappsoException &pappso_error)
432 {
433 qDebug() << "Going to throw";
434
436 QObject::tr("Error reading data (qualifiedMassSpectrum) using the "
437 "mzcbor reader: %1")
438 .arg(pappso_error.what()));
439 }
440}
441
442void
444{
445
447 QObject::tr("%1 %2 %3 not implemented").arg(__FILE__).arg(__FUNCTION__).arg(__LINE__));
448 MsRunReadConfig config;
449 std::vector<size_t> ms_levels;
450 for(std::size_t i = 1; i < 9; i++)
451 {
452 if(handler.needMsLevelPeakList(i))
453 {
454 ms_levels.push_back(i);
455 }
456 }
457 config.setMsLevels(ms_levels);
458 config.setNeedPeakList(handler.needPeakList());
459 // readSpectrumCollectionByMsLevel(reader_timeline, 1);
460
461 try
462 {
464 }
465 catch(const pappso::PappsoException &pappso_error)
466 {
467 qDebug() << "Going to throw";
468
470 QObject::tr("Error reading data (spectrum collection2) using the "
471 "mzcbor reader: %1")
472 .arg(pappso_error.what()));
473 }
474 catch(std::exception &error)
475 {
476 qDebug() << "Going to throw";
477
479 QObject::tr("Error reading data (spectrum collection) using the "
480 "mzcbor reader: %1")
481 .arg(error.what()));
482 }
483}
484
485void
488{
489 qDebug();
490 try
491 {
493 }
494 catch(const pappso::PappsoException &pappso_error)
495 {
496 qDebug() << "Going to throw";
497
499 QObject::tr("Error reading data (spectrum collection2) using the "
500 "mzcbor reader: %1")
501 .arg(pappso_error.what()));
502 }
503 catch(std::exception &error)
504 {
505 qDebug() << "Going to throw";
506
508 QObject::tr("Error reading data (spectrum collection2) using the "
509 "mzcbor reader: %1")
510 .arg(error.what()));
511 }
512}
513
514void
516 SpectrumCollectionHandlerInterface &handler, unsigned int ms_level)
517{
518 MsRunReadConfig config;
519 config.setMsLevels({ms_level});
520 config.setNeedPeakList(handler.needPeakList());
521 // readSpectrumCollectionByMsLevel(reader_timeline, 1);
522 readSpectrumCollection2(config, handler);
523}
524
525std::size_t
530
531std::size_t
533 const QString &spectrum_identifier)
534{
535 auto it = m_nativeId2SpectrumIndexMap.find(spectrum_identifier);
536 if(it == m_nativeId2SpectrumIndexMap.end())
537 {
539 QObject::tr("spectrum identifier %1 not found").arg(spectrum_identifier));
540 }
541 return it->second;
542}
543
544
545void
548{
549 // acquireDevice();
550 try
551 {
553 pappso::UiMonitorVoid monitor;
554 pappso::cbor::mzcbor::MzcborSpectrumCollectionReader mzcbor_spectrum_collection_reader(
555 config, handler);
556 mzcbor_spectrum_collection_reader.setMsRunId(getMsRunId());
557 mzcbor_spectrum_collection_reader.setNativeId2SpectrumIndexMapPtr(
559 mzcbor_spectrum_collection_reader.readCbor(mpa_mzcborFileDevice, monitor);
560
561
562 qDebug();
563 mzcbor_spectrum_collection_reader.close();
564 qDebug();
565 }
566 catch(const pappso::PappsoException &pappso_err)
567 {
569 QObject::tr("ERROR in MzcborMsRunReader::readSpectrumCollectionWithMsrunReadConfig:\n%1")
570 .arg(pappso_err.qwhat()));
571 }
572 // End of
573 // for(std::size_t iter = 0; iter < spectrum_list_size; iter++)
574
575 // Now let the loading handler know that the loading of the data has ended.
576 // The handler might need this "signal" to perform additional tasks or to
577 // cleanup cruft.
578}
579
580
581void
582MzcborMsRunReader::fillMzcborSpectrum(std::size_t spectrum_index,
584 bool want_binary_data) const
585{
586
587 if(spectrum_index >= m_spectrumIndexPositionInFile.size())
588 {
590 QObject::tr("spectrum index %1 not found").arg(spectrum_index));
591 }
592 if(mpa_mzcborFileDevice == nullptr)
593 {
594
596 QObject::tr("mzCBOR file device is not ready, use acquireDevice() before access"));
597 }
598 qDebug() << spectrum_index << " " << m_spectrumIndexPositionInFile[spectrum_index];
599
600
601 // qDebug() << spectrum_index << " " << m_spectrumIndexPositionInFile[spectrum_index-1];
602
603
604 if(mpa_mzcborFileDevice->seek(m_spectrumIndexPositionInFile[spectrum_index]))
605 {
607 cbor_stream_reader.setDevice(mpa_mzcborFileDevice);
608
609
610 try
611 {
612 spectrum.fromCbor(cbor_stream_reader, want_binary_data);
613 }
614 catch(const pappso::PappsoException &error)
615 {
616
617 throw pappso::PappsoException(QObject::tr("ERROR reading spectrum %1 cbor:\n%2")
618 .arg(spectrum_index)
619 .arg(error.qwhat()));
620 }
621 // cbor_stream_reader.leaveContainer();
622
623 if(spectrum.id.isEmpty())
624 {
626 QObject::tr("ERROR reading spectrum %1 cbor:\nspectrum not found").arg(spectrum_index));
627 }
628 }
629 else
630 {
632 QObject::tr("ERROR reading spectrum %1 cbor:\nseek failed").arg(spectrum_index));
633 }
634 // mzcbor_file.close();
635}
636
637
638Trace
640{
641 qDebug() << m_spectrumMsLevelList.size() << " " << m_spectrumTotalIonCountList.size();
642 Trace chromatogram;
643 if((m_spectrumTotalIonCountList.size() > 0) &&
645 {
646 for(std::size_t i = 0; i < m_spectrumTotalIonCountList.size(); i++)
647 {
648 if(m_spectrumMsLevelList.at(i) == 1)
649 {
650 chromatogram.push_back(
651 {m_spectrumRtList.at(i), (double)m_spectrumTotalIonCountList.at(i)});
652 }
653 }
654 }
655 else
656 {
658 }
659 return chromatogram;
660}
661std::vector<double>
663{
664 qDebug();
665 std::vector<double> time_line;
666 if((m_spectrumRtList.size() > 0) && (m_spectrumMsLevelList.size() == m_spectrumRtList.size()))
667 {
668 for(std::size_t i = 0; i < m_spectrumRtList.size(); i++)
669 {
670 if(m_spectrumMsLevelList.at(i) == 1)
671 {
672 time_line.push_back(m_spectrumRtList.at(i));
673 }
674 }
675 }
676 else
677 {
679 }
680 return time_line;
681}
682
683std::shared_ptr<pappso::cbor::mzcbor::Spectrum>
684MzcborMsRunReader::getMzcborSpectrumSp(std::size_t spectrum_index, bool want_binary_data) const
685{
686 std::shared_ptr<pappso::cbor::mzcbor::Spectrum> cbor_spectrum_sp =
687 std::make_shared<pappso::cbor::mzcbor::Spectrum>();
688
689 fillMzcborSpectrum(spectrum_index, *cbor_spectrum_sp, want_binary_data);
690
691 return cbor_spectrum_sp;
692}
693
694} // namespace pappso
void setNativeId(const QString &native_id)
void setSpectrumIndex(std::size_t index)
void setNeedPeakList(bool need_peak_list)
void setMsLevels(std::vector< std::size_t > ms_levels)
MsRunIdCstSPtr mcsp_msRunId
MsRunReader(const MsRunIdCstSPtr &ms_run_id)
virtual std::vector< double > getRetentionTimeLine()
retention timeline get retention times along the MSrun in seconds
virtual Trace getTicChromatogram()
get a TIC chromatogram
const MsRunIdCstSPtr & getMsRunId() const
virtual std::vector< double > getRetentionTimeLine() override
retention timeline get retention times along the MSrun in seconds
const std::vector< qint64 > & getSpectrumIndexPositionInFile() const
virtual pappso::XicCoordSPtr newXicCoordSPtrFromSpectrumIndex(std::size_t spectrum_index, pappso::PrecisionPtr precision) const override
get a xic coordinate object from a given spectrum index
std::map< QString, std::size_t > m_nativeId2SpectrumIndexMap
virtual void readSpectrumCollection2(const MsRunReadConfig &config, SpectrumCollectionHandlerInterface &handler) override
function to visit an MsRunReader and get each Spectrum in a spectrum collection handler
std::vector< qint64 > m_spectrumTotalIonCountList
virtual pappso::XicCoordSPtr newXicCoordSPtrFromQualifiedMassSpectrum(const pappso::QualifiedMassSpectrum &mass_spectrum, pappso::PrecisionPtr precision) const override
get a xic coordinate object from a given spectrum
virtual bool hasScanNumbers() const override
tells if spectra can be accessed using scan numbers by default, it returns false. Only overrided func...
void readSpectrumCollectionWithMsrunReadConfig(const MsRunReadConfig &config, SpectrumCollectionHandlerInterface &handler)
virtual const OboPsiModTerm getOboPsiModTermInstrumentModelName() const override
get OboPsiModTerm corresponding to the instrument model name child of : [Term] id: MS:1000031 name: i...
virtual Trace getTicChromatogram() override
get a TIC chromatogram
virtual bool releaseDevice() override
release data back end device if a the data back end is released, the developper has to use acquireDev...
virtual void readSpectrumCollection(SpectrumCollectionHandlerInterface &handler) override
function to visit an MsRunReader and get each Spectrum in a spectrum collection handler
std::vector< qint64 > m_spectrumIndexPositionInFile
virtual std::size_t spectrumStringIdentifier2SpectrumIndex(const QString &spectrum_identifier) override
if possible, get the spectrum index given a string identifier throw a not found exception if spectrum...
std::vector< double > m_spectrumRtList
virtual MassSpectrumCstSPtr massSpectrumCstSPtr(std::size_t spectrum_index) override
virtual std::size_t scanNumber2SpectrumIndex(std::size_t scan_number) override
if possible, converts a scan number into a spectrum index This is a convenient function to help trans...
std::map< std::size_t, std::size_t > m_scan2SpectrumIndexMap
std::shared_ptr< pappso::cbor::mzcbor::Spectrum > getMzcborSpectrumSp(std::size_t spectrum_index, bool want_binary_data) const
get spectrum mzML element
virtual std::size_t spectrumListSize() const override
get the totat number of spectrum conained in the MSrun data file
MzcborMsRunReader(MsRunIdCstSPtr &msrun_id_csp)
virtual void fillMzcborSpectrum(std::size_t spectrum_index, pappso::cbor::mzcbor::Spectrum &spectrum, bool want_binary_data) const
virtual void readSpectrumCollectionByMsLevel(SpectrumCollectionHandlerInterface &handler, unsigned int ms_level) override
function to visit an MsRunReader and get each Spectrum in a spectrum collection handler by Ms Levels
virtual QualifiedMassSpectrum qualifiedMassSpectrum(std::size_t spectrum_index, bool want_binary_data=true) const override
get a QualifiedMassSpectrum class given its scan number
virtual MassSpectrumSPtr massSpectrumSPtr(std::size_t spectrum_index) override
get a MassSpectrumSPtr class given its spectrum index
std::vector< std::uint8_t > m_spectrumMsLevelList
virtual bool acquireDevice() override
acquire data back end device
virtual bool accept(const QString &file_name) const override
tells if the reader is able to handle this file must be implemented by private MS run reader,...
virtual void initialize() override
const char * what() const noexcept override
virtual const QString & qwhat() const
Class representing a fully specified mass spectrum.
void setPrecursorNativeId(const QString &native_id)
Set the scan native id of the precursor ion.
void appendPrecursorIonData(const PrecursorIonData &precursor_ion_data)
void setMassSpectrumId(const MassSpectrumId &iD)
Set the MassSpectrumId.
void setMsLevel(uint ms_level)
Set the mass spectrum level.
void setPrecursorSpectrumIndex(std::size_t precursor_scan_num)
Set the scan number of the precursor ion.
pappso_double getPrecursorMz(bool *ok=nullptr) const
get precursor mz
void setParameterValue(QualifiedMassSpectrumParameter parameter, const QVariant &value)
void setMassSpectrumSPtr(MassSpectrumSPtr massSpectrum)
Set the MassSpectrumSPtr.
void setRtInSeconds(pappso_double rt)
Set the retention time in seconds.
pappso_double getRtInSeconds() const
Get the retention time in seconds.
void setEmptyMassSpectrum(bool is_empty_mass_spectrum)
interface to collect spectrums from the MsRunReader class
virtual bool needPeakList() const =0
tells if we need the peak list (if we want the binary data) for each spectrum
virtual bool needMsLevelPeakList(unsigned int ms_level) const final
tells if we need the peak list (if we want the binary data) for each spectrum, given an MS level
A simple container of DataPoint instances.
Definition trace.h:152
simple override of the raw QCborStreamReader This adds convenient functions to put CBOR data into C++...
const std::vector< qint64 > & getSpectrumIndexPositionInFile() const
virtual void readCbor(QFile *cborp, pappso::UiMonitorInterface &monitor) override
read mzCBOR file
const std::map< QString, std::size_t > & getNativeId2SpectrumIndexMap() const
const std::vector< std::vector< qint64 > > & getRunAndSpectrumTotalIonCountList() const
virtual void close()
convenient function to clean pointer before leaving
const std::vector< std::vector< std::uint8_t > > & getRunAndSpectrumMsLevelList() const
const std::vector< std::vector< qint64 > > & getRunAndSpectrumOffsetList() const
const std::vector< std::vector< QString > > & getRunAndSpectrumIdList() const
const std::vector< QString > & getRunIdList() const
const std::vector< std::vector< double > > & getRunAndSpectrumRtList() const
virtual void readCbor(QFile *cborp, pappso::UiMonitorInterface &monitor)
read mzCBOR file
virtual void close()
convenient function to clean pointer before leaving
void setNativeId2SpectrumIndexMapPtr(const std::map< QString, std::size_t > *nativeId2SpectrumIndexMap)
read mzcbor to build an index
read mzcbor index file
MSrun file reader for mzcbor.
read mzcbor for spectrum collection handler
tries to keep as much as possible monoisotopes, removing any possible C13 peaks and changes multichar...
Definition aa.cpp:39
std::shared_ptr< const MsRunId > MsRunIdCstSPtr
Definition msrunid.h:46
std::shared_ptr< const MassSpectrum > MassSpectrumCstSPtr
@ IsolationWindowTargetMz
Isolation m/z value isolation window target m/z (thomson).
@ IsolationWindowUpperOffset
isolation window upper offset (thomson)
@ IsolationWindowLowerOffset
isolation window lower offset (thomson)
const PrecisionBase * PrecisionPtr
Definition precision.h:122
std::shared_ptr< MassSpectrum > MassSpectrumSPtr
std::shared_ptr< XicCoord > XicCoordSPtr
Definition xiccoord.h:44
double rtTarget
the targeted retention time to extract around intended in seconds, and related to one msrun....
Definition xiccoord.h:131
MzRange mzRange
the mass to extract
Definition xiccoord.h:125
std::vector< Precursor > precursorList
Definition spectrum.h:89
void fromCbor(CborStreamReader &reader, bool want_binary_data)
fill the structure reading data from a CBOR stream
Definition spectrum.cpp:43
void decodeTrace(pappso::Trace &trace) const
Definition spectrum.cpp:356
std::vector< BinaryDataArray > binaryDataArrayList
Definition spectrum.h:90