OpenMS  2.6.0
ProcessData.h
Go to the documentation of this file.
1 // --------------------------------------------------------------------------
2 // OpenMS -- Open-Source Mass Spectrometry
3 // --------------------------------------------------------------------------
4 // Copyright The OpenMS Team -- Eberhard Karls University Tuebingen,
5 // ETH Zurich, and Freie Universitaet Berlin 2002-2020.
6 //
7 // This software is released under a three-clause BSD license:
8 // * Redistributions of source code must retain the above copyright
9 // notice, this list of conditions and the following disclaimer.
10 // * Redistributions in binary form must reproduce the above copyright
11 // notice, this list of conditions and the following disclaimer in the
12 // documentation and/or other materials provided with the distribution.
13 // * Neither the name of any author or any participating institution
14 // may be used to endorse or promote products derived from this software
15 // without specific prior written permission.
16 // For a full list of authors, refer to the file AUTHORS.
17 // --------------------------------------------------------------------------
18 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
19 // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
20 // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
21 // ARE DISCLAIMED. IN NO EVENT SHALL ANY OF THE AUTHORS OR THE CONTRIBUTING
22 // INSTITUTIONS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
23 // EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
24 // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
25 // OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
26 // WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
27 // OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
28 // ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 //
30 // --------------------------------------------------------------------------
31 // $Maintainer: Timo Sachsenberg $
32 // $Authors: Lukas Mueller, Markus Mueller $
33 // --------------------------------------------------------------------------
34 //
36 //
37 // PEAK DETECTION OF FOURIER TRANSFORME MS INSTRUMENT DATA
38 //
39 // written by Markus Mueller, markus.mueller@imsb.biol.ethz.ch
40 // and Lukas Mueller, Lukas.Mueller@imsb.biol.ethz.ch
41 // October 2005
42 //
43 // Ported to OpenMS by Florian Zeller, florian.zeller@bsse.ethz.ch
44 // December 2010
45 //
46 // Group of Prof. Ruedi Aebersold, IMSB, ETH Hoenggerberg, Zurich
47 //
48 //
49 
50 
51 #pragma once
52 
53 #include <OpenMS/TRANSFORMATIONS/FEATUREFINDER/SUPERHIRN/SuperHirnConfig.h>
55 
56 #include <map>
57 #include <vector>
58 #include <string>
59 #include <list>
60 
61 namespace OpenMS
62 {
63 
64  class CentroidData;
65  class LCMSCData;
66 
67  class SUPERHIRN_DLLAPI ProcessData
68  {
69 
70 
72  // declaration of the private members:
73 
74 public:
75  typedef std::multimap<int, MSPeak> elution_peak;
76  typedef std::vector<elution_peak> MZ_series;
77  typedef std::vector<elution_peak>::iterator MZ_series_ITERATOR;
78  typedef std::multimap<double, MZ_series> main_data_structure;
79  typedef main_data_structure::iterator main_iterator;
80 
81 
82 protected:
83 
85  // declaration of the public members:
86  // map that tracts all observed masses in keys
87 
88 
89  // clustering of ms peak along time axis:
90 // bool TIME_CLUSTERING_BY_RETENTION_TIME;
91 
92  // max_distance from next elution peak member in scan numbers:
94 
95  // cluster data structure:
97 
98  // and stores as contents vectors of type
100 
101  // tracks the number of observed mz cluster
102  // elements:
103  std::map<double, int> MZ_CLUSTER;
105 
106 
108  // data processing classes:
110 
111 public:
112 
113  /*
114  // minimal intensity level:
115  static float INTENSITY_THRESHOLD;
116 
117  // m/z tolerance value:
118  static double MZ_TOLERANCE;
119 
120  // max_distance from next elution peak member in min.:
121  static double max_inter_scan_retention_time_distance;
122 
123  // define minimal number of members in LC elution peaks cluster
124  static int min_nb_cluster_members;
125 
126  static std::map<int, float> scan_TR_index;
127 
128  // to track detected monoisotopic mass for debugging:
129  static bool MonoIsoDebugging;
130  static double DebugMonoIsoMassMin;
131  static double DebugMonoIsoMassMax;
132  static double MS1_intensity_apex_percentil_cutoff;
133  static double MS1_TR_RESOLUTION;
134  // if data are in centroid form or not:
135  static bool CENTROID_DATA_MODUS;
136  */
137 
138  // class destructor
139  ~ProcessData();
140 
141  // class constructor
142  ProcessData();
143  // class copy constructor
144  ProcessData(const ProcessData &);
145 
146 
148  // inputs raw /centroided data into the object:
149  void add_scan_raw_data(int, double, CentroidData *);
150  // inputs raw data into the object:
151  void add_scan_raw_data(std::vector<MSPeak>);
152 
154  // overload operators:
155  ProcessData & operator=(const ProcessData &);
156  ProcessData & operator<=(const ProcessData &);
157  ProcessData & operator>=(const ProcessData &);
158  ProcessData & operator<(const ProcessData &);
159  ProcessData & operator>(const ProcessData &);
160 
161  // insert an already observed mz into the data structure, checks
162  // if it belongs to an existing LC elution peak or starts a new one:
163  void insert_observed_mz(main_iterator, MSPeak *);
164  // insert a newly observed mz into the data structure
165  void insert_new_observed_mz(MSPeak *);
166 
167 
168  // converts DeconvPeak list to ms_peak vector
169  void convert_ms_peaks(int, double, std::list<DeconvPeak> &, std::vector<MSPeak> &);
170 
171  // check if the ms peak is in the selected mz, z, int range
172  bool filterDeisotopicMSPeak(MSPeak *);
173 
175  // function which check if a data structure iterator is similar
176  // to a peak and should be considered
177  // returns 1 if ok
178  // returns 0 if not
179  // returns -1 if scan range exceeded
180  int compareIteratorToPeak(MSPeak *, main_iterator);
181  // checks if a mz value has already been seen,
182  // also look for very close ones and cluster them
183  main_iterator check_MZ_occurence(MSPeak *);
184 
185 
187  // process a series of MS peaks
188  // set the signal to noise level:
189  void processMSPeaks(std::multimap<int, MSPeak> *);
190 
191 
193  // get the full summed up intensity
194  double getPeakIntensitySum(double);
195 
196 
197  // check if a peak with this scan number belong to this elution cluster:
198  bool check_elution_peak_belong(MZ_series_ITERATOR, MSPeak *);
199  // returns the distance to this elution peak:
200  int getElutionPeakDistance(MZ_series_ITERATOR, int);
201 
202  // runs through the whole data structure and puts the elution_peaks into
203  // a proper LC_elution peak object
204  void extract_elution_peaks();
205 
206  // check if this elution peak is accepted as a really LC-elution peak:
207  bool check_elution_peak(MZ_series_ITERATOR);
208 
209  // convert the MZ_series elution peak element into a LC_elution_peak object
210  void convert_to_LC_elution_peak(MZ_series_ITERATOR, double);
211 
212  // find a retention time by the scan number:
213  double find_retention_time(double);
214 
215  // find closest match mz mass in the main structure
216  main_iterator find_closest_mz_match(double);
217 
218  // go back to the MS1 level and
219  // find the correct precursor mass by mz and z:
220  void adjustCorrectToMS1Precursor(double *, int, int, int);
221 
222 
224  // access methods to the object variables:
225 
226  // get an observed MZ mass, otherwise end of list iterator
227  main_iterator get_MZ(double);
228  // get an observed MZ mass, otherwise end of list iterator
229  main_iterator get_MZ_lower_bound(double);
230  // get end of MZ list:
231  main_iterator get_MZ_LIST_end();
232  // get start of MZ list:
233  main_iterator get_MZ_LIST_start();
234  // erase element in MZ list:
235  void erase_MZ_LIST_element(main_iterator);
236  int getNbMSTraces();
237 
238  double getMinimalIntensityLevel();
239 
240  // access the MZ_CLUSTER:
241  // find element numbers:
242  std::map<double, int>::iterator get_nb_MZ_cluster_elements(double);
243  // erase an element:
244  void erase_MZ_cluster_element(std::map<double, int>::iterator);
245  // insert an element:
246  void insert_MZ_cluster_element(double, int);
247 
248  // add the scan vs TR index to the data structure:
249  // void add_scan_TR_index(std::map<int, float> IN){scan_TR_index = IN;};
250 
251  // get the processed data:
252  LCMSCData * getProcessedData();
253 
254  // increase the LC_elution_profile counter:
255  void increase_LC_elution_peak_counter();
256  unsigned int get_LC_elution_peak_counter();
257 
258  // get the maximal scan distance between two same monoisotopic masses
259  int getMaxScanDistance();
260  void setMaxScanDistance(int in);
261 
262 
263  // build up an index scan vs retention time:
264  // static void insert_into_scan_TR_index(int IN, float TR){scan_TR_index.insert(std::pair<int, float>(IN,TR));};
265 
266  };
267 
268 } // ns
269 
OpenMS::ProcessData::backgroundController
BackgroundControl * backgroundController
Definition: ProcessData.h:109
OpenMS::MSPeak
Definition: MSPeak.h:65
OpenMS::ProcessData::main_iterator
main_data_structure::iterator main_iterator
Definition: ProcessData.h:79
OpenMS::operator<
bool operator<(const QTCluster &q1, const QTCluster &q2)
OpenMS::ProcessData::MZ_series
std::vector< elution_peak > MZ_series
Definition: ProcessData.h:76
OpenMS::ProcessData::pMZ_LIST
main_data_structure pMZ_LIST
Definition: ProcessData.h:99
OpenMS
Main OpenMS namespace.
Definition: FeatureDeconvolution.h:46
OpenMS::LCMSCData
Definition: LCMSCData.h:59
BackgroundControl.h
OpenMS::ProcessData::MZ_series_ITERATOR
std::vector< elution_peak >::iterator MZ_series_ITERATOR
Definition: ProcessData.h:77
OpenMS::ProcessData::LC_elution_peak_counter
unsigned int LC_elution_peak_counter
Definition: ProcessData.h:104
OpenMS::ProcessData::MZ_CLUSTER
std::map< double, int > MZ_CLUSTER
Definition: ProcessData.h:103
OpenMS::CentroidData
Definition: CentroidData.h:63
OpenMS::ProcessData::data_
LCMSCData * data_
Definition: ProcessData.h:96
OpenMS::ProcessData::main_data_structure
std::multimap< double, MZ_series > main_data_structure
Definition: ProcessData.h:78
OpenMS::ProcessData::elution_peak
std::multimap< int, MSPeak > elution_peak
Definition: ProcessData.h:75
OpenMS::ProcessData
Definition: ProcessData.h:67
OpenMS::BackgroundControl
Definition: BackgroundControl.h:62
OpenMS::ProcessData::max_inter_scan_distance
int max_inter_scan_distance
Definition: ProcessData.h:93