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
60  std::weak_ptr<DataPointInfo> parent;
61  // list of datapointinfo with 1mz diff multiple
62  std::vector<std::weak_ptr<DataPointInfo>> z1_vect;
63  // list of datapointinfo with 2mz diff multiple
64  std::vector<std::weak_ptr<DataPointInfo>> 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  virtual QString name() const override;
101  QString toString() const override;
102 
103  protected:
104  void buildFilterFromString(const QString &strBuildParams) override;
105 
106  private:
107  /**
108  * @brief Add each datapoint to a vector of structure describe above
109  * @return the vecotr of datapointInfo with their datapoint and their
110  * exclusion mass range
111  */
112  void addDataPointToList(
113  std::vector<FilterChargeDeconvolution::DataPointInfoSp> &points,
114  DataPoint &data_point) const;
115  /**
116  * @brief For each datapointInfo add the datapoint to the lists by their
117  * exclusion range
118  * @return the vecotr of datapointInfo with their lists of isotopics peaks
119  */
120  void addDataPointRefByExclusion(
121  std::vector<FilterChargeDeconvolution::DataPointInfoSp> &points,
123  /**
124  * @brief Compare both list (z1 and z2) and add the right level of charge
125  * @return the vecotr of datapointInfo with their charge
126  */
127  void computeBestChargeOfDataPoint(
128  std::vector<FilterChargeDeconvolution::DataPointInfoSp> &data_points_info)
129  const;
130  /**
131  * @brief For eache datapointInfo whith no parent copy info in new vector with
132  * the intensity of the monoistipics peaks added
133  * @return the vecotr of datapointInfo with their intensity merged
134  */
135  void computeIsotopeDeconvolution(
136  std::vector<FilterChargeDeconvolution::DataPointInfoSp> &data_points_info)
137  const;
138  /**
139  * @brief For eache datapointInfo with a charge = 2 transform the peak to a
140  * charge = 1 by multiplying the mz by 2 and remove 1 H
141  * @return the vecotr of datapointInfo their z corrected
142  */
143  void transformToMonoChargedForAllDataPoint(
144  std::vector<FilterChargeDeconvolution::DataPointInfoSp> &data_points_info)
145  const;
146 
147  private:
152 };
153 } // namespace pappso
std::shared_ptr< DataPointInfo > DataPointInfoSp
Interface that allows to build filter objects from strings.
A simple container of DataPoint instances.
Definition: trace.h:148
#define PMSPP_LIB_DECL
tries to keep as much as possible monoisotopes, removing any possible C13 peaks and changes multichar...
Definition: aa.cpp:39
std::vector< std::weak_ptr< DataPointInfo > > z2_vect
std::vector< std::weak_ptr< DataPointInfo > > z1_vect