libpappsomspp
Library for mass spectrometry
Loading...
Searching...
No Matches
spectrumcollectionhandlerinterface.h
Go to the documentation of this file.
1/**
2 * \file pappsomspp/core/msrun/spectrumcollectionhandlerinterface.h
3 * \date 29/05/2018
4 * \author Olivier Langella
5 * \brief base interface to read MSrun files
6 */
7
8/*******************************************************************************
9 * Copyright (c) 2018 Olivier Langella <Olivier.Langella@u-psud.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#pragma once
29
30
31/////////////////////// StdLib includes
32#include <map>
33
34
35/////////////////////// Qt includes
36#include <QMutex>
37
38
39/////////////////////// pappsomspp includes
40// #include "pappsomspp/core/trace/maptrace.h"
41
42/////////////////////// Local includes
45
46namespace pappso
47{
48
49/** @brief interface to collect spectrums from the MsRunReader class
50 */
52{
53 public:
54 virtual void setQualifiedMassSpectrum(const QualifiedMassSpectrum &spectrum) = 0;
55
56 /** @brief tells if we need the peak list (if we want the binary data) for
57 * each spectrum
58 */
59 virtual bool needPeakList() const = 0;
60
61 /** @brief tells if we need the peak list (if we want the binary data) for
62 * each spectrum, given an MS level
63 */
64 virtual bool needMsLevelPeakList(unsigned int ms_level) const final;
65
66 /** @brief tells if we need the peak list given
67 */
68 virtual void setNeedMsLevelPeakList(unsigned int ms_level, bool want_peak_list) final;
69 virtual bool shouldStop();
70 virtual void loadingEnded();
71 virtual void spectrumListHasSize(std::size_t size);
72
73
74 /** @brief use threads to read a spectrum by batch of batch_size
75 * @param is_read_ahead boolean to use threads or not
76 */
77 virtual void setReadAhead(bool is_read_ahead) final;
78
79 /** @brief tells if we want to read ahead spectrum
80 */
81 virtual bool isReadAhead() const;
82
83 private:
84 bool m_isReadAhead = false;
85
86 std::vector<bool> m_needPeakListByMsLevel = {
87 true, true, true, true, true, true, true, true, true, true, true, true, true, true, true};
88};
89
90
91/** @brief example of interface to count MS levels of all spectrum in an MSrun
92 */
94{
95 private:
96 std::vector<unsigned long> m_countMsLevelSpectrum;
97
98 public:
99 virtual void setQualifiedMassSpectrum(const QualifiedMassSpectrum &spectrum) override;
100 virtual bool needPeakList() const override;
101 virtual void loadingEnded() override;
102
103 unsigned long getMsLevelCount(unsigned int ms_level) const;
104
105 unsigned long getTotalCount() const;
106};
107
108/** @brief provides a multimap to find quickly spectrum index from scan number
109 */
111{
112 private:
113 std::multimap<std::size_t, std::size_t> m_mmap_scan2index;
114
115 public:
118 virtual void setQualifiedMassSpectrum(const QualifiedMassSpectrum &spectrum) override;
119 virtual bool needPeakList() const override;
120
121 std::size_t getSpectrumIndexFromScanNumber(std::size_t scan_number) const;
122};
123
124
125/** @brief collect retention times along MS run */
127{
128 private:
129 std::vector<double> m_retention_time_list;
130
131 public:
134 virtual void setQualifiedMassSpectrum(const QualifiedMassSpectrum &spectrum) override;
135 virtual bool needPeakList() const override;
136
137 const std::vector<double> &getRetentionTimeLine() const;
138};
139
140
141/** @brief calculate a TIC chromatogram */
143{
144 public:
147 virtual void
148 setQualifiedMassSpectrum(const QualifiedMassSpectrum &qualified_mass_spectrum) override;
149 virtual bool needPeakList() const override;
150
152
153 private:
154 // MapTrace m_ticChromMapTrace;
156};
157
158
159/** @brief Load all qualified spectrum into a vector */
161{
162 public:
165 virtual void
166 setQualifiedMassSpectrum(const QualifiedMassSpectrum &qualified_mass_spectrum) override;
167 virtual bool needPeakList() const override;
168 virtual void spectrumListHasSize(std::size_t size) override;
169
170 const std::vector<QualifiedMassSpectrum> &getQualifiedMassSpectrumList() const;
171
172 void clear();
173
174 private:
175 std::vector<QualifiedMassSpectrum> m_qualifiedSpectrumList;
176};
177
178} // namespace pappso
const std::vector< QualifiedMassSpectrum > & getQualifiedMassSpectrumList() const
virtual void spectrumListHasSize(std::size_t size) override
virtual bool needPeakList() const override
tells if we need the peak list (if we want the binary data) for each spectrum
virtual void setQualifiedMassSpectrum(const QualifiedMassSpectrum &qualified_mass_spectrum) override
std::vector< QualifiedMassSpectrum > m_qualifiedSpectrumList
const std::vector< double > & getRetentionTimeLine() const
virtual void setQualifiedMassSpectrum(const QualifiedMassSpectrum &spectrum) override
virtual bool needPeakList() const override
tells if we need the peak list (if we want the binary data) for each spectrum
virtual bool needPeakList() const override
tells if we need the peak list (if we want the binary data) for each spectrum
virtual void setQualifiedMassSpectrum(const QualifiedMassSpectrum &spectrum) override
std::size_t getSpectrumIndexFromScanNumber(std::size_t scan_number) const
std::multimap< std::size_t, std::size_t > m_mmap_scan2index
virtual void setQualifiedMassSpectrum(const QualifiedMassSpectrum &qualified_mass_spectrum) override
virtual bool needPeakList() const override
tells if we need the peak list (if we want the binary data) for each spectrum
example of interface to count MS levels of all spectrum in an MSrun
virtual void setQualifiedMassSpectrum(const QualifiedMassSpectrum &spectrum) override
std::vector< unsigned long > m_countMsLevelSpectrum
virtual bool needPeakList() const override
tells if we need the peak list (if we want the binary data) for each spectrum
unsigned long getMsLevelCount(unsigned int ms_level) const
Class representing a fully specified mass spectrum.
interface to collect spectrums from the MsRunReader class
virtual bool isReadAhead() const
tells if we want to read ahead spectrum
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
virtual void setReadAhead(bool is_read_ahead) final
use threads to read a spectrum by batch of batch_size
virtual void setNeedMsLevelPeakList(unsigned int ms_level, bool want_peak_list) final
tells if we need the peak list given
virtual void setQualifiedMassSpectrum(const QualifiedMassSpectrum &spectrum)=0
A simple container of DataPoint instances.
Definition trace.h:152
#define PMSPP_LIB_DECL
tries to keep as much as possible monoisotopes, removing any possible C13 peaks and changes multichar...
Definition aa.cpp:39