libpappsomspp
Library for mass spectrometry
qcpspectrum.h
Go to the documentation of this file.
1/**
2 * \file pappsomspp/widget/spectrumwidget/qcpspectrum.h
3 * \date 31/12/2017
4 * \author Olivier Langella
5 * \brief Custom plot derivative to plot a spectrum
6 */
7
8
9/*******************************************************************************
10 * Copyright (c) 2017 Olivier Langella <Olivier.Langella@u-psud.fr>.
11 *
12 * This file is part of the PAPPSOms++ library.
13 *
14 * PAPPSOms++ is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU General Public License as published by
16 * the Free Software Foundation, either version 3 of the License, or
17 * (at your option) any later version.
18 *
19 * PAPPSOms++ is distributed in the hope that it will be useful,
20 * but WITHOUT ANY WARRANTY; without even the implied warranty of
21 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22 * GNU General Public License for more details.
23 *
24 * You should have received a copy of the GNU General Public License
25 * along with PAPPSOms++. If not, see <http://www.gnu.org/licenses/>.
26 *
27 * Contributors:
28 * Olivier Langella <Olivier.Langella@u-psud.fr> - initial API and
29 *implementation
30 ******************************************************************************/
31
32
33#pragma once
34
35
36#include <qcustomplot.h>
37#include "../../psm/peakionisotopematch.h"
38#include "../../types.h"
39
40namespace pappso
41{
42
43class MassSpectrumWidget;
44
45class QCPSpectrum : public QCustomPlot
46{
47 Q_OBJECT
48 protected:
49 friend class MassSpectrumWidget;
50 QCPSpectrum(MassSpectrumWidget *parent, bool visible);
52
53 protected:
54 void clearData();
55 void rescale();
56 void setSpectrumP(const MassSpectrum *spectrum);
57 void addMassDelta(const PeakIonIsotopeMatch &peak_ion_match);
58 void
59 addMs1IsotopePattern(const std::vector<pappso::PeptideNaturalIsotopeAverageSp>
60 &isotope_mass_list,
61 pappso_double intensity);
62 void addPeakIonIsotopeMatch(const PeakIonIsotopeMatch &peak_ion_match);
63 void highlightPrecursorPeaks(double precursor_mz,
64 int charge,
65 PrecisionPtr ms2_precision);
66 virtual void mouseMoveEvent(QMouseEvent *event) override;
67 virtual void mousePressEvent(QMouseEvent *event) override;
68 virtual void mouseReleaseEvent(QMouseEvent *event) override;
69 virtual void keyPressEvent(QKeyEvent *event) override;
70 virtual void keyReleaseEvent(QKeyEvent *event) override;
71
72 private:
74 pappso_double mouse_mz_range) const;
76 pappso_double mouse_mz_range) const;
77
78 private:
79 Q_SLOT void setMzRangeChanged(QCPRange range);
80
81 private:
83 const MassSpectrum *_p_spectrum = nullptr;
84 QCPRange _mz_range;
87 QCPBars *_p_peak_bars;
90 std::map<PeptideIon, QCPBars *> _map_ion_type_bars;
91 QCPAxisRect *_p_delta_axis_rect;
92 QCPGraph *_p_delta_graph;
93 double _bar_width = 0.5;
94 bool _click = false;
95 bool _control_key = false;
98};
99
100
101} // namespace pappso
Class to represent a mass spectrum.
Definition: massspectrum.h:71
QCPGraph * _p_delta_graph
Definition: qcpspectrum.h:92
void highlightPrecursorPeaks(double precursor_mz, int charge, PrecisionPtr ms2_precision)
virtual void keyPressEvent(QKeyEvent *event) override
QCPAxisRect * _p_delta_axis_rect
Definition: qcpspectrum.h:91
QCPBars * _p_peak_bars
Definition: qcpspectrum.h:87
MassSpectrumWidget * _parent
Definition: qcpspectrum.h:82
QCPRange _mass_delta_range
Definition: qcpspectrum.h:86
void addPeakIonIsotopeMatch(const PeakIonIsotopeMatch &peak_ion_match)
QCPSpectrum(MassSpectrumWidget *parent, bool visible)
Definition: qcpspectrum.cpp:37
virtual void mouseReleaseEvent(QMouseEvent *event) override
QCPRange _intensity_range
Definition: qcpspectrum.h:85
void addMassDelta(const PeakIonIsotopeMatch &peak_ion_match)
void getNearestPeakBetween(pappso_double mz, pappso_double mouse_mz_range) const
virtual void mouseMoveEvent(QMouseEvent *event) override
pappso::pappso_double _old_x
Definition: qcpspectrum.h:96
void getMostIntensePeakBetween(pappso_double mz, pappso_double mouse_mz_range) const
QCPBars * mp_peak_bars_precursor
Definition: qcpspectrum.h:89
void setSpectrumP(const MassSpectrum *spectrum)
void addMs1IsotopePattern(const std::vector< pappso::PeptideNaturalIsotopeAverageSp > &isotope_mass_list, pappso_double intensity)
std::map< PeptideIon, QCPBars * > _map_ion_type_bars
Definition: qcpspectrum.h:90
virtual void keyReleaseEvent(QKeyEvent *event) override
QCPBars * _p_peak_bars_isotope
Definition: qcpspectrum.h:88
const MassSpectrum * _p_spectrum
Definition: qcpspectrum.h:83
virtual void mousePressEvent(QMouseEvent *event) override
Q_SLOT void setMzRangeChanged(QCPRange range)
pappso::pappso_double _old_y
Definition: qcpspectrum.h:97
tries to keep as much as possible monoisotopes, removing any possible C13 peaks and changes multichar...
Definition: aa.cpp:39
double pappso_double
A type definition for doubles.
Definition: types.h:50