libpappsomspp
Library for mass spectrometry
filterchargedeconvolution.h
Go to the documentation of this file.
1 /**
2  * \file pappsomspp/processing/filters/filterchargedeconvolution.h
3  * \date 30/09/2020
4  * \author Thomas Renne
5  * \brief Sum peaks and transform mz to fit charge = 1
6  */
7 
8 /*******************************************************************************
9  * Copyright (c) 2020 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 #pragma once
29 
30 #include "filternameinterface.h"
31 
32 #include "../../trace/trace.h"
33 
34 /**
35  * @brief tries to keep as much as possible monoisotopes, removing any possible
36  * C13 peaks and changes multicharge peaks to monocharge
37  */
38 
39 namespace pappso
40 {
41 
43 {
44  private:
45  struct DataPointInfo;
46  typedef std::shared_ptr<DataPointInfo> DataPointInfoSp;
48  {
49  // peak charge
50  int z_charge = -1;
51  // datapoint get from the raw data
53  // new data point with new intensity and mz
55  // range of mass possible for z1 peak (~1mz)
56  std::pair<double, double> z1_range;
57  // range of mass possible for z2 peak (~0.5mz)
58  std::pair<double, double> z2_range;
59  // datapointInfo where the mass is in the range
61  // list of datapointinfo with 1mz diff multiple
62  std::vector<FilterChargeDeconvolution::DataPointInfoSp> z1_vect;
63  // list of datapointinfo with 2mz diff multiple
64  std::vector<FilterChargeDeconvolution::DataPointInfoSp> z2_vect;
65  };
66 
67  public:
68  /**
69  * Default constructor
70  */
72 
73 
74  /**
75  * @param strBuildParams string to build the filter
76  * "chargeDeconvolution|0.02dalton"
77  */
78  FilterChargeDeconvolution(const QString &strBuildParams);
79 
80  /**
81  * Copy constructor
82  *
83  * @param other TODO
84  */
86 
87  /**
88  * Destructor
89  */
90  virtual ~FilterChargeDeconvolution();
91 
92  /**
93  * @brief get all the datapoints and remove different isotope and add their
94  * intensity and change to charge = 1 when the charge is known
95  * @return a list of datapoint
96  */
97  Trace &filter(Trace &data_points) const override;
98 
99 
100  QString toString() const override;
101 
102  protected:
103  void buildFilterFromString(const QString &strBuildParams) override;
104 
105  private:
106  /**
107  * @brief Add each datapoint to a vector of structure describe above
108  * @return the vecotr of datapointInfo with their datapoint and their
109  * exclusion mass range
110  */
111  void addDataPointToList(
112  std::vector<FilterChargeDeconvolution::DataPointInfoSp> &points,
113  DataPoint &data_point) const;
114  /**
115  * @brief For eache datapointInfo add the datapoint to the lists by their
116  * exclusion range
117  * @return the vecotr of datapointInfo with their lists of isotopics peaks
118  */
119  void addDataPointRefByExclusion(
120  std::vector<FilterChargeDeconvolution::DataPointInfoSp> &points,
122  /**
123  * @brief Compare both list (z1 and z2) and add the right level of charge
124  * @return the vecotr of datapointInfo with their charge
125  */
126  void computeBestChargeOfDataPoint(
127  std::vector<FilterChargeDeconvolution::DataPointInfoSp> &data_points_info)
128  const;
129  /**
130  * @brief For eache datapointInfo whith no parent copy info in new vector with
131  * the intensity of the monoistipics peaks added
132  * @return the vecotr of datapointInfo with their intensity merged
133  */
134  void computeIsotopeDeconvolution(
135  std::vector<FilterChargeDeconvolution::DataPointInfoSp> &data_points_info)
136  const;
137  /**
138  * @brief For eache datapointInfo with a charge = 2 transform the peak to a
139  * charge = 1 by multiplying the mz by 2 and remove 1 H
140  * @return the vecotr of datapointInfo their z corrected
141  */
142  void transformToMonoChargedForAllDataPoint(
143  std::vector<FilterChargeDeconvolution::DataPointInfoSp> &data_points_info)
144  const;
145 
146  private:
151 };
152 } // namespace pappso
pappso::FilterChargeDeconvolution::DataPointInfo::new_mono_charge_data_point
DataPoint new_mono_charge_data_point
Definition: filterchargedeconvolution.h:54
pappso::FilterChargeDeconvolution::m_diffC12C13_z2
double m_diffC12C13_z2
Definition: filterchargedeconvolution.h:148
pappso::FilterChargeDeconvolution::DataPointInfoSp
std::shared_ptr< DataPointInfo > DataPointInfoSp
Definition: filterchargedeconvolution.h:45
PMSPP_LIB_DECL
#define PMSPP_LIB_DECL
Definition: exportinmportconfig.h:14
filternameinterface.h
pappso
tries to keep as much as possible monoisotopes, removing any possible C13 peaks and changes multichar...
Definition: aa.cpp:39
pappso::FilterChargeDeconvolution::DataPointInfo::z2_vect
std::vector< FilterChargeDeconvolution::DataPointInfoSp > z2_vect
Definition: filterchargedeconvolution.h:64
pappso::DataPoint
Definition: datapoint.h:21
pappso::FilterChargeDeconvolution::DataPointInfo::z1_vect
std::vector< FilterChargeDeconvolution::DataPointInfoSp > z1_vect
Definition: filterchargedeconvolution.h:62
pappso::FilterChargeDeconvolution::m_precisionPtrZ2
PrecisionPtr m_precisionPtrZ2
Definition: filterchargedeconvolution.h:150
pappso::Trace
A simple container of DataPoint instances.
Definition: trace.h:132
pappso::FilterChargeDeconvolution::m_precisionPtrZ1
PrecisionPtr m_precisionPtrZ1
Definition: filterchargedeconvolution.h:149
pappso::FilterChargeDeconvolution::m_diffC12C13_z1
double m_diffC12C13_z1
Definition: filterchargedeconvolution.h:147
pappso::PrecisionBase
Definition: precision.h:44
pappso::FilterChargeDeconvolution::DataPointInfo::z2_range
std::pair< double, double > z2_range
Definition: filterchargedeconvolution.h:58
pappso::FilterChargeDeconvolution::DataPointInfo::data_point
DataPoint data_point
Definition: filterchargedeconvolution.h:52
pappso::FilterChargeDeconvolution::DataPointInfo
Definition: filterchargedeconvolution.h:48
pappso::FilterNameInterface
Interface that allows to build filter objects from strings.
Definition: filternameinterface.h:42
pappso::FilterChargeDeconvolution::DataPointInfo::z1_range
std::pair< double, double > z1_range
Definition: filterchargedeconvolution.h:56
pappso::FilterChargeDeconvolution
Definition: filterchargedeconvolution.h:43