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 "filterinterface.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  * Copy constructor
75  *
76  * @param other TODO
77  */
79 
80  /**
81  * Destructor
82  */
83  virtual ~FilterChargeDeconvolution();
84 
85  /**
86  * @brief get all the datapoints and remove different isotope and add their
87  * intensity and change to charge = 1 when the charge is known
88  * @return a list of datapoint
89  */
90  Trace &filter(Trace &data_points) const override;
91 
92  private:
93  /**
94  * @brief Add each datapoint to a vector of structure describe above
95  * @return the vecotr of datapointInfo with their datapoint and their
96  * exclusion mass range
97  */
98  void addDataPointToList(
99  std::vector<FilterChargeDeconvolution::DataPointInfoSp> &points,
100  DataPoint &data_point) const;
101  /**
102  * @brief For eache datapointInfo add the datapoint to the lists by their
103  * exclusion range
104  * @return the vecotr of datapointInfo with their lists of isotopics peaks
105  */
106  void addDataPointRefByExclusion(
107  std::vector<FilterChargeDeconvolution::DataPointInfoSp> &points,
109  /**
110  * @brief Compare both list (z1 and z2) and add the right level of charge
111  * @return the vecotr of datapointInfo with their charge
112  */
113  void computeBestChargeOfDataPoint(
114  std::vector<FilterChargeDeconvolution::DataPointInfoSp> &data_points_info)
115  const;
116  /**
117  * @brief For eache datapointInfo whith no parent copy info in new vector with
118  * the intensity of the monoistipics peaks added
119  * @return the vecotr of datapointInfo with their intensity merged
120  */
121  void computeIsotopeDeconvolution(
122  std::vector<FilterChargeDeconvolution::DataPointInfoSp> &data_points_info)
123  const;
124  /**
125  * @brief For eache datapointInfo with a charge = 2 transform the peak to a
126  * charge = 1 by multiplying the mz by 2 and remove 1 H
127  * @return the vecotr of datapointInfo their z corrected
128  */
129  void transformToMonoChargedForAllDataPoint(
130  std::vector<FilterChargeDeconvolution::DataPointInfoSp> &data_points_info)
131  const;
132 
133  private:
137 };
138 } // 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:135
pappso::FilterChargeDeconvolution::DataPointInfoSp
std::shared_ptr< DataPointInfo > DataPointInfoSp
Definition: filterchargedeconvolution.h:45
PMSPP_LIB_DECL
#define PMSPP_LIB_DECL
Definition: exportinmportconfig.h:14
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::m_precisionPtr
PrecisionPtr m_precisionPtr
Definition: filterchargedeconvolution.h:136
pappso::FilterInterface
generic interface to apply a filter on a trace
Definition: filterinterface.h:40
pappso::FilterChargeDeconvolution::DataPointInfo::z1_vect
std::vector< FilterChargeDeconvolution::DataPointInfoSp > z1_vect
Definition: filterchargedeconvolution.h:62
pappso::Trace
A simple container of DataPoint instances.
Definition: trace.h:132
pappso::FilterChargeDeconvolution::m_diffC12C13_z1
double m_diffC12C13_z1
Definition: filterchargedeconvolution.h:134
filterinterface.h
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::FilterChargeDeconvolution::DataPointInfo::z1_range
std::pair< double, double > z1_range
Definition: filterchargedeconvolution.h:56
pappso::FilterChargeDeconvolution
Definition: filterchargedeconvolution.h:43