libpappsomspp
Library for mass spectrometry
Loading...
Searching...
No Matches
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
36#include <QDataStream>
37
39
42
43
44namespace pappso
45{
46
47// Forward declaration.
48class MassSpectrum;
49
50PMSPP_LIB_DECL QDataStream &operator<<(QDataStream &out, const MassSpectrum &spectrum);
51PMSPP_LIB_DECL QDataStream &operator>>(QDataStream &out, MassSpectrum &spectrum);
52
53typedef std::shared_ptr<MassSpectrum> MassSpectrumSPtr;
54typedef std::shared_ptr<const MassSpectrum> MassSpectrumCstSPtr;
55
56class MassSpectrumCombinerInterface;
57
58
59//! Class to represent a mass spectrum.
60/*!
61 * A mass spectrum is a collection of DataPoint instances. Moreover, it has
62 * internal data that represent the context of the acquisition of the data:
63 * retention time and drift time (if the experiment was an ion mobility mass
64 * spectrometry experiment).
65 *
66 * A MassSpectrum cannot perform combinations. For combination of mass
67 * spectra, the class to use is MassSpectrumCombinator.
68 */
70{
71
72 public:
74 MassSpectrum(std::vector<std::pair<pappso_double, pappso_double>> &data_point_vector);
75 MassSpectrum(std::vector<DataPoint> &data_point_vector);
76
77 MassSpectrum(const MapTrace &other);
78 MassSpectrum(const Trace &other);
79 MassSpectrum(Trace &&other); // move constructor
80
81 MassSpectrum(const MassSpectrum &other);
82 MassSpectrum(MassSpectrum &&other); // move constructor
83
84 virtual ~MassSpectrum();
85
86 virtual MassSpectrum &operator=(const MassSpectrum &other);
87 virtual MassSpectrum &operator=(MassSpectrum &&other);
88
89 using Trace::operator=;
90
93
94 /** @brief apply a filter on this MassSpectrum
95 * @param filter to process the MassSpectrum
96 * @return reference on the modified MassSpectrum
97 */
99
101 // Alias for totalIonCurrent().
102 pappso_double tic() const;
103 pappso_double tic(double mzStart, double mzEnd);
104
105 const DataPoint &maxIntensityDataPoint() const;
106
107 const DataPoint &minIntensityDataPoint() const;
108
109 void sortMz();
110
111 bool equals(const MassSpectrum &other, PrecisionPtr precision) const;
112
113 MassSpectrum filterSum(const MzRange &mass_range) const;
114
115
116 // friend QDataStream& operator<<(QDataStream& out, const MassSpectrum&
117 // massSpectrum);
118 // friend QDataStream& operator>>(QDataStream& out, MassSpectrum&
119 // massSpectrum);
120
121 void debugPrintValues() const;
122};
123
124
125} // namespace pappso
126
127
130
131extern int massSpectrumMetaTypeId;
generic interface to apply a filter on a MassSpectrum This is the same as FilterInterface,...
Class to represent a mass spectrum.
void sortMz()
Sort the DataPoint instances of this spectrum.
void debugPrintValues() const
MassSpectrumCstSPtr makeMassSpectrumCstSPtr() const
bool equals(const MassSpectrum &other, PrecisionPtr precision) const
Tells if this MassSpectrum is equal to massSpectrum.
MassSpectrumSPtr makeMassSpectrumSPtr() const
pappso_double tic() const
Compute the total ion current of this mass spectrum.
const DataPoint & minIntensityDataPoint() const
Find the DataPoint instance having the smallest intensity (y) value.
virtual MassSpectrum & massSpectrumFilter(const MassSpectrumFilterInterface &filter) final
apply a filter on this MassSpectrum
MassSpectrum filterSum(const MzRange &mass_range) const
virtual MassSpectrum & operator=(const MassSpectrum &other)
pappso_double totalIonCurrent() const
Compute the total ion current of this mass spectrum.
const DataPoint & maxIntensityDataPoint() const
Find the DataPoint instance having the greatest intensity (y) value.
virtual Trace & filter(const FilterInterface &filter) final
apply a filter on this trace
Definition trace.cpp:1185
#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:60
std::shared_ptr< const MassSpectrum > MassSpectrumCstSPtr
const PrecisionBase * PrecisionPtr
Definition precision.h:122
std::shared_ptr< MassSpectrum > MassSpectrumSPtr