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#include <limits>
36
37#include <QDataStream>
38
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,
52 const MassSpectrum &spectrum);
53PMSPP_LIB_DECL QDataStream &operator>>(QDataStream &out,
54 MassSpectrum &spectrum);
55
56typedef std::shared_ptr<MassSpectrum> MassSpectrumSPtr;
57typedef std::shared_ptr<const MassSpectrum> MassSpectrumCstSPtr;
58
59class MassSpectrumCombinerInterface;
60
61
62//! Class to represent a mass spectrum.
63/*!
64 * A mass spectrum is a collection of DataPoint instances. Moreover, it has
65 * internal data that represent the context of the acquisition of the data:
66 * retention time and drift time (if the experiment was an ion mobility mass
67 * spectrometry experiment).
68 *
69 * A MassSpectrum cannot perform combinations. For combination of mass
70 * spectra, the class to use is MassSpectrumCombinator.
71 */
73{
74
75 public:
78 std::vector<std::pair<pappso_double, pappso_double>> &data_point_vector);
79 MassSpectrum(std::vector<DataPoint> &data_point_vector);
80
81 MassSpectrum(const MapTrace &other);
82 MassSpectrum(const Trace &other);
83 MassSpectrum(Trace &&other); // move constructor
84
85 MassSpectrum(const MassSpectrum &other);
86 MassSpectrum(MassSpectrum &&other); // move constructor
87
88 virtual ~MassSpectrum();
89
90 virtual MassSpectrum &operator=(const MassSpectrum &other);
91 virtual MassSpectrum &operator=(MassSpectrum &&other);
92
93 using Trace::operator=;
94
95 MassSpectrumSPtr makeMassSpectrumSPtr() const;
96 MassSpectrumCstSPtr makeMassSpectrumCstSPtr() const;
97
98 /** @brief apply a filter on this MassSpectrum
99 * @param filter to process the MassSpectrum
100 * @return reference on the modified MassSpectrum
101 */
102 virtual MassSpectrum &
103 massSpectrumFilter(const MassSpectrumFilterInterface &filter) final;
104
105 pappso_double totalIonCurrent() const;
106 // Alias for totalIonCurrent().
107 pappso_double tic() const;
108 pappso_double tic(double mzStart, double mzEnd);
109
110 const DataPoint &maxIntensityDataPoint() const;
111
112 const DataPoint &minIntensityDataPoint() const;
113
114 void sortMz();
115
116 bool equals(const MassSpectrum &other, PrecisionPtr precision) const;
117
118 MassSpectrum filterSum(const MzRange &mass_range) const;
119
120
121 // friend QDataStream& operator<<(QDataStream& out, const MassSpectrum&
122 // massSpectrum);
123 // friend QDataStream& operator>>(QDataStream& out, MassSpectrum&
124 // massSpectrum);
125
126 void debugPrintValues() const;
127};
128
129
130} // namespace pappso
131
132
135
136extern int massSpectrumMetaTypeId;
generic interface to apply a filter on a MassSpectrum This is the same as FilterInterface,...
Class to represent a mass spectrum.
A simple container of DataPoint instances.
Definition trace.h:148
#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:50
std::shared_ptr< const MassSpectrum > MassSpectrumCstSPtr
std::shared_ptr< MassSpectrum > MassSpectrumSPtr