libpappsomspp
Library for mass spectrometry
Loading...
Searching...
No Matches
spectrumcollectionhandlerinterface.h
Go to the documentation of this file.
1/**
2 * \file pappsomspp/msrun/msrunreader.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
41#include "../trace/maptrace.h"
42
43/////////////////////// Local includes
44#include "msrunid.h"
45#include "../massspectrum/qualifiedmassspectrum.h"
46#include "../msfile/msfilereader.h"
47#include "../exportinmportconfig.h"
48#include "xiccoord/xiccoord.h"
49
50namespace pappso
51{
52
53/** @brief interface to collect spectrums from the MsRunReader class
54 */
56{
57 public:
58 virtual void
60
61 /** @brief tells if we need the peak list (if we want the binary data) for
62 * each spectrum
63 */
64 virtual bool needPeakList() const = 0;
65
66 /** @brief tells if we need the peak list (if we want the binary data) for
67 * each spectrum, given an MS level
68 */
69 virtual bool needMsLevelPeakList(unsigned int ms_level) const final;
70
71 /** @brief tells if we need the peak list given
72 */
73 virtual void setNeedMsLevelPeakList(unsigned int ms_level,
74 bool want_peak_list) final;
75 virtual bool shouldStop();
76 virtual void loadingEnded();
77 virtual void spectrumListHasSize(std::size_t size);
78
79
80 /** @brief use threads to read a spectrum by batch of batch_size
81 * @param is_read_ahead boolean to use threads or not
82 */
83 virtual void setReadAhead(bool is_read_ahead) final;
84
85 /** @brief tells if we want to read ahead spectrum
86 */
87 virtual bool isReadAhead() const;
88
89 private:
90 bool m_isReadAhead = false;
91
92 std::vector<bool> m_needPeakListByMsLevel = {true,
93 true,
94 true,
95 true,
96 true,
97 true,
98 true,
99 true,
100 true,
101 true,
102 true,
103 true,
104 true,
105 true,
106 true};
107};
108
109
110/** @brief example of interface to count MS levels of all spectrum in an MSrun
111 */
114{
115 private:
116 std::vector<unsigned long> m_countMsLevelSpectrum;
117
118 public:
119 virtual void
120 setQualifiedMassSpectrum(const QualifiedMassSpectrum &spectrum) override;
121 virtual bool needPeakList() const override;
122 virtual void loadingEnded() override;
123
124 unsigned long getMsLevelCount(unsigned int ms_level) const;
125
126 unsigned long getTotalCount() const;
127};
128
129/** @brief provides a multimap to find quickly spectrum index from scan number
130 */
133{
134 private:
135 std::multimap<std::size_t, std::size_t> m_mmap_scan2index;
136
137 public:
140 virtual void
141 setQualifiedMassSpectrum(const QualifiedMassSpectrum &spectrum) override;
142 virtual bool needPeakList() const override;
143
144 std::size_t getSpectrumIndexFromScanNumber(std::size_t scan_number) const;
145};
146
147
148/** @brief collect retention times along MS run */
151{
152 private:
153 std::vector<double> m_retention_time_list;
154
155 public:
158 virtual void
159 setQualifiedMassSpectrum(const QualifiedMassSpectrum &spectrum) override;
160 virtual bool needPeakList() const override;
161
162 const std::vector<double> &getRetentionTimeLine() const;
163};
164
165
166/** @brief calculate a TIC chromatogram */
169{
170 public:
173 virtual void setQualifiedMassSpectrum(
174 const QualifiedMassSpectrum &qualified_mass_spectrum) override;
175 virtual bool needPeakList() const override;
176
177 Trace getTicChromatogram() const;
178
179 private:
181};
182
183
184/** @brief Load all qualified spectrum into a vector */
187{
188 public:
191 virtual void setQualifiedMassSpectrum(
192 const QualifiedMassSpectrum &qualified_mass_spectrum) override;
193 virtual bool needPeakList() const override;
194 virtual void spectrumListHasSize(std::size_t size) override;
195
196 const std::vector<QualifiedMassSpectrum> &
197 getQualifiedMassSpectrumList() const;
198
199 void clear();
200
201 private:
202 std::vector<QualifiedMassSpectrum> m_qualifiedSpectrumList;
203};
204
205} // namespace pappso
Load all qualified spectrum into a vector.
std::vector< QualifiedMassSpectrum > m_qualifiedSpectrumList
provides a multimap to find quickly spectrum index from scan number
std::multimap< std::size_t, std::size_t > m_mmap_scan2index
example of interface to count MS levels of all spectrum in an MSrun
std::vector< unsigned long > m_countMsLevelSpectrum
Class representing a fully specified 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 void setQualifiedMassSpectrum(const QualifiedMassSpectrum &spectrum)=0
A simple container of DataPoint instances.
Definition trace.h:148
#define PMSPP_LIB_DECL
tries to keep as much as possible monoisotopes, removing any possible C13 peaks and changes multichar...
Definition aa.cpp:39
XIC coordinate in MSrun.