libpappsomspp
Library for mass spectrometry
massspectrumwidget.h
Go to the documentation of this file.
1 /**
2  * \file pappsomspp/widget/spectrumwidget/massspectrumwidget.h
3  * \date 22/12/2017
4  * \author Olivier Langella
5  * \brief plot a sectrum and annotate with peptide
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 "../../massspectrum/qualifiedmassspectrum.h"
37 #include "../../peptide/peptide.h"
38 #include "../../peptide/peptidefragmentionlistbase.h"
39 #include "../../peptide/peptidenaturalisotopeaverage.h"
40 #include "../../psm/peptideisotopespectrummatch.h"
41 #include "../graphicdevicewidget.h"
42 #include "qcpspectrum.h"
43 
44 namespace pappso
45 {
46 
47 class PMSPP_LIB_DECL MassSpectrumWidget : public GraphicDeviceWidget
48 {
49  Q_OBJECT
50  public:
51  MassSpectrumWidget(QWidget *parent = 0);
52  ~MassSpectrumWidget();
53 
54  void setQualifiedMassSpectrum(const QualifiedMassSpectrum &spectrum);
55  void setMsLevel(unsigned int ms_level);
56  void setMassSpectrumCstSPtr(const MassSpectrumCstSPtr &spectrum);
57  void setPeptideSp(const PeptideSp &peptide_sp);
58  void plot();
59  void rescale();
60 
61  void setPeptideCharge(unsigned int parent_ion_charge);
62  void setMaximumIsotopeNumber(unsigned int max_isotope_number);
63  void setMaximumIsotopeRank(unsigned int max_isotope_rank);
64  // void setIsolationWindow(PrecisionPtr precision);
65  void setIonList(const std::list<PeptideIon> &ion_list);
66  void setMs1Precision(PrecisionPtr precision);
67  void setMs2Precision(PrecisionPtr precision);
68 
69  bool savePdf(const QString &fileName, int width = 0, int height = 0);
70  void toQPaintDevice(QPaintDevice *device, const QSize &size) override;
71  // void setIsotopeMassList(std::vector<pappso::PeptideNaturalIsotopeAverageSp>
72  // & isotope_mass_list);
73 
74 
75  signals:
76  void mzChanged(double mz) const;
77  void peakChanged(pappso::DataPointCstSPtr peak_match) const;
78  void ionChanged(pappso::PeakIonIsotopeMatchCstSPtr ion) const;
79 
80  protected:
81  friend class QCPSpectrum;
82  void mzChangeEvent(pappso_double mz) const;
83  void peakChangeEvent(const DataPoint *p_peak_match);
84 
85  private:
86  void peptideAnnotate();
87  void setVisibleMassDelta(bool visible);
88  void clearData();
89  void computeIsotopeMassList();
90 
91  private:
92  unsigned int _tag_nmost_intense = 10;
93  unsigned int _max_isotope_number = 0;
94  unsigned int _max_isotope_rank = 1;
95  MassSpectrumCstSPtr _spectrum_sp;
96  PrecisionPtr _p_ms1_precision = PrecisionFactory::getDaltonInstance(0.1);
97  PrecisionPtr _p_ms2_precision = PrecisionFactory::getDaltonInstance(0.5);
98  unsigned int _peptide_charge = 3;
99  unsigned int _ms_level;
100  PeptideSp _peptide_sp;
101  std::list<PeptideIon> _ion_list;
102 
103  std::list<PeakIonIsotopeMatch> _peak_ion_isotope_match_list;
104 
105  /** @brief list of isotope precursors
106  */
107  std::vector<pappso::PeptideNaturalIsotopeAverageSp> _isotope_mass_list;
108 
109  QCPSpectrum *_custom_plot = nullptr;
110  bool _is_visible_mass_delta;
111 
112  const DataPoint *_p_mouse_peak = nullptr;
113 };
114 
115 
116 } // namespace pappso
pappso::pappso_double
double pappso_double
A type definition for doubles.
Definition: types.h:69
pappso::MassSpectrumCstSPtr
std::shared_ptr< const MassSpectrum > MassSpectrumCstSPtr
Definition: massspectrum.h:76
PMSPP_LIB_DECL
#define PMSPP_LIB_DECL
Definition: exportinmportconfig.h:14
pappso::PeakIonIsotopeMatchCstSPtr
std::shared_ptr< const PeakIonIsotopeMatch > PeakIonIsotopeMatchCstSPtr
Definition: peakionisotopematch.h:33
pappso
tries to keep as much as possible monoisotopes, removing any possible C13 peaks and changes multichar...
Definition: aa.cpp:39
pappso::DataPoint
Definition: datapoint.h:21
pappso::QCPSpectrum
Definition: qcpspectrum.h:67
pappso::DataPointCstSPtr
std::shared_ptr< const DataPoint > DataPointCstSPtr
Definition: datapoint.h:16
pappso::PrecisionFactory::getDaltonInstance
static PrecisionPtr getDaltonInstance(pappso_double value)
Definition: precision.cpp:150
qcpspectrum.h
GraphicDeviceWidget
Definition: graphicdevicewidget.h:37
pappso::PrecisionPtr
const PrecisionBase * PrecisionPtr
Definition: precision.h:143
pappso::PrecisionBase
Definition: precision.h:65
pappso::PeptideSp
std::shared_ptr< const Peptide > PeptideSp
Definition: aamodification.h:68