libpappsomspp
Library for mass spectrometry
massspectrum.h
Go to the documentation of this file.
1/**
2 * \file pappsomspp/massspectrum/massspectrum.h
3 * \date 15/3/2015
4 * \author Olivier Langella
5 * \brief basic mass spectrum
6 */
7
8/*******************************************************************************
9 * Copyright (c) 2015 Olivier Langella <Olivier.Langella@moulon.inra.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 * Contributors:
27 * Olivier Langella <Olivier.Langella@moulon.inra.fr> - initial API and
28 *implementation
29 ******************************************************************************/
30
31#pragma once
32
33#include <vector>
34#include <memory>
35#include <limits>
36
37#include <QDataStream>
38
39#include "../exportinmportconfig.h"
40
41#include "../mzrange.h"
42#include "../trace/trace.h"
43
44
45namespace pappso
46{
47
48// Forward declaration.
49class MassSpectrum;
50
51PMSPP_LIB_DECL QDataStream &operator<<(QDataStream &out, const MassSpectrum &spectrum);
52PMSPP_LIB_DECL QDataStream &operator>>(QDataStream &out, MassSpectrum &spectrum);
53
54typedef std::shared_ptr<MassSpectrum> MassSpectrumSPtr;
55typedef std::shared_ptr<const MassSpectrum> MassSpectrumCstSPtr;
56
57class MassSpectrumCombinerInterface;
58
59
60//! Class to represent a mass spectrum.
61/*!
62 * A mass spectrum is a collection of DataPoint instances. Moreover, it has
63 * internal data that represent the context of the acquisition of the data:
64 * retention time and drift time (if the experiment was an ion mobility mass
65 * spectrometry experiment).
66 *
67 * A MassSpectrum cannot perform combinations. For combination of mass
68 * spectra, the class to use is MassSpectrumCombinator.
69 */
71{
72
73 public:
76 std::vector<std::pair<pappso_double, pappso_double>> &data_point_vector);
77 MassSpectrum(std::vector<DataPoint> &data_point_vector);
78
79 MassSpectrum(const MapTrace &other);
80 MassSpectrum(const Trace &other);
81 MassSpectrum(Trace &&other); // move constructor
82
83 MassSpectrum(const MassSpectrum &other);
84 MassSpectrum(MassSpectrum &&other); // move constructor
85
86 virtual ~MassSpectrum();
87
88 virtual MassSpectrum &operator=(const MassSpectrum &other);
89 virtual MassSpectrum &operator=(MassSpectrum &&other);
90
91 MassSpectrumSPtr makeMassSpectrumSPtr() const;
92 MassSpectrumCstSPtr makeMassSpectrumCstSPtr() const;
93
94 /** @brief apply a filter on this MassSpectrum
95 * @param filter to process the MassSpectrum
96 * @return reference on the modified MassSpectrum
97 */
98 virtual MassSpectrum &
99 massSpectrumFilter(const MassSpectrumFilterInterface &filter) final;
100
101 pappso_double totalIonCurrent() const;
102 // Alias for totalIonCurrent().
103 pappso_double tic() const;
104 pappso_double tic(double mzStart, double mzEnd);
105
106 const DataPoint &maxIntensityDataPoint() const;
107
108 const DataPoint &minIntensityDataPoint() const;
109
110 void sortMz();
111
112 bool equals(const MassSpectrum &other, PrecisionPtr precision) const;
113
114 MassSpectrum filterSum(const MzRange &mass_range) const;
115
116
117 // friend QDataStream& operator<<(QDataStream& out, const MassSpectrum&
118 // massSpectrum);
119 // friend QDataStream& operator>>(QDataStream& out, MassSpectrum&
120 // massSpectrum);
121
122 void debugPrintValues() const;
123};
124
125
126} // namespace pappso
127
128
131
132extern int massSpectrumMetaTypeId;
134
generic interface to apply a filter on a MassSpectrum This is the same as FilterInterface,...
Class to represent a mass spectrum.
Definition: massspectrum.h:71
A simple container of DataPoint instances.
Definition: trace.h:38
#define PMSPP_LIB_DECL
int massSpectrumPtrMetaTypeId
int massSpectrumMetaTypeId
Q_DECLARE_METATYPE(pappso::MassSpectrum)
tries to keep as much as possible monoisotopes, removing any possible C13 peaks and changes multichar...
Definition: aa.cpp:39
QDataStream & operator<<(QDataStream &outstream, const MassSpectrum &massSpectrum)
QDataStream & operator>>(QDataStream &instream, MassSpectrum &massSpectrum)
double pappso_double
A type definition for doubles.
Definition: types.h:49
std::shared_ptr< const MassSpectrum > MassSpectrumCstSPtr
Definition: massspectrum.h:55
std::shared_ptr< MassSpectrum > MassSpectrumSPtr
Definition: massspectrum.h:54