| OpenMS 2.5.0

LCMS.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 // written by Lukas N Mueller, 30.3.05
38 // Lukas.Mueller@imsb.biol.ethz.ch
39 // Group of Prof. Ruedi Aebersold, IMSB, ETH Hoenggerberg, Zurich
40 //
41 // Ported to OpenMS by Florian Zeller, florian.zeller@bsse.ethz.ch
42 // December 2010
43 //
44
45 #pragma once
46
47 #include <OpenMS/TRANSFORMATIONS/FEATUREFINDER/SUPERHIRN/SuperHirnConfig.h>
48 #include <OpenMS/TRANSFORMATIONS/FEATUREFINDER/SUPERHIRN/SHFeature.h>
49
50 #include <string>
51 #include <vector>
52 #include <map>
53
54 namespace OpenMS
55 {
56
57 class SUPERHIRN_DLLAPI LCMS
58 {
59
61 // declaration of the private members:
62
63 private:
64
65 // name of the spectra:
66 std::string spec_name;
67
68 // vector of object feature:
69 std::vector<SHFeature> feature_list;
70
71 // a unique spectrum id to identify a spectrum:
72 int spectrum_id;
73
74 // MASTER RUN ID:
75 int MASTER_ID;
76
77 // the LC-MS raw data names and their IDs
78 std::map<int, std::string> raw_spec_names;
79
80 // alignment error:
81 std::map<double, std::pair<double, double> > ALIGNMENT_ERROR;
82
84 // declaration of the public members:
85
86 public:
87
88 static double MINIMAL_PEP_PROPHET_THERSHOLD;
89 // static double PEP_PROPHET_THERSHOLD;
90
91 // class destructor
92 ~LCMS();
93
94 // class constructor
95 LCMS(std::string);
96 LCMS();
97 // copy constructor
98 LCMS(const LCMS *);
99
100 // copy constructor
101 LCMS(const LCMS &);
102
103 // show the content of the spectra
104 void show_info();
105
106 // copy constructor:
107 LCMS & operator=(const LCMS &);
108
109 // sort the features according their parent mass:
110 void order_by_mass();
111
112 // function to compare the feature mass:
113 float compare_feature_mass(const void *, const void *);
114
115 // this structure provides the function to compare
116 // in the sorting algorithm:
117 struct OPERATOR_MZ
118 {
119 // provide the compare function for sort:
120 bool operator()(const SHFeature A, const SHFeature B) const
121 {
122 // check if they have same mass
123 if (A.MONO_MZ == B.MONO_MZ)
124 {
125 return A.TR < B.TR;
126 }
127 else
128 {
129 return A.MONO_MZ < B.MONO_MZ;
130 }
131 }
132
133 };
134
135 // this structure provides the function to compare
136 // in the sorting algorithm:
137 struct OPERATOR_FeatureCompare
138 {
139 // provide the compare function for sort:
140 bool operator()(const SHFeature A, const SHFeature B) const
141 {
142 // check if they have same mass
143 if (A.feature_ID == B.feature_ID)
144 {
145 return true;
146 }
147 else
148 {
149 return false;
150 }
151 }
152
153 };
154
155 // tag the feature with the spectrum id:
156 void tag_peaks_with_spectrum_ID();
157
158 // count the number of common peaks of a given number of LC-MS:
159 int get_nb_common_peaks(int);
160
162 // start here all the get / set
163 // function to access the
164 // variables of the class
165
166 // get the whole feature list:
167 void clear_feature_list();
168 std::vector<SHFeature> get_feature_list();
169 std::vector<SHFeature> * get_feature_list_reference();
170 bool check_feature_list_empty();
171
172 // access end /start of list:
173 std::vector<SHFeature>::iterator get_feature_list_begin();
174 std::vector<SHFeature>::iterator get_feature_list_end();
175
176 // add a new feature to the list:
177 void add_feature(SHFeature * in);
178
179 // remove a feature from the LC/MS run by ID:
180 void remove_feature_by_ID(SHFeature *);
181 void remove_feature_by_ID(int);
182 // remove a feature from the LC/MS run:
183 void remove_feature(SHFeature *);
184 void remove_feature(int i);
185
186 // remove a feature by iterator and return the iterator to the next element
187 std::vector<SHFeature>::iterator remove_feature_from_list(std::vector<SHFeature>::iterator in);
188
189 // get number of feature added:
190 unsigned int get_nb_features();
191
192 std::string get_spec_name();
193 void set_spec_name(std::string in);
194
195 // set / get spectrum id:
196 int get_spectrum_ID();
197 void set_spectrum_ID(int in);
198
199 // set the id of all features
200 void setFeatureLCMSID();
201
202 // search the list of feature for the one with input ID:
203 SHFeature * find_feature_by_ID(int);
204
205 // access the raw data names:
206 void remove_raw_spec_name(int ID);
207 void add_raw_spec_name(int ID, std::string name);
208 bool check_raw_spec_name_empty();
209 std::map<int, std::string>::iterator get_raw_spec_name_start();
210 std::map<int, std::string>::iterator get_raw_spec_name_end();
211 std::map<int, std::string> get_raw_spec_name_map();
212 int get_nb_raw_specs();
213
214 std::string get_raw_spec_name(int ID);
215
216 // compare the LC/MS runs names
217 bool check_LCMS_name(std::string);
218
219 // check if this LC/MS ID is present in the raw LC/MS runs
220 bool find_LC_MS_by_ID(int);
221
222 // add the raw spectrum map:
223 void add_raw_spec_name_map(std::map<int, std::string> in);
224
225 // counts the number of ms features, which contain MS2 info:
226 int get_nb_identified_features();
227
228 // counts the number of ms features, which contain MS2 info (no thresholding)
229 int get_nb_identified_features(double PepProb_T);
230
232 // access the alignment error:
233 // save an error:
234 void add_alignment_error(double TR, double ERROR_UP, double ERROR_DOWN);
235
236 // get alignment error at specific TR:
237 void get_alignment_error(double, double *, double *);
238
239 // access MASTER run ID:
240 void set_MASTER_ID(int in);
241 int get_MASTER_ID();
242 };
243
244 }
245
OpenMS::LCMS::OPERATOR_FeatureCompare::operator()
bool operator()(const SHFeature A, const SHFeature B) const
Definition: LCMS.h:140
OpenMS::LCMS
Definition: LCMS.h:57
OpenMS::SHFeature
Definition: SHFeature.h:59
OpenMS::SHFeature::TR
double TR
Definition: SHFeature.h:128
OpenMS::LCMS::spec_name
std::string spec_name
Definition: LCMS.h:66
OpenMS::LCMS::OPERATOR_FeatureCompare
Definition: LCMS.h:137
OpenMS::LCMS::ALIGNMENT_ERROR
std::map< double, std::pair< double, double > > ALIGNMENT_ERROR
Definition: LCMS.h:81
OpenMS::LCMS::OPERATOR_MZ
Definition: LCMS.h:117
OpenMS::SHFeature::feature_ID
int feature_ID
Definition: SHFeature.h:133
OpenMS
Main OpenMS namespace.
Definition: FeatureDeconvolution.h:46
OpenMS::LCMS::feature_list
std::vector< SHFeature > feature_list
Definition: LCMS.h:69
OpenMS::LCMS::OPERATOR_MZ::operator()
bool operator()(const SHFeature A, const SHFeature B) const
Definition: LCMS.h:120
OpenMS::LCMS::spectrum_id
int spectrum_id
Definition: LCMS.h:72
OpenMS::LCMS::MASTER_ID
int MASTER_ID
Definition: LCMS.h:75
OpenMS::SHFeature::MONO_MZ
double MONO_MZ
Definition: SHFeature.h:129
OpenMS::LCMS::MINIMAL_PEP_PROPHET_THERSHOLD
static double MINIMAL_PEP_PROPHET_THERSHOLD
Definition: LCMS.h:88
OpenMS::LCMS::raw_spec_names
std::map< int, std::string > raw_spec_names
Definition: LCMS.h:78
SHFeature.h