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 <memory>
33#include <map>
34
35
36/////////////////////// Qt includes
37#include <QMutex>
38
39
40/////////////////////// pappsomspp includes
42
43/////////////////////// Local includes
44#include "msrunid.h"
49
50namespace pappso
51{
52
53/** @brief interface to collect spectrums from the MsRunReader class
54 */
56{
57 public:
58 virtual void setQualifiedMassSpectrum(const QualifiedMassSpectrum &spectrum) = 0;
59
60 /** @brief tells if we need the peak list (if we want the binary data) for
61 * each spectrum
62 */
63 virtual bool needPeakList() const = 0;
64
65 /** @brief tells if we need the peak list (if we want the binary data) for
66 * each spectrum, given an MS level
67 */
68 virtual bool needMsLevelPeakList(unsigned int ms_level) const final;
69
70 /** @brief tells if we need the peak list given
71 */
72 virtual void setNeedMsLevelPeakList(unsigned int ms_level, bool want_peak_list) final;
73 virtual bool shouldStop();
74 virtual void loadingEnded();
75 virtual void spectrumListHasSize(std::size_t size);
76
77
78 /** @brief use threads to read a spectrum by batch of batch_size
79 * @param is_read_ahead boolean to use threads or not
80 */
81 virtual void setReadAhead(bool is_read_ahead) final;
82
83 /** @brief tells if we want to read ahead spectrum
84 */
85 virtual bool isReadAhead() const;
86
87 private:
88 bool m_isReadAhead = false;
89
90 std::vector<bool> m_needPeakListByMsLevel = {
91 true, true, true, true, true, true, true, true, true, true, true, true, true, true, true};
92};
93
94
95/** @brief example of interface to count MS levels of all spectrum in an MSrun
96 */
98{
99 private:
100 std::vector<unsigned long> m_countMsLevelSpectrum;
101
102 public:
103 virtual void setQualifiedMassSpectrum(const QualifiedMassSpectrum &spectrum) override;
104 virtual bool needPeakList() const override;
105 virtual void loadingEnded() override;
106
107 unsigned long getMsLevelCount(unsigned int ms_level) const;
108
109 unsigned long getTotalCount() const;
110};
111
112/** @brief provides a multimap to find quickly spectrum index from scan number
113 */
115{
116 private:
117 std::multimap<std::size_t, std::size_t> m_mmap_scan2index;
118
119 public:
122 virtual void setQualifiedMassSpectrum(const QualifiedMassSpectrum &spectrum) override;
123 virtual bool needPeakList() const override;
124
125 std::size_t getSpectrumIndexFromScanNumber(std::size_t scan_number) const;
126};
127
128
129/** @brief collect retention times along MS run */
131{
132 private:
133 std::vector<double> m_retention_time_list;
134
135 public:
138 virtual void setQualifiedMassSpectrum(const QualifiedMassSpectrum &spectrum) override;
139 virtual bool needPeakList() const override;
140
141 const std::vector<double> &getRetentionTimeLine() const;
142};
143
144
145/** @brief calculate a TIC chromatogram */
147{
148 public:
151 virtual void
152 setQualifiedMassSpectrum(const QualifiedMassSpectrum &qualified_mass_spectrum) override;
153 virtual bool needPeakList() const override;
154
156
157 private:
159};
160
161
162/** @brief Load all qualified spectrum into a vector */
164{
165 public:
168 virtual void
169 setQualifiedMassSpectrum(const QualifiedMassSpectrum &qualified_mass_spectrum) override;
170 virtual bool needPeakList() const override;
171 virtual void spectrumListHasSize(std::size_t size) override;
172
173 const std::vector<QualifiedMassSpectrum> &getQualifiedMassSpectrumList() const;
174
175 void clear();
176
177 private:
178 std::vector<QualifiedMassSpectrum> m_qualifiedSpectrumList;
179};
180
181} // 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