OpenMS
MRMFeatureFilter.h
Go to the documentation of this file.
1 // Copyright (c) 2002-2023, The OpenMS Team -- EKU Tuebingen, ETH Zurich, and FU Berlin
2 // SPDX-License-Identifier: BSD-3-Clause
3 //
4 // --------------------------------------------------------------------------
5 // $Maintainer: Douglas McCloskey, Pasquale Domenico Colaianni $
6 // $Authors: Douglas McCloskey, Pasquale Domenico Colaianni $
7 // --------------------------------------------------------------------------
8 
9 #pragma once
10 
13 
15 #include <OpenMS/KERNEL/Feature.h>
17 
20 
21 namespace OpenMS
22 {
23  class AbsoluteQuantitationMethod;
24 
33  class OPENMS_DLLAPI MRMFeatureFilter :
34  public DefaultParamHandler
35  {
36 
37 public:
38 
42 
44  ~MRMFeatureFilter() override;
46 
52  void getDefaultParameters(Param& params) const;
53 
55  void updateMembers_() override;
56 
65  void FilterFeatureMap(FeatureMap& features, const MRMFeatureQC& filter_criteria,
66  const TargetedExperiment& transitions);
67 
80  void FilterFeatureMapPercRSD(FeatureMap& features, const MRMFeatureQC& filter_criteria, const MRMFeatureQC& filter_values);
81 
95  void FilterFeatureMapBackgroundInterference(FeatureMap& features, const MRMFeatureQC& filter_criteria, const MRMFeatureQC& filter_values);
96 
109  void EstimateDefaultMRMFeatureQCValues(const std::vector<FeatureMap>& samples, MRMFeatureQC& filter_template, const TargetedExperiment& transitions, const bool& init_template_values) const;
110 
119  void TransferLLOQAndULOQToCalculatedConcentrationBounds(const std::vector<AbsoluteQuantitationMethod>& quantitation_method, MRMFeatureQC& filter_template);
120 
131  void EstimatePercRSD(const std::vector<FeatureMap>& samples, MRMFeatureQC& filter_template, const TargetedExperiment& transitions) const;
132 
143  void EstimateBackgroundInterferences(const std::vector<FeatureMap>& samples, MRMFeatureQC& filter_template, const TargetedExperiment& transitions) const;
144 
155  double calculateIonRatio(const Feature& component_1, const Feature& component_2, const String& feature_name) const;
156 
165  double calculateRTDifference(Feature& component_1, Feature& component_2) const;
166 
175  double calculateResolution(Feature& component_1, Feature& component_2) const;
176 
189  const Feature& component,
190  const String& meta_value_key,
191  const double& meta_value_l,
192  const double& meta_value_u,
193  bool& key_exists
194  ) const;
195 
206  const Feature& component,
207  const String& meta_value_key,
208  double& meta_value_l,
209  double& meta_value_u,
210  bool& key_exists
211  ) const;
212 
223  const Feature& component,
224  const String& meta_value_key,
225  double& meta_value_l,
226  double& meta_value_u,
227  bool& key_exists
228  ) const;
229 
240  const Feature& component,
241  const String& meta_value_key,
242  double& meta_value_l,
243  double& meta_value_u,
244  bool& key_exists
245  ) const;
246 
255  std::map<String,int> countLabelsAndTransitionTypes(const Feature& component_group,
256  const TargetedExperiment& transitions) const;
257 
265  StringList getUniqueSorted(const StringList& messages) const;
266 
275  void accumulateFilterValues(std::vector<MRMFeatureQC>& filter_values, const std::vector<FeatureMap>& samples, const MRMFeatureQC& filter_template, const TargetedExperiment& transitions) const;
276 
283  void zeroFilterValues(MRMFeatureQC& filter_zeros, const MRMFeatureQC& filter_template) const;
284 
292  void calculateFilterValuesMean(MRMFeatureQC& filter_mean, const std::vector<MRMFeatureQC>& filter_values, const MRMFeatureQC& filter_template) const;
293 
302  void calculateFilterValuesVar(MRMFeatureQC& filter_var, const std::vector<MRMFeatureQC>& filter_values, const MRMFeatureQC& filter_mean, const MRMFeatureQC& filter_template) const;
303 
311  void calculateFilterValuesPercRSD(MRMFeatureQC& filter_rsd, const MRMFeatureQC& filter_mean, const MRMFeatureQC& filter_var) const;
312 
314  template <typename T>
315  bool checkRange(const T& value, const T& value_l, const T& value_u) const;
316 
318  template <typename T>
319  void updateRange(const T& value, T& value_l, T& value_u) const;
320 
322  template <typename T>
323  void setRange(const T& value, T& value_l, T& value_u) const;
324 
326  template <typename T>
327  void initRange(const T& value, T& value_l, T& value_u) const;
328 
329 private:
330  // Members
333  };
334 }
335 
A base class for all classes handling default parameters.
Definition: DefaultParamHandler.h:66
A container for features.
Definition: FeatureMap.h:80
An LC-MS feature.
Definition: Feature.h:46
The MRMFeatureFilter either flags components and/or transitions that do not pass the QC criteria or f...
Definition: MRMFeatureFilter.h:35
void updateRange(const T &value, T &value_l, T &value_u) const
Updates value_l and value_u according to whether value is greater than value_u or less than value_l.
void setMetaValue(const Feature &component, const String &meta_value_key, double &meta_value_l, double &meta_value_u, bool &key_exists) const
Uses the supplied value to set the metaValue ranges.
void calculateFilterValuesMean(MRMFeatureQC &filter_mean, const std::vector< MRMFeatureQC > &filter_values, const MRMFeatureQC &filter_template) const
Calculate the mean of each MRMFeatureQC parameter from a list of MRMFeatureQC classes.
void FilterFeatureMapPercRSD(FeatureMap &features, const MRMFeatureQC &filter_criteria, const MRMFeatureQC &filter_values)
Flags or filters features and subordinates in a FeatureMap based on a user defined set of filter valu...
std::map< String, int > countLabelsAndTransitionTypes(const Feature &component_group, const TargetedExperiment &transitions) const
Count the number of heavy/light labels and quantifying/detecting/identifying transitions.
void TransferLLOQAndULOQToCalculatedConcentrationBounds(const std::vector< AbsoluteQuantitationMethod > &quantitation_method, MRMFeatureQC &filter_template)
Transfer the lower and upper bound values for the calculated concentrations based off of the Absolute...
String flag_or_filter_
flag or filter (i.e., remove) features that do not pass the QC
Definition: MRMFeatureFilter.h:332
StringList getUniqueSorted(const StringList &messages) const
Sorts the messages and returns a copy without duplicates.
void FilterFeatureMapBackgroundInterference(FeatureMap &features, const MRMFeatureQC &filter_criteria, const MRMFeatureQC &filter_values)
Flags or filters features and subordinates in a FeatureMap based on a user defined set of filter valu...
double calculateRTDifference(Feature &component_1, Feature &component_2) const
Calculates the retention time difference between two features.
void zeroFilterValues(MRMFeatureQC &filter_zeros, const MRMFeatureQC &filter_template) const
Set all members in MRMFeatureQC to zero.
void initRange(const T &value, T &value_l, T &value_u) const
Sets value_l and value_u to value.
void EstimateDefaultMRMFeatureQCValues(const std::vector< FeatureMap > &samples, MRMFeatureQC &filter_template, const TargetedExperiment &transitions, const bool &init_template_values) const
Estimate the lower and upper bound values for the MRMFeatureQC class based on a user supplied templat...
bool checkMetaValue(const Feature &component, const String &meta_value_key, const double &meta_value_l, const double &meta_value_u, bool &key_exists) const
Checks if the metaValue is within the user specified range.
double calculateResolution(Feature &component_1, Feature &component_2) const
Calculates the resolution between two features.
void EstimateBackgroundInterferences(const std::vector< FeatureMap > &samples, MRMFeatureQC &filter_template, const TargetedExperiment &transitions) const
Estimate the background interference level based on the average values from Blank samples....
void FilterFeatureMap(FeatureMap &features, const MRMFeatureQC &filter_criteria, const TargetedExperiment &transitions)
Flags or filters features and subordinates in a FeatureMap.
void updateMembers_() override
Synchronize members with param class.
double calculateIonRatio(const Feature &component_1, const Feature &component_2, const String &feature_name) const
Calculates the ion ratio between two transitions.
void initMetaValue(const Feature &component, const String &meta_value_key, double &meta_value_l, double &meta_value_u, bool &key_exists) const
Uses the supplied value to initialize the metaValue ranges to the same value.
void accumulateFilterValues(std::vector< MRMFeatureQC > &filter_values, const std::vector< FeatureMap > &samples, const MRMFeatureQC &filter_template, const TargetedExperiment &transitions) const
Accumulate feature values from a list of FeatureMaps.
bool checkRange(const T &value, const T &value_l, const T &value_u) const
Checks that the range of value is bracketed by value_l and value_u.
void EstimatePercRSD(const std::vector< FeatureMap > &samples, MRMFeatureQC &filter_template, const TargetedExperiment &transitions) const
Estimate the feature variability as measured by PercentRSD from multiple pooled QC samples or replica...
void setRange(const T &value, T &value_l, T &value_u) const
Sets value_l and value_u to bracket the range 0 to value or value to 0 depending on if value is >0.
~MRMFeatureFilter() override
Destructor.
void getDefaultParameters(Param &params) const
Get the class' default parameters.
void updateMetaValue(const Feature &component, const String &meta_value_key, double &meta_value_l, double &meta_value_u, bool &key_exists) const
Updates the metaValue ranges based on the value given.
void calculateFilterValuesPercRSD(MRMFeatureQC &filter_rsd, const MRMFeatureQC &filter_mean, const MRMFeatureQC &filter_var) const
Calculate the relative standard deviation (PercentRSD) of each MRMFeatureQC parameter from pre-comput...
void calculateFilterValuesVar(MRMFeatureQC &filter_var, const std::vector< MRMFeatureQC > &filter_values, const MRMFeatureQC &filter_mean, const MRMFeatureQC &filter_template) const
Calculate the var of each MRMFeatureQC parameter from a list of MRMFeatureQC classes.
The MRMFeatureQC is a class to handle the parameters and options for MRMFeatureFilter.
Definition: MRMFeatureQC.h:33
Management and storage of parameters / INI files.
Definition: Param.h:44
A more convenient string class.
Definition: String.h:34
A description of a targeted experiment containing precursor and production ions.
Definition: TargetedExperiment.h:39
std::vector< String > StringList
Vector of String.
Definition: ListUtils.h:44
Main OpenMS namespace.
Definition: FeatureDeconvolution.h:22