OpenMS
AbsoluteQuantitation.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 
11 #include <OpenMS/config.h>
12 
13 //Kernal classes
21 
22 //Analysis classes
26 
27 //Quantitation classes
30 
31 
32 //Standard library
33 #include <cstddef> // for size_t & ptrdiff_t
34 #include <vector>
35 #include <string>
36 
37 namespace OpenMS
38 {
39 
58  class OPENMS_DLLAPI AbsoluteQuantitation :
59  public DefaultParamHandler
60  {
61 
62 public:
66 
70 
77  void setQuantMethods(std::vector<AbsoluteQuantitationMethod>& quant_methods);
78 
79 
83  std::vector<AbsoluteQuantitationMethod> getQuantMethods();
84  std::map<String, AbsoluteQuantitationMethod> getQuantMethodsAsMap();
85 
98  double calculateRatio(const Feature & component_1, const Feature & component_2, const String & feature_name);
99 
116  double calculateBias(const double & actual_concentration, const double & calculated_concentration);
117 
130  Param fitCalibration(const std::vector<AbsoluteQuantitationStandards::featureConcentration> & component_concentrations,
131  const String & feature_name,
132  const String & transformation_model,
133  const Param & transformation_model_params);
134 
148  const std::vector<AbsoluteQuantitationStandards::featureConcentration> & component_concentrations,
149  const String & feature_name,
150  const String & transformation_model,
151  const Param & transformation_model_params,
152  std::vector<double> & biases,
153  double & correlation_coefficient);
154 
171  std::vector<AbsoluteQuantitationStandards::featureConcentration> & component_concentrations,
172  const String & feature_name,
173  const String & transformation_model,
174  const Param & transformation_model_params,
175  Param & optimized_params);
176 
186  void optimizeCalibrationCurves(std::map<String,std::vector<AbsoluteQuantitationStandards::featureConcentration>> & components_concentrations);
187 
198  const String& component_name,
199  std::vector<AbsoluteQuantitationStandards::featureConcentration>& component_concentrations
200  );
201 
216  double applyCalibration(const Feature & component,
217  const Feature & IS_component,
218  const String & feature_name,
219  const String & transformation_model,
220  const Param & transformation_model_params);
221 
236 
237 protected:
248  std::vector<AbsoluteQuantitationStandards::featureConcentration> extractComponents_(
249  const std::vector<AbsoluteQuantitationStandards::featureConcentration> & component_concentrations,
250  const std::vector<size_t>& component_concentrations_indices);
251 
267  const std::vector<AbsoluteQuantitationStandards::featureConcentration>& component_concentrations,
268  const String & feature_name,
269  const String & transformation_model,
270  const Param & transformation_model_params);
271 
287  const std::vector<AbsoluteQuantitationStandards::featureConcentration>& component_concentrations,
288  const String & feature_name,
289  const String & transformation_model,
290  const Param & transformation_model_params);
291 
292 private:
294  void updateMembers_() override;
295 
296  size_t min_points_;
297  double max_bias_;
299  size_t max_iters_;
303 
304  // members
306  std::map<String, AbsoluteQuantitationMethod> quant_methods_;
307 
308  };
309 
310 }
311 
AbsoluteQuantitation is a class to support absolute or relative quantitation for targeted or untarget...
Definition: AbsoluteQuantitation.h:60
int jackknifeOutlierCandidate_(const std::vector< AbsoluteQuantitationStandards::featureConcentration > &component_concentrations, const String &feature_name, const String &transformation_model, const Param &transformation_model_params)
This function computes a candidate outlier point by iteratively leaving one point out to find the one...
double calculateBias(const double &actual_concentration, const double &calculated_concentration)
This function calculates the bias of the calibration.
size_t max_iters_
Definition: AbsoluteQuantitation.h:299
double applyCalibration(const Feature &component, const Feature &IS_component, const String &feature_name, const String &transformation_model, const Param &transformation_model_params)
This function applies the calibration curve to the component.
double max_bias_
Definition: AbsoluteQuantitation.h:297
size_t min_points_
Definition: AbsoluteQuantitation.h:296
String outlier_detection_method_
Definition: AbsoluteQuantitation.h:300
Param fitCalibration(const std::vector< AbsoluteQuantitationStandards::featureConcentration > &component_concentrations, const String &feature_name, const String &transformation_model, const Param &transformation_model_params)
This function fits the calibration points to the model.
String optimization_method_
Definition: AbsoluteQuantitation.h:302
~AbsoluteQuantitation() override
Destructor.
double min_correlation_coefficient_
Definition: AbsoluteQuantitation.h:298
int residualOutlierCandidate_(const std::vector< AbsoluteQuantitationStandards::featureConcentration > &component_concentrations, const String &feature_name, const String &transformation_model, const Param &transformation_model_params)
This function computes a candidate outlier point by computing the residuals of all points to the line...
void optimizeSingleCalibrationCurve(const String &component_name, std::vector< AbsoluteQuantitationStandards::featureConcentration > &component_concentrations)
This function optimizes the parameters of the calibration for a single component.
std::map< String, AbsoluteQuantitationMethod > getQuantMethodsAsMap()
void setQuantMethods(std::vector< AbsoluteQuantitationMethod > &quant_methods)
quant_method setter. A list of AbsoluteQuantitationMethod classes are given as input and a map is con...
void optimizeCalibrationCurves(std::map< String, std::vector< AbsoluteQuantitationStandards::featureConcentration >> &components_concentrations)
This function optimizes the parameters of the calibration for a all components.
double calculateRatio(const Feature &component_1, const Feature &component_2, const String &feature_name)
This function calculates the ratio between features.
std::vector< AbsoluteQuantitationStandards::featureConcentration > extractComponents_(const std::vector< AbsoluteQuantitationStandards::featureConcentration > &component_concentrations, const std::vector< size_t > &component_concentrations_indices)
This function extracts out the components.
void calculateBiasAndR(const std::vector< AbsoluteQuantitationStandards::featureConcentration > &component_concentrations, const String &feature_name, const String &transformation_model, const Param &transformation_model_params, std::vector< double > &biases, double &correlation_coefficient)
This function calculates the biases and the correlation coefficient of the calibration points.
std::map< String, AbsoluteQuantitationMethod > quant_methods_
map between components and quantitation methods
Definition: AbsoluteQuantitation.h:306
void quantifyComponents(FeatureMap &unknowns)
This function applies the calibration curve to all components.
void updateMembers_() override
Synchronize members with param class.
bool use_chauvenet_
Definition: AbsoluteQuantitation.h:301
bool optimizeCalibrationCurveIterative(std::vector< AbsoluteQuantitationStandards::featureConcentration > &component_concentrations, const String &feature_name, const String &transformation_model, const Param &transformation_model_params, Param &optimized_params)
This function optimizes the parameters of the calibration for a given component iteratively.
std::vector< AbsoluteQuantitationMethod > getQuantMethods()
quant_method getter. A list of AbsoluteQuantitationMethod classes are returned.
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
Management and storage of parameters / INI files.
Definition: Param.h:44
A more convenient string class.
Definition: String.h:34
Main OpenMS namespace.
Definition: FeatureDeconvolution.h:22