OpenMS  2.4.0
AbsoluteQuantitation.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-2018.
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 
37 #include <OpenMS/config.h>
38 
39 //Kernal classes
47 
48 //Analysis classes
52 
53 //Quantitation classes
56 
57 
58 //Standard library
59 #include <cstddef> // for size_t & ptrdiff_t
60 #include <vector>
61 #include <string>
62 
63 namespace OpenMS
64 {
65 
84  class OPENMS_DLLAPI AbsoluteQuantitation :
85  public DefaultParamHandler
86  {
87 
88 public:
92 
96 
103  void setQuantMethods(std::vector<AbsoluteQuantitationMethod>& quant_methods);
104 
105 
109  std::vector<AbsoluteQuantitationMethod> getQuantMethods();
110  std::map<String, AbsoluteQuantitationMethod> getQuantMethodsAsMap();
111 
124  double calculateRatio(const Feature & component_1, const Feature & component_2, const String & feature_name);
125 
142  double calculateBias(const double & actual_concentration, const double & calculated_concentration);
143 
156  Param fitCalibration(const std::vector<AbsoluteQuantitationStandards::featureConcentration> & component_concentrations,
157  const String & feature_name,
158  const String & transformation_model,
159  const Param & transformation_model_params);
160 
173  void calculateBiasAndR(
174  const std::vector<AbsoluteQuantitationStandards::featureConcentration> & component_concentrations,
175  const String & feature_name,
176  const String & transformation_model,
177  const Param & transformation_model_params,
178  std::vector<double> & biases,
179  double & correlation_coefficient);
180 
196  bool optimizeCalibrationCurveIterative(
197  std::vector<AbsoluteQuantitationStandards::featureConcentration> & component_concentrations,
198  const String & feature_name,
199  const String & transformation_model,
200  const Param & transformation_model_params,
201  Param & optimized_params);
202 
212  void optimizeCalibrationCurves(std::map<String,std::vector<AbsoluteQuantitationStandards::featureConcentration>> & components_concentrations);
213 
223  void optimizeSingleCalibrationCurve(
224  const String& component_name,
225  std::vector<AbsoluteQuantitationStandards::featureConcentration>& component_concentrations
226  );
227 
242  double applyCalibration(const Feature & component,
243  const Feature & IS_component,
244  const String & feature_name,
245  const String & transformation_model,
246  const Param & transformation_model_params);
247 
261  void quantifyComponents(FeatureMap& unknowns);
262 
263 protected:
274  std::vector<AbsoluteQuantitationStandards::featureConcentration> extractComponents_(
275  const std::vector<AbsoluteQuantitationStandards::featureConcentration> & component_concentrations,
276  const std::vector<size_t>& component_concentrations_indices);
277 
292  int jackknifeOutlierCandidate_(
293  const std::vector<AbsoluteQuantitationStandards::featureConcentration>& component_concentrations,
294  const String & feature_name,
295  const String & transformation_model,
296  const Param & transformation_model_params);
297 
312  int residualOutlierCandidate_(
313  const std::vector<AbsoluteQuantitationStandards::featureConcentration>& component_concentrations,
314  const String & feature_name,
315  const String & transformation_model,
316  const Param & transformation_model_params);
317 
318 private:
320  void updateMembers_();
321 
322  size_t min_points_;
323  double max_bias_;
325  size_t max_iters_;
329 
330  // members
332  std::map<String, AbsoluteQuantitationMethod> quant_methods_;
333 
334  };
335 
336 }
337 
double min_correlation_coefficient_
Definition: AbsoluteQuantitation.h:324
A more convenient string class.
Definition: String.h:57
A container for features.
Definition: FeatureMap.h:93
Main OpenMS namespace.
Definition: FeatureDeconvolution.h:46
String optimization_method_
Definition: AbsoluteQuantitation.h:328
AbsoluteQuantitation is a class to support absolute or relative quantitation for targeted or untarget...
Definition: AbsoluteQuantitation.h:84
bool use_chauvenet_
Definition: AbsoluteQuantitation.h:327
String outlier_detection_method_
Definition: AbsoluteQuantitation.h:326
size_t min_points_
Definition: AbsoluteQuantitation.h:322
An LC-MS feature.
Definition: Feature.h:70
Management and storage of parameters / INI files.
Definition: Param.h:74
size_t max_iters_
Definition: AbsoluteQuantitation.h:325
std::map< String, AbsoluteQuantitationMethod > quant_methods_
map between components and quantitation methods
Definition: AbsoluteQuantitation.h:332
A base class for all classes handling default parameters.
Definition: DefaultParamHandler.h:91
double max_bias_
Definition: AbsoluteQuantitation.h:323