libpappsomspp
Library for mass spectrometry
Loading...
Searching...
No Matches
mzcborprecursorfinder.h
Go to the documentation of this file.
1/**
2 * \file pappsomspp/core/processing/cbor/mzcbor/copyreplace/mzcborprecursorfinder.h
3 * \date 2/10/2026
4 * \author Olivier Langella
5 * \brief read mzcbor stream or file, process it and write processed mzcbor output
6 */
7
8/*******************************************************************************
9 * Copyright (c) 2026 Olivier Langella <Olivier.Langella@cnrs.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
29#pragma once
33#include <cstddef>
34#include <cstdint>
35#include <deque>
36#include <limits>
37#include <qcontainerfwd.h>
38#include <qjsonobject.h>
39#include <vector>
40namespace pappso
41{
42namespace cbor
43{
44namespace mzcbor
45{
46/**
47 * @brief base class to transform mzCBOR stream in a new mzCBOR output stream
48 *
49 * ensures stream read on regular file or any readable device
50 */
52{
53 public:
54 /**
55 * Default constructor
56 */
57 MzcborPrecursorFinder(CborStreamWriter *cbor_output_p, const QJsonObject &json_params);
58
59 /**
60 * Destructor
61 */
62 virtual ~MzcborPrecursorFinder();
63
64 void setRetentionTimeRangeInSeconds(double rt_start, double rt_stop);
65
66
67 protected:
68 virtual void processQcborSpectrum(SpectrumTube &spectrum_tube, QcborSpectrum &cbor_spectrum);
69 std::vector<QcborSpectrum> findPotentialPrecursorIonData(const QcborSpectrum &ms1_spectrum,
70 const QcborSpectrum &ms2_spectrum,
71 const QcborSpectrumPrecursor &precursor);
72
73 private:
74 QJsonValue getParameterValue(const QString &name) const;
75
76 private:
77 QJsonObject m_parameters;
78 std::vector<std::int8_t> m_potentialPrecursorChargeStateList = {1, 2, 3};
79 double m_rtStart = 0;
80 double m_rtStop = std::numeric_limits<double>::max();
81
82 std::map<QString, QString> m_ms1idOldToNew;
83 std::deque<std::pair<QString, QcborSpectrum>> m_spectrumMs1List;
84 std::size_t m_maxSpectrumMs1ListSize = 100;
88 std::size_t m_minimumComplementIon = 1;
89 double m_ms2minimumMz = 150;
90 std::size_t m_ms2nMostIntense = 60;
91
92 std::deque<std::pair<const QcborSpectrum *, TraceSPtr>> m_cacheMs1Trace;
93};
94} // namespace mzcbor
95} // namespace cbor
96} // namespace pappso
overrides QCborStreamWriter base class to provide convenient functions
MzcborCopyReplaceBase(CborStreamWriter *cbor_output_p, const QString &operation)
std::vector< QcborSpectrum > findPotentialPrecursorIonData(const QcborSpectrum &ms1_spectrum, const QcborSpectrum &ms2_spectrum, const QcborSpectrumPrecursor &precursor)
void setRetentionTimeRangeInSeconds(double rt_start, double rt_stop)
virtual void processQcborSpectrum(SpectrumTube &spectrum_tube, QcborSpectrum &cbor_spectrum)
std::deque< std::pair< QString, QcborSpectrum > > m_spectrumMs1List
MzcborPrecursorFinder(CborStreamWriter *cbor_output_p, const QJsonObject &json_params)
std::vector< std::int8_t > m_potentialPrecursorChargeStateList
std::deque< std::pair< const QcborSpectrum *, TraceSPtr > > m_cacheMs1Trace
QJsonValue getParameterValue(const QString &name) const
#define PMSPP_LIB_DECL
tries to keep as much as possible monoisotopes, removing any possible C13 peaks and changes multichar...
Definition aa.cpp:39
const PrecisionBase * PrecisionPtr
Definition precision.h:122
Low level CBOR map to store an mzCBOR Spectrum object.