OpenMS
IDDecoyProbability.h
Go to the documentation of this file.
1 // Copyright (c) 2002-present, The OpenMS Team -- EKU Tuebingen, ETH Zurich, and FU Berlin
2 // SPDX-License-Identifier: BSD-3-Clause
3 //
4 // --------------------------------------------------------------------------
5 // $Maintainer: Timo Sachsenberg$
6 // $Authors: Andreas Bertsch$
7 // --------------------------------------------------------------------------
8 
9 #pragma once
10 
15 
16 #include <vector>
17 
18 namespace OpenMS
19 {
31  class OPENMS_DLLAPI IDDecoyProbability :
32  public DefaultParamHandler
33  {
34 public:
35 
38 
41 
43  ~IDDecoyProbability() override;
44 
47 
54  void apply(std::vector<PeptideIdentification> & prob_ids,
55  const std::vector<PeptideIdentification> & fwd_ids,
56  const std::vector<PeptideIdentification> & rev_ids);
57 
58  void apply(std::vector<PeptideIdentification> & ids);
59 
60 protected:
61 
67  {
69  max_intensity(0),
70  diff_score(0),
71  min_score(0),
72  max_score(0),
73  max_intensity_bin(0)
74  {
75  }
76 
78  max_intensity(rhs.max_intensity),
79  diff_score(rhs.diff_score),
80  min_score(rhs.min_score),
81  max_score(rhs.max_score),
82  max_intensity_bin(rhs.max_intensity_bin)
83  {
84  }
85 
87  {
88  if (this != &rhs)
89  {
90  max_intensity = rhs.max_intensity;
91  diff_score = rhs.diff_score;
92  min_score = rhs.min_score;
93  max_score = rhs.max_score;
94  max_intensity_bin = rhs.max_intensity_bin;
95  }
96  return *this;
97  }
98 
99  double max_intensity;
100  double diff_score;
101  double min_score;
102  double max_score;
104  };
105 
106  // normalizes histograms
107  void normalizeBins_(const std::vector<double> & scores, std::vector<double> & binned, Transformation_ & trafo);
108 
109  // returns the probability of given score with the transformations of reverse and forward searches and the results of the fits
111  const Transformation_ & gamma_trafo,
112  const Math::GaussFitter::GaussFitResult & result_gauss,
113  const Transformation_ & gauss_trafo,
114  double score);
115 
116 
117  void generateDistributionImage_(const std::vector<double> & ids, const String & formula, const String & filename);
118 
119  void generateDistributionImage_(const std::vector<double> & all_ids, const Transformation_ & all_trans, const String & fwd_formula, const String & rev_formula, const String & filename);
120 
121 
122  void apply_(std::vector<PeptideIdentification> & ids, const std::vector<double> & rev_scores, const std::vector<double> & fwd_scores, const std::vector<double> & all_scores);
123 
124  };
125 
126 } // namespace OpenMS
127 
A base class for all classes handling default parameters.
Definition: DefaultParamHandler.h:66
IDDecoyProbability calculates probabilities using decoy approach.
Definition: IDDecoyProbability.h:33
IDDecoyProbability()
Default constructor.
void generateDistributionImage_(const std::vector< double > &all_ids, const Transformation_ &all_trans, const String &fwd_formula, const String &rev_formula, const String &filename)
IDDecoyProbability(const IDDecoyProbability &rhs)
Copy constructor.
void apply(std::vector< PeptideIdentification > &ids)
void apply_(std::vector< PeptideIdentification > &ids, const std::vector< double > &rev_scores, const std::vector< double > &fwd_scores, const std::vector< double > &all_scores)
void normalizeBins_(const std::vector< double > &scores, std::vector< double > &binned, Transformation_ &trafo)
~IDDecoyProbability() override
Destructor.
void apply(std::vector< PeptideIdentification > &prob_ids, const std::vector< PeptideIdentification > &fwd_ids, const std::vector< PeptideIdentification > &rev_ids)
Converts the forward and reverse identification into probabilities.
void generateDistributionImage_(const std::vector< double > &ids, const String &formula, const String &filename)
double getProbability_(const Math::GammaDistributionFitter::GammaDistributionFitResult &result_gamma, const Transformation_ &gamma_trafo, const Math::GaussFitter::GaussFitResult &result_gauss, const Transformation_ &gauss_trafo, double score)
IDDecoyProbability & operator=(const IDDecoyProbability &rhs)
assignment operator
A more convenient string class.
Definition: String.h:34
size_t Size
Size type e.g. used as variable which can hold result of size()
Definition: Types.h:97
Main OpenMS namespace.
Definition: openswathalgo/include/OpenMS/OPENSWATHALGO/DATAACCESS/ISpectrumAccess.h:19
struct to be used to store a transformation (used for fitting)
Definition: IDDecoyProbability.h:67
Transformation_()
Definition: IDDecoyProbability.h:68
double diff_score
Definition: IDDecoyProbability.h:100
double max_intensity
Definition: IDDecoyProbability.h:99
Transformation_ & operator=(const Transformation_ &rhs)
Definition: IDDecoyProbability.h:86
double min_score
Definition: IDDecoyProbability.h:101
Size max_intensity_bin
Definition: IDDecoyProbability.h:103
Transformation_(const Transformation_ &rhs)
Definition: IDDecoyProbability.h:77
double max_score
Definition: IDDecoyProbability.h:102
struct to represent the parameters of a gamma distribution
Definition: GammaDistributionFitter.h:40
struct of parameters of a Gaussian distribution
Definition: GaussFitter.h:40