libpappsomspp
Library for mass spectrometry
massspectraceplotwidget.h
Go to the documentation of this file.
1 /* This code comes right from the msXpertSuite software project.
2  *
3  * msXpertSuite - mass spectrometry software suite
4  * -----------------------------------------------
5  * Copyright(C) 2009,...,2018 Filippo Rusconi
6  *
7  * http://www.msxpertsuite.org
8  *
9  * This program is free software: you can redistribute it and/or modify
10  * it under the terms of the GNU General Public License as published by
11  * the Free Software Foundation, either version 3 of the License, or
12  * (at your option) any later version.
13  *
14  * This program is distributed in the hope that it will be useful,
15  * but WITHOUT ANY WARRANTY; without even the implied warranty of
16  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17  * GNU General Public License for more details.
18  *
19  * You should have received a copy of the GNU General Public License
20  * along with this program. If not, see <http://www.gnu.org/licenses/>.
21  *
22  * END software license
23  */
24 
25 
26 #pragma once
27 
28 /////////////////////// StdLib includes
29 
30 
31 /////////////////////// Qt includes
32 #include <QObject>
33 #include <QString>
34 #include <QWidget>
35 #include <QBrush>
36 #include <QColor>
37 #include <QVector>
38 
39 
40 /////////////////////// QCustomPlot
41 #include <qcustomplot.h>
42 
43 
44 /////////////////////// pappsomspp includes
45 
46 
47 /////////////////////// Local includes
48 #include "../../exportinmportconfig.h"
49 #include "basetraceplotwidget.h"
50 
51 
52 namespace pappso
53 {
54 
55 
57 {
59 
60  int lastZ = -1;
61  double lastMz = std::numeric_limits<double>::min();
62  double lastTicIntensity = std::numeric_limits<double>::min();
63  double lastMr = std::numeric_limits<double>::min();
64  double lastResolvingPower = std::numeric_limits<double>::min();
65 
66  QString toString() const;
67 };
68 
69 
71 {
72  Q_OBJECT
73 
74  public:
75  explicit MassSpecTracePlotWidget(QWidget *parent = 0);
76  explicit MassSpecTracePlotWidget(QWidget *parent,
77  const QString &x_axis_label,
78  const QString &y_axis_label);
79 
80  virtual ~MassSpecTracePlotWidget();
81 
82  /******* Mass spectrum-specific calculations *******/
83  /******* Mass spectrum-specific calculations *******/
84  void setChargeMinimalFractionalPart(double charge_fractional_part);
85  double getChargeMinimalFractionalPart() const;
86 
87  void setChargeStateEnvelopePeakSpan(int interval);
88  int getChargeStateEnvelopePeakSpan() const;
89 
90  bool deconvolute();
91  bool deconvoluteIsotopicCluster();
92  bool deconvoluteChargedState(int span = 1);
93  bool computeResolvingPower();
94  /******* Mass spectrum-specific calculations *******/
95 
96 
97  /******* Mouse and keyboard event handlers *******/
98  /******* Mouse and keyboard event handlers *******/
99  virtual void keyPressEvent(QKeyEvent *event) override;
100  virtual void keyReleaseEvent(QKeyEvent *event) override;
101 
102  virtual void mouseMoveHandler(QMouseEvent *event) override;
103 
104  virtual void mousePressHandler(QMouseEvent *event) override;
105  virtual void mouseReleaseHandler(QMouseEvent *event) override;
106 
107  virtual void mouseMoveHandlerNotDraggingCursor() override;
108  virtual void mouseMoveHandlerDraggingCursor() override;
109  /******* Mouse and keyboard event handlers *******/
110 
111  const MassSpecTracePlotContext &refreshBaseContext() const;
112 
113  signals:
114 
115  // Here we have signals that are specific of the mass spectrum-oriented
116  // version of the plot widget.
117 
118  void keyPressEventSignal(const MassSpecTracePlotContext &context);
119 
120  void massDeconvolutionSignal(const MassSpecTracePlotContext &context);
121  void resolvingPowerComputationSignal(const MassSpecTracePlotContext &context);
122 
123  void mouseReleaseEventSignal(const MassSpecTracePlotContext &context);
124 
125  void newKeyPressEventSignal(pappso::DataPoint context);
126  void testKeyPressEventSignal(pappso::MassSpecTracePlotContext context);
127 
128 
129  protected:
131 
132  // This value is the tolerance on the fractional part of the charge value that
133  // is computed by the deconvolution. If the z value that is deconvoluted is,
134  // for example, 2.980, and m_chargeFractionalPartTolerance = 0.990, then no z
135  // value will be displayed: we are not reaching an integer near enough for the
136  // z value to be considered valid.
137  double m_chargeMinimalFractionalPart = 0.990;
138 
139  // When performing deconvolutions based on the distance between peaks belong
140  // to the same charge state envelope, this value indicates the distance
141  // between the peaks that are used for the calculation. When the peaks are
142  // consecutive, the distance is 1. If there is one peak in between, the
143  // distance is 2.
144  int m_chargeStateEnvelopePeakSpan = 1;
145 };
146 
147 
148 } // namespace pappso
149 
150 
153 
Q_DECLARE_METATYPE
Q_DECLARE_METATYPE(pappso::MassSpecTracePlotContext)
pappso::BaseTracePlotWidget
Definition: basetraceplotwidget.h:59
PMSPP_LIB_DECL
#define PMSPP_LIB_DECL
Definition: exportinmportconfig.h:14
pappso
Definition: aa.cpp:38
basetraceplotwidget.h
pappso::DataPoint
Definition: datapoint.h:20
pappso::BasePlotContext
Definition: baseplotwidget.h:69
pappso::MassSpecTracePlotWidget
Definition: massspectraceplotwidget.h:70
pappso::MassSpecTracePlotContext
Definition: massspectraceplotwidget.h:56
pappso::MassSpecTracePlotContext::baseContext
BasePlotContext baseContext
Definition: massspectraceplotwidget.h:58
pappso::MassSpecTracePlotWidget::m_context
MassSpecTracePlotContext m_context
Definition: massspectraceplotwidget.h:130
massSpecTracePlotContextMetaTypeId
int massSpecTracePlotContextMetaTypeId
Definition: massspectraceplotwidget.cpp:43
massSpecTracePlotContextPtrMetaTypeId
int massSpecTracePlotContextPtrMetaTypeId
Definition: massspectraceplotwidget.cpp:47