OpenMS  2.6.0
MRMFeatureFilter.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: Douglas McCloskey, Pasquale Domenico Colaianni $
32 // $Authors: Douglas McCloskey, Pasquale Domenico Colaianni $
33 // --------------------------------------------------------------------------
34 
35 #pragma once
36 
40 
42 #include <OpenMS/KERNEL/Feature.h>
44 #include <OpenMS/FORMAT/QcMLFile.h>
45 
49 
50 namespace OpenMS
51 {
52  class AbsoluteQuantitationMethod;
53 
62  class OPENMS_DLLAPI MRMFeatureFilter :
63  public DefaultParamHandler
64  {
65 
66 public:
67 
71 
73  ~MRMFeatureFilter() override;
75 
81  void getDefaultParameters(Param& params) const;
82 
84  void updateMembers_() override;
85 
94  void FilterFeatureMap(FeatureMap& features, const MRMFeatureQC& filter_criteria,
95  const TargetedExperiment& transitions);
96 
109  void FilterFeatureMapPercRSD(FeatureMap& features, const MRMFeatureQC& filter_criteria, const MRMFeatureQC& filter_values);
110 
124  void FilterFeatureMapBackgroundInterference(FeatureMap& features, const MRMFeatureQC& filter_criteria, const MRMFeatureQC& filter_values);
125 
138  void EstimateDefaultMRMFeatureQCValues(const std::vector<FeatureMap>& samples, MRMFeatureQC& filter_template, const TargetedExperiment& transitions, const bool& init_template_values);
139 
148  void TransferLLOQAndULOQToCalculatedConcentrationBounds(const std::vector<AbsoluteQuantitationMethod>& quantitation_method, MRMFeatureQC& filter_template);
149 
160  void EstimatePercRSD(const std::vector<FeatureMap>& samples, MRMFeatureQC& filter_template, const TargetedExperiment& transitions);
161 
172  void EstimateBackgroundInterferences(const std::vector<FeatureMap>& samples, MRMFeatureQC& filter_template, const TargetedExperiment& transitions);
173 
184  double calculateIonRatio(const Feature& component_1, const Feature& component_2, const String& feature_name) const;
185 
194  double calculateRTDifference(Feature& component_1, Feature& component_2) const;
195 
204  double calculateResolution(Feature& component_1, Feature& component_2) const;
205 
217  bool checkMetaValue(
218  const Feature& component,
219  const String& meta_value_key,
220  const double& meta_value_l,
221  const double& meta_value_u,
222  bool& key_exists
223  ) const;
224 
234  void updateMetaValue(
235  const Feature& component,
236  const String& meta_value_key,
237  double& meta_value_l,
238  double& meta_value_u,
239  bool& key_exists
240  ) const;
241 
251  void setMetaValue(
252  const Feature& component,
253  const String& meta_value_key,
254  double& meta_value_l,
255  double& meta_value_u,
256  bool& key_exists
257  ) const;
258 
268  void initMetaValue(
269  const Feature& component,
270  const String& meta_value_key,
271  double& meta_value_l,
272  double& meta_value_u,
273  bool& key_exists
274  ) const;
275 
284  std::map<String,int> countLabelsAndTransitionTypes(const Feature& component_group,
285  const TargetedExperiment& transitions) const;
286 
294  StringList getUniqueSorted(const StringList& messages) const;
295 
304  void accumulateFilterValues(std::vector<MRMFeatureQC>& filter_values, const std::vector<FeatureMap>& samples, const MRMFeatureQC& filter_template, const TargetedExperiment& transitions) const;
305 
312  void zeroFilterValues(MRMFeatureQC& filter_zeros, const MRMFeatureQC& filter_template) const;
313 
321  void calculateFilterValuesMean(MRMFeatureQC& filter_mean, const std::vector<MRMFeatureQC>& filter_values, const MRMFeatureQC& filter_template) const;
322 
331  void calculateFilterValuesVar(MRMFeatureQC& filter_var, const std::vector<MRMFeatureQC>& filter_values, const MRMFeatureQC& filter_mean, const MRMFeatureQC& filter_template) const;
332 
340  void calculateFilterValuesPercRSD(MRMFeatureQC& filter_rsd, const MRMFeatureQC& filter_mean, const MRMFeatureQC& filter_var) const;
341 
343  template <typename T>
344  bool checkRange(const T& value, const T& value_l, const T& value_u) const;
345 
347  template <typename T>
348  void updateRange(const T& value, T& value_l, T& value_u) const;
349 
351  template <typename T>
352  void setRange(const T& value, T& value_l, T& value_u) const;
353 
355  template <typename T>
356  void initRange(const T& value, T& value_l, T& value_u) const;
357 
358 private:
359  // Members
362  };
363 }
364 
LogStream.h
DefaultParamHandler.h
TargetedExperiment.h
OpenMS::MRMFeatureFilter::flag_or_filter_
String flag_or_filter_
flag or filter (i.e., remove) features that do not pass the QC
Definition: MRMFeatureFilter.h:361
OpenMS::String
A more convenient string class.
Definition: String.h:59
Feature.h
OpenMS::MRMFeatureFilter
The MRMFeatureFilter either flags components and/or transitions that do not pass the QC criteria or f...
Definition: MRMFeatureFilter.h:62
OpenMS::DefaultParamHandler
A base class for all classes handling default parameters.
Definition: DefaultParamHandler.h:92
OpenMS
Main OpenMS namespace.
Definition: FeatureDeconvolution.h:46
OpenMS::MRMFeatureQC
The MRMFeatureQC is a class to handle the parameters and options for MRMFeatureFilter.
Definition: MRMFeatureQC.h:60
MRMFeature.h
FeatureMap.h
QcMLFile.h
MRMFeatureQC.h
OpenMS::StringList
std::vector< String > StringList
Vector of String.
Definition: ListUtils.h:70
OpenMS::FeatureMap
A container for features.
Definition: FeatureMap.h:97
OpenMS::Feature
An LC-MS feature.
Definition: Feature.h:70
String.h
OpenMS::Param
Management and storage of parameters / INI files.
Definition: Param.h:73
OpenMS::TargetedExperiment
A description of a targeted experiment containing precursor and production ions.
Definition: TargetedExperiment.h:64
TraMLFile.h