OpenMS  3.0.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-2022.
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 
39 
41 #include <OpenMS/KERNEL/Feature.h>
43 
46 
47 namespace OpenMS
48 {
49  class AbsoluteQuantitationMethod;
50 
59  class OPENMS_DLLAPI MRMFeatureFilter :
60  public DefaultParamHandler
61  {
62 
63 public:
64 
68 
70  ~MRMFeatureFilter() override;
72 
78  void getDefaultParameters(Param& params) const;
79 
81  void updateMembers_() override;
82 
91  void FilterFeatureMap(FeatureMap& features, const MRMFeatureQC& filter_criteria,
92  const TargetedExperiment& transitions);
93 
106  void FilterFeatureMapPercRSD(FeatureMap& features, const MRMFeatureQC& filter_criteria, const MRMFeatureQC& filter_values);
107 
121  void FilterFeatureMapBackgroundInterference(FeatureMap& features, const MRMFeatureQC& filter_criteria, const MRMFeatureQC& filter_values);
122 
135  void EstimateDefaultMRMFeatureQCValues(const std::vector<FeatureMap>& samples, MRMFeatureQC& filter_template, const TargetedExperiment& transitions, const bool& init_template_values) const;
136 
145  void TransferLLOQAndULOQToCalculatedConcentrationBounds(const std::vector<AbsoluteQuantitationMethod>& quantitation_method, MRMFeatureQC& filter_template);
146 
157  void EstimatePercRSD(const std::vector<FeatureMap>& samples, MRMFeatureQC& filter_template, const TargetedExperiment& transitions) const;
158 
169  void EstimateBackgroundInterferences(const std::vector<FeatureMap>& samples, MRMFeatureQC& filter_template, const TargetedExperiment& transitions) const;
170 
181  double calculateIonRatio(const Feature& component_1, const Feature& component_2, const String& feature_name) const;
182 
191  double calculateRTDifference(Feature& component_1, Feature& component_2) const;
192 
201  double calculateResolution(Feature& component_1, Feature& component_2) const;
202 
214  bool checkMetaValue(
215  const Feature& component,
216  const String& meta_value_key,
217  const double& meta_value_l,
218  const double& meta_value_u,
219  bool& key_exists
220  ) const;
221 
231  void updateMetaValue(
232  const Feature& component,
233  const String& meta_value_key,
234  double& meta_value_l,
235  double& meta_value_u,
236  bool& key_exists
237  ) const;
238 
248  void setMetaValue(
249  const Feature& component,
250  const String& meta_value_key,
251  double& meta_value_l,
252  double& meta_value_u,
253  bool& key_exists
254  ) const;
255 
265  void initMetaValue(
266  const Feature& component,
267  const String& meta_value_key,
268  double& meta_value_l,
269  double& meta_value_u,
270  bool& key_exists
271  ) const;
272 
281  std::map<String,int> countLabelsAndTransitionTypes(const Feature& component_group,
282  const TargetedExperiment& transitions) const;
283 
291  StringList getUniqueSorted(const StringList& messages) const;
292 
301  void accumulateFilterValues(std::vector<MRMFeatureQC>& filter_values, const std::vector<FeatureMap>& samples, const MRMFeatureQC& filter_template, const TargetedExperiment& transitions) const;
302 
309  void zeroFilterValues(MRMFeatureQC& filter_zeros, const MRMFeatureQC& filter_template) const;
310 
318  void calculateFilterValuesMean(MRMFeatureQC& filter_mean, const std::vector<MRMFeatureQC>& filter_values, const MRMFeatureQC& filter_template) const;
319 
328  void calculateFilterValuesVar(MRMFeatureQC& filter_var, const std::vector<MRMFeatureQC>& filter_values, const MRMFeatureQC& filter_mean, const MRMFeatureQC& filter_template) const;
329 
337  void calculateFilterValuesPercRSD(MRMFeatureQC& filter_rsd, const MRMFeatureQC& filter_mean, const MRMFeatureQC& filter_var) const;
338 
340  template <typename T>
341  bool checkRange(const T& value, const T& value_l, const T& value_u) const;
342 
344  template <typename T>
345  void updateRange(const T& value, T& value_l, T& value_u) const;
346 
348  template <typename T>
349  void setRange(const T& value, T& value_l, T& value_u) const;
350 
352  template <typename T>
353  void initRange(const T& value, T& value_l, T& value_u) const;
354 
355 private:
356  // Members
359  };
360 }
361 
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:358
OpenMS::String
A more convenient string class.
Definition: String.h:58
Feature.h
OpenMS::MRMFeatureFilter
The MRMFeatureFilter either flags components and/or transitions that do not pass the QC criteria or f...
Definition: MRMFeatureFilter.h:59
OpenMS::DefaultParamHandler
A base class for all classes handling default parameters.
Definition: DefaultParamHandler.h:92
OpenMS
Main OpenMS namespace.
Definition: FeatureDeconvolution.h:47
OpenMS::MRMFeatureQC
The MRMFeatureQC is a class to handle the parameters and options for MRMFeatureFilter.
Definition: MRMFeatureQC.h:58
MRMFeature.h
FeatureMap.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:98
OpenMS::Feature
An LC-MS feature.
Definition: Feature.h:70
String.h
OpenMS::Param
Management and storage of parameters / INI files.
Definition: Param.h:69
OpenMS::TargetedExperiment
A description of a targeted experiment containing precursor and production ions.
Definition: TargetedExperiment.h:64