libpappsomspp
Library for mass spectrometry
filterpseudocentroid.cpp
Go to the documentation of this file.
1 /**
2  * \file pappsomspp/filers/filterpseudocentroid.cpp
3  * \date 7/12/2019
4  * \author Olivier Langella
5  * \brief apply a pseudo centroid algorithm on a tims tof spectrum
6  */
7 
8 /*******************************************************************************
9  * Copyright (c) 2019 Olivier Langella <Olivier.Langella@u-psud.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  ******************************************************************************/
27 
28 #include <QDebug>
29 #include "filterpseudocentroid.h"
31 
32 using namespace pappso;
33 
35  double smoothwidth,
36  double integrationWidth,
37  double intensityThreshold,
38  bool area,
39  uint32_t maxnumberofpeaks)
40 {
41 
42  m_resolution = resolution; //!< instrument resolution
43  m_smoothwidth = smoothwidth; //!< smoothwidth
44  m_integrationWidth = integrationWidth; //! integration width
45  m_intensityThreshold = intensityThreshold;
46  m_area = area; //!< do you want to store are or intensity
48  maxnumberofpeaks; //!< max number of peaks returned by picker
49 }
50 
52 {
53  m_resolution = other.m_resolution; //!< instrument resolution
54  m_smoothwidth = other.m_smoothwidth; //!< smoothwidth
55  m_integrationWidth = other.m_integrationWidth; //! integration width
57  m_area = other.m_area; //!< do you want to store are or intensity
59  other.m_maxnumberofpeaks; //!< max number of peaks returned by picker
60 }
61 
63 {
64 }
65 
66 Trace &
68 {
69  /*
70 QTOFPeakPickerFilter(
71  const pwiz::msdata::SpectrumListPtr & inner, //!< spectrum list
72  double resolution, //!< instrument resolution
73  double smoothwidth = 2., //!< smoothwidth
74  double integrationWidth = 4, //! integration width
75  double intensityThreshold = 10.,
76  bool area = true, //!< do you want to store are or intensity
77 uint32_t maxnumberofpeaks = 0 //!< max number of peaks returned by picker
78  )
79  */
80  qDebug();
81 
82  std::pair<double, double> range =
83  std::make_pair(data_points.front().x, data_points.back().x);
84  // construct peak picker
85  qDebug() << "===========================================\n" << m_resolution << range << m_smoothwidth << m_integrationWidth << m_intensityThreshold << m_area << m_maxnumberofpeaks << "\n================================================";
88  range,
92  m_area,
94 
95  std::vector<double> mzs = data_points.xValues();
96  std::vector<double> intensities = data_points.yValues();
97  qDebug() << data_points.xValues().size();
98  qDebug() << data_points.yValues().size();
99  qDebug() << data_points.xValues();
100  qDebug() << data_points.yValues();
101  pp(mzs.begin(), mzs.end(), intensities.begin());
102  qDebug();
103  data_points.clear();
104  qDebug();
105  auto itmz = pp.getPeakMass().begin();
106  auto itint = pp.getPeakArea().begin();
107 
108  qDebug() << pp.getPeakMass().size();
109  while(itmz != pp.getPeakMass().end())
110  {
111  data_points.push_back({*itmz, *itint});
112  itmz++;
113  itint++;
114  }
115 
116  qDebug();
117  return data_points;
118 }
pappso::FilterPseudoCentroid::m_intensityThreshold
double m_intensityThreshold
integration width
Definition: filterpseudocentroid.h:74
pappso::FilterPseudoCentroid::m_resolution
double m_resolution
instrument resolution
Definition: filterpseudocentroid.h:71
pappso::FilterPseudoCentroid
Definition: filterpseudocentroid.h:41
pappso::FilterPseudoCentroid::m_maxnumberofpeaks
uint32_t m_maxnumberofpeaks
max number of peaks returned by picker
Definition: filterpseudocentroid.h:76
pappso::FilterPseudoCentroid::~FilterPseudoCentroid
~FilterPseudoCentroid()
Definition: filterpseudocentroid.cpp:62
pappso
tries to keep as much as possible monoisotopes, removing any possible C13 peaks
Definition: aa.cpp:39
pappso::FilterPseudoCentroid::FilterPseudoCentroid
FilterPseudoCentroid(double resolution, double smoothwidth=2., double integrationWidth=4, double intensityThreshold=10., bool area=true, uint32_t maxnumberofpeaks=0)
Definition: filterpseudocentroid.cpp:34
ralab::base::ms::PeakPicker::getPeakArea
const std::vector< TReal > & getPeakArea()
Definition: peakpickerqtof.hpp:275
pappso::Trace
A simple container of DataPoint instances.
Definition: trace.h:132
ralab::base::ms::PeakPicker
Definition: peakpickerqtof.hpp:159
pappso::FilterPseudoCentroid::filter
Trace & filter(Trace &data_points) const override
Definition: filterpseudocentroid.cpp:67
ralab::base::ms::PeakPicker::getPeakMass
const std::vector< TReal > & getPeakMass()
Definition: peakpickerqtof.hpp:271
pappso::FilterPseudoCentroid::m_smoothwidth
double m_smoothwidth
smoothwidth
Definition: filterpseudocentroid.h:72
pappso::Trace::xValues
std::vector< pappso_double > xValues() const
Definition: trace.cpp:544
filterpseudocentroid.h
pappso::FilterPseudoCentroid::m_integrationWidth
double m_integrationWidth
Definition: filterpseudocentroid.h:73
pappso::Trace::yValues
std::vector< pappso_double > yValues() const
Definition: trace.cpp:558
pappso::FilterPseudoCentroid::m_area
bool m_area
do you want to store are or intensity
Definition: filterpseudocentroid.h:75
peakpickerqtof.hpp