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-2013.
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.
30
// --------------------------------------------------------------------------
31
// $Maintainer: Florian Zeller $
32
// $Authors: Florian Zeller $
33
// --------------------------------------------------------------------------
40
#include <OpenMS/TRANSFORMATIONS/FEATUREFINDER/SUPERHIRN/SuperHirnParameters.h>
41
#include <OpenMS/TRANSFORMATIONS/FEATUREFINDER/SUPERHIRN/MS2Feature.h>
42
#include <OpenMS/TRANSFORMATIONS/FEATUREFINDER/SUPERHIRN/MSPeak.h>
43
#include <OpenMS/TRANSFORMATIONS/FEATUREFINDER/SUPERHIRN/CentroidData.h>
44
#include <OpenMS/TRANSFORMATIONS/FEATUREFINDER/SUPERHIRN/LCElutionPeak.h>
45
#include <OpenMS/TRANSFORMATIONS/FEATUREFINDER/SUPERHIRN/BackgroundIntensityBin.h>
46
#include <OpenMS/TRANSFORMATIONS/FEATUREFINDER/SUPERHIRN/BackgroundControl.h>
47
#include <OpenMS/TRANSFORMATIONS/FEATUREFINDER/SUPERHIRN/LCMSCData.h>
48
#include <OpenMS/TRANSFORMATIONS/FEATUREFINDER/SUPERHIRN/ProcessData.h>
49
#include <OpenMS/TRANSFORMATIONS/FEATUREFINDER/SUPERHIRN/MS2Info.h>
50
#include <OpenMS/TRANSFORMATIONS/FEATUREFINDER/SUPERHIRN/FeatureLCProfile.h>
51
#include <OpenMS/TRANSFORMATIONS/FEATUREFINDER/SUPERHIRN/SHFeature.h>
52
#include <OpenMS/TRANSFORMATIONS/FEATUREFINDER/SUPERHIRN/LCMS.h>
53
#include <OpenMS/TRANSFORMATIONS/FEATUREFINDER/SUPERHIRN/FTPeakDetectController.h>
55
#include <OpenMS/DATASTRUCTURES/Param.h>
56
#include <OpenMS/KERNEL/Feature.h>
57
#include <OpenMS/TRANSFORMATIONS/FEATUREFINDER/FeatureFinderAlgorithmSHCtrl.h>
63
std::vector<Feature> FeatureFinderAlgorithmSHCtrl::extractPeaks(Vec datavec)
66
SuperHirnParameters::instance()->initIsotopeDist_ = false; // reset this so that the IsotopeDist gets reinitalized
68
FTPeakDetectController controller;
69
controller.startScanParsing(datavec);
71
std::vector<Feature> thefeatures;
73
std::vector<SHFeature>::iterator p = controller.getLCMS()->get_feature_list_begin();
74
while (p != controller.getLCMS()->get_feature_list_end())
79
double mz = (*p).get_MZ();
82
int charge = (*p).get_charge_state();
85
double rt = (*p).get_retention_time();
86
rt *= 60.0; // convert back
89
double darea = (*p).get_peak_area();
90
float area = (float) darea;
93
// ------------------------------------------------------------------------------
94
// Convex hull -- needs to be calculated differently according to Markus Mueller
95
// ------------------------------------------------------------------------------
96
// FeatureLCProfile* profile = (*p).getLCelutionProfile();
97
// ConvexHull2D::PointArrayType hull_points(profile->getNbLCelutionSignals());
100
// unsigned int j = 0;
101
// std::map<int, MS1Signal>::iterator lcit;
102
// for (lcit = profile->getLCelutionSignalsStart(); lcit != profile->getLCelutionSignalsEnd(); lcit++) {
103
// //int scan = lcit->first;
104
// MS1Signal signal = lcit->second;
106
// hull_points[j][0] = signal.TR * 60.0; // convert back
107
// hull_points[j][1] = signal.mass;
111
// ConvexHull2D hull;
112
// hull.addPoints(hull_points);
113
// f.getConvexHulls().push_back(hull);
114
// ------------------------------------------------------------------------------
116
thefeatures.push_back(f);
123
void FeatureFinderAlgorithmSHCtrl::initParams(Param param)
126
// MS1 data centroid data
127
// Key: ms1:data_is_centroided_already
128
// 1 == data is centroided already
129
SuperHirnParameters::instance()->centroidDataModus_ = !(param.getValue("centroiding:active").toBool());
132
//def->search_tag("Precursor detection scan levels", &vInt);
133
// Key: ms1:precursor_detection_scan_levels
135
IntList list = (IntList)(param.getValue("ms1:precursor_detection_scan_levels"));
136
for (unsigned int i = 0; i < list.size(); i++)
138
FTPeakDetecMzXmlReader::PEAK_EXTRACTION_SCAN_LEVELS.push_back(list.at(i));
141
// belongs to SPECIFIC MS2 PEAK DETECTION PARAMETERS:
142
//def->search_tag("Fragment Mass Scan levels", &vInt);
143
FTPeakDetecMzXmlReader::FRAGMENT_MASS_SCAN_LEVELS.push_back(2);
145
//def->search_tag("MS1 max inter scan distance", &INT);
146
// Key: ms1:max_inter_scan_distance
147
FTPeakDetecMzXmlReader::MS1_base_inter_scan_distance = param.getValue("ms1:max_inter_scan_distance");
150
//def->search_tag("MS1 LC retention time resolution", &DB);
151
// Key: ms1:tr_resolution
152
SuperHirnParameters::instance()->ms1TRResolution_ = param.getValue("ms1:tr_resolution"); //0.01;
154
// Key: ms1:intensity_threshold
155
// float thresh = 1000;
156
// def->search_tag("FT peak detect MS1 intensity min threshold", &DB);
157
// LCMSCData::intensity_min_threshold = param.getValue("ms1:intensity_threshold");;
159
// NOTE: Was hardcoded to 1000, however:
160
// - def->search_tag("FT peak detect MS2 intensity min threshold", &INTENSITY_THRESHOLD);
161
// - but the above is probably something different
162
SuperHirnParameters::instance()->intensityThreshold_ = param.getValue("ms1:intensity_threshold");
164
// MS1 max inter scan distance
165
// Key: ms1:max_inter_scan_rt_distance
166
SuperHirnParameters::instance()->maxInterScanRetentionTimeDistance_ = param.getValue(
167
"ms1:max_inter_scan_rt_distance"); // 0.1;
169
// def->search_tag("FT peak detect MS1 min nb peak members", &min_nb_cluster_members);
170
// Key: ms1:min_nb_cluster_members
171
SuperHirnParameters::instance()->minNbClusterMembers_ = param.getValue("ms1:min_nb_cluster_members"); // 4
173
//def->search_tag("Detectable isotope factor",&DB);
174
// Key: ms1:detectable_isotope_factor
175
SuperHirnParameters::instance()->detectableIsotopeFactor_ = param.getValue("ms1:detectable_isotope_factor"); // 0.05;
177
// def->search_tag("IntensityCV",&DB);
178
// Key: ms1:intensity_cv
179
SuperHirnParameters::instance()->intensityCV_ = param.getValue("ms1:intensity_cv"); // 0.9;
181
// ----------------------------------------------------------------------
182
// from void FT_PEAK_DETECT_initializer::init_all(){
183
// ----------------------------------------------------------------------
185
//def->search_tag("Centroid window width",&INT);
186
// Key: centroiding:window_width
187
SuperHirnParameters::instance()->centroidWindowWidth_ = param.getValue("centroiding:window_width"); // 5;
189
//def->search_tag("Absolute isotope mass precision",&DB);
190
// Key: centroiding:absolute_isotope_mass_precision
191
SuperHirnParameters::instance()->massTolDa_ = param.getValue("centroiding:absolute_isotope_mass_precision"); // 0.01;
193
//def->search_tag("Relative isotope mass precision",&DB);
194
// Key: centroiding:relative_isotope_mass_precision
195
SuperHirnParameters::instance()->massTolPpm_ = param.getValue("centroiding:relative_isotope_mass_precision"); // 10;
197
//def->search_tag("Minimal peak height",&DB);
198
// Key: centroiding:minimal_peak_height
199
SuperHirnParameters::instance()->minIntensity_ = param.getValue("centroiding:minimal_peak_height"); // 0.0;
201
//def->search_tag("Min. Centroid MS Signal Intensity",&DB);
202
// Key: centroiding:min_ms_signal_intensity
203
SuperHirnParameters::instance()->intensityFloor_ = param.getValue("centroiding:min_ms_signal_intensity"); // 50; //in config its 50, but in CentroidData it's 1;
206
//def->search_tag("Report mono peaks",&INT);
207
// NO OpenMS equivalent
208
FTPeakDetecMzXmlReader::sfReportMonoPeaks = 0;
210
//def->search_tag("Report scan number",&INT);
211
// NO OpenMS equivalent
212
FTPeakDetecMzXmlReader::sfReportScanNumber = 0;
215
// ----------------------------------------------------------------------
217
// ----------------------------------------------------------------------
218
// feature parameters:
219
//def->search_tag("MS1 retention time tolerance", &TMP);
220
// Key: ms1:retention_time_tolerance
222
SuperHirnParameters::instance()->trTol_ = param.getValue("ms1:retention_time_tolerance"); // 0.5;
224
// def->search_tag("MS1 m/z tolerance", &TMP);
225
// Key: ms1:mz_tolerance
227
SuperHirnParameters::instance()->mzTolPpm_ = param.getValue("ms1:mz_tolerance"); // 0.0;
228
// ConsensusIsotopePattern::FT_MZ_TOLERANCE = SHFeature::PPM_MZ_TOL;
230
// MS2_M2_matcher parameters:
231
//def->search_tag("MS2 mass matching modus", &TMP_B);
232
// Key: general:ms2_mass_matching_modus
233
// Unit: define which modus used to match ms2 assignments to ms1 peaks
234
// - theoretical mass [1] : use theoretical mass calculated from sequence
235
// - MS1 precursor mass [0]: use measured ms1 mass of precursor ion
236
// MS2Info::THEO_MATCH_MODUS = 1;
238
// MS2 matching PPM parameters:
239
//def->search_tag("MS2 PPM m/z tolerance", &TMP);
240
// Key: general:ms2_ppm_mz_tolerance
242
// MS2Info::MS2_MZ_PPM_TOLERANCE = 30;
244
// MS2 retention time tolerance:
245
//def->search_tag("MS2 retention time tolerance", &TMP);
246
// Key: general:ms2_retention_time_tolerance
247
// Unit: retention time tolerance with which MS2 identifications will be associated
248
// to a defined MS1 LC elution peak [min]
249
// (if set to -1, then the MS1 retention time tolerance will be used
251
// MS2Info::MS2_TR_TOL = TMP;
254
// MS2Info::MS2_TR_TOL = SHFeature::TR_TOL;
257
// def->search_tag("Peptide Prophet Threshold", &TMP);
258
// Key: general:peptide_prophet_threshold
260
//double d = param.getValue("general:peptide_prophet_threshold"); // 0.9;
263
// ------ peptide_DELTA_group::PEPTIDE_PROBABILITY_THRESHOLD = d;
264
// SHFeature::PEPTIDE_PROBABILITY_THRESHOLD = d;
265
// PKUNSZT: commented out: the default is 0.9 already.
266
// SuperHirnParameters::instance()->peptideProbabilityThreshold_ = d;
267
// ------ interact_parser::PEPTIDE_PROBABILITY_THRESHOLD = d;
268
// LCMS::PEP_PROPHET_THERSHOLD = d; // THIS IS NEVER USED
270
//def->search_tag("Create monoisotopic LC profile", &TMP_B);
271
// ------- LCMSDataImporter::CREATE_FEATURE_ELUTION_PROFILES = 1;
272
// FTPeakDetectController::CREATE_FEATURE_ELUTION_PROFILES = 1;
273
SuperHirnParameters::instance()->createFeatureElutionProfiles_ = true;
274
// ------- LC_MS_XML_writer::STORE_FEATURE_ELUTION_PROFILES = 1;
276
/////////////////////////////////////////////////
277
// Parameters for the peak merging:
278
//def->search_tag("Activation of MS1 feature merging post processing", &TMP_B);
279
// Key: ms1_feature_merger:active
280
// MS1FeatureMerger::MS1_FEATURE_CLUSTERING = param.getValue("ms1_feature_merger:active").toBool(); //1;
281
SuperHirnParameters::instance()->ms1FeatureClustering_ = param.getValue("ms1_feature_merger:active").toBool(); //1;
283
//def->search_tag("MS1 LC retention time resolution", &TMP); // belongs to MS1 PEAK DETECTION PARAMETERS FOR THE DIFFERENT FILTER METHODS:
284
// Key: ms1_feature_merger:tr_resolution
285
// MS1FeatureMerger::MS1_PEAK_AREA_TR_RESOLUTION = param.getValue("ms1_feature_merger:tr_resolution"); //0.01;
286
SuperHirnParameters::instance()->ms1PeakAreaTrResolution_ = param.getValue("ms1_feature_merger:tr_resolution"); //0.01;
288
//def->search_tag("Initial Apex Tr tolerance", &TMP);
289
// Key: ms1_feature_merger:initial_apex_tr_tolerance
290
// MS1FeatureMerger::INITIAL_TR_TOLERANCE = param.getValue("ms1_feature_merger:initial_apex_tr_tolerance"); //5.0;
291
SuperHirnParameters::instance()->initialTrTolerance_ = param.getValue(
292
"ms1_feature_merger:initial_apex_tr_tolerance"); //5.0;
294
//def->search_tag("MS1 feature Tr merging tolerance", &TMP);
295
// Key: ms1_feature_merger:feature_merging_tr_tolerance
296
// MS1FeatureMerger::MS1_FEATURE_MERGING_TR_TOLERANCE = param.getValue(
297
// "ms1_feature_merger:feature_merging_tr_tolerance"); //1.0;
298
SuperHirnParameters::instance()->ms1FeatureMergingTrTolerance_ = param.getValue(
299
"ms1_feature_merger:feature_merging_tr_tolerance"); //1.0;
301
//def->search_tag("Percentage of intensity variation between LC border peaks", &TMP);
302
// Key: ms1_feature_merger:intensity_variation_percentage
303
// MS1FeatureMerger::PERCENTAGE_INTENSITY_ELUTION_BORDER_VARIATION = param.getValue(
304
// "ms1_feature_merger:intensity_variation_percentage"); //25;
305
SuperHirnParameters::instance()->percentageIntensityElutionBorderVariation_ = param.getValue(
306
"ms1_feature_merger:intensity_variation_percentage"); //25;
308
//def->search_tag("PPM value for the m/z clustering of merging candidates", &TMP);
309
// Key: ms1_feature_merger:ppm_tolerance_for_mz_clustering
310
SuperHirnParameters::instance()->ppmToleranceForMZClustering_ = param.getValue(
311
"ms1_feature_merger:ppm_tolerance_for_mz_clustering"); //10;
313
/////////////////////////////////////////////////
314
// what information is extracted from the LC/MS or mastermap:
315
// def->search_tag("start elution window", &TMP);
316
// Key: ms1_feature_selection_options:start_elution_window
318
SuperHirnParameters::instance()->minTR_ = param.getValue("ms1_feature_selection_options:start_elution_window"); //0;
320
// def->search_tag("end elution window", &TMP);
321
// Key: ms1_feature_selection_options:end_elution_window
323
SuperHirnParameters::instance()->maxTR_ = param.getValue("ms1_feature_selection_options:end_elution_window"); //180;
325
//def->search_tag("MS1 feature mz range min", &TMP);
326
// Key: ms1_feature_selection_options:mz_range_min
327
SuperHirnParameters::instance()->minFeatureMZ_ = param.getValue("ms1_feature_selection_options:mz_range_min"); //0;
329
//def->search_tag("MS1 feature mz range max", &TMP );
330
// Key: ms1_feature_selection_options:mz_range_max
331
SuperHirnParameters::instance()->maxFeatureMZ_ = param.getValue("ms1_feature_selection_options:mz_range_max"); //2000;
333
//def->search_tag("MS1 feature CHRG range min", &TMP_I );
334
// Key: ms1_feature_selection_options:chrg_range_min
335
SuperHirnParameters::instance()->minFeatureChrg_ = param.getValue("ms1_feature_selection_options:chrg_range_min"); //1;
336
//Deisotoper::sfMinCharge = param.getValue("ms1_feature_selection_options:chrg_range_min"); //1;
338
//def->search_tag("MS1 feature CHRG range max", &TMP_I );
339
// Key: ms1_feature_selection_options:chrg_range_max
340
SuperHirnParameters::instance()->maxFeatureChrg_ = param.getValue("ms1_feature_selection_options:chrg_range_max"); //5;
341
//Deisotoper::sfMaxCharge = param.getValue("ms1_feature_selection_options:chrg_range_max"); //5;
343
/////////////////////////////////////////////////
344
// what and how data is stored during superhirn processing:
345
// ms2 information of a feature:
346
// only the best ms2 info / feature stored:
347
//def->search_tag("progress all low probability ms2 info in MS1 feature", &TMP_B);
348
// SHFeature::STORE_ALL_LOW_PROBABILITY_MS2_SCANS = 0;