OpenMS  2.6.0
IDDecoyProbability.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-2020.
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: Timo Sachsenberg$
32 // $Authors: Andreas Bertsch$
33 // --------------------------------------------------------------------------
34 
35 #pragma once
36 
41 
42 #include <vector>
43 
44 namespace OpenMS
45 {
57  class OPENMS_DLLAPI IDDecoyProbability :
58  public DefaultParamHandler
59  {
60 public:
61 
64 
67 
69  ~IDDecoyProbability() override;
70 
72  IDDecoyProbability & operator=(const IDDecoyProbability & rhs);
73 
80  void apply(std::vector<PeptideIdentification> & prob_ids,
81  const std::vector<PeptideIdentification> & fwd_ids,
82  const std::vector<PeptideIdentification> & rev_ids);
83 
84  void apply(std::vector<PeptideIdentification> & ids);
85 
86 protected:
87 
93  {
95  max_intensity(0),
96  diff_score(0),
97  min_score(0),
98  max_score(0),
99  max_intensity_bin(0)
100  {
101  }
102 
104  max_intensity(rhs.max_intensity),
105  diff_score(rhs.diff_score),
106  min_score(rhs.min_score),
107  max_score(rhs.max_score),
108  max_intensity_bin(rhs.max_intensity_bin)
109  {
110  }
111 
113  {
114  if (this != &rhs)
115  {
116  max_intensity = rhs.max_intensity;
117  diff_score = rhs.diff_score;
118  min_score = rhs.min_score;
119  max_score = rhs.max_score;
120  max_intensity_bin = rhs.max_intensity_bin;
121  }
122  return *this;
123  }
124 
126  double diff_score;
127  double min_score;
128  double max_score;
130  };
131 
132  // normalizes histograms
133  void normalizeBins_(const std::vector<double> & scores, std::vector<double> & binned, Transformation_ & trafo);
134 
135  // returns the probability of given score with the transformations of reverse and forward searches and the results of the fits
136  double getProbability_(const Math::GammaDistributionFitter::GammaDistributionFitResult & result_gamma,
137  const Transformation_ & gamma_trafo,
138  const Math::GaussFitter::GaussFitResult & result_gauss,
139  const Transformation_ & gauss_trafo,
140  double score);
141 
142 
143  void generateDistributionImage_(const std::vector<double> & ids, const String & formula, const String & filename);
144 
145  void generateDistributionImage_(const std::vector<double> & all_ids, const Transformation_ & all_trans, const String & fwd_formula, const String & rev_formula, const String & filename);
146 
147 
148  void apply_(std::vector<PeptideIdentification> & ids, const std::vector<double> & rev_scores, const std::vector<double> & fwd_scores, const std::vector<double> & all_scores);
149 
150  };
151 
152 } // namespace OpenMS
153 
DefaultParamHandler.h
OpenMS::TOPPBase
Base class for TOPP applications.
Definition: TOPPBase.h:144
OpenMS::Param::copy
Param copy(const String &prefix, bool remove_prefix=false) const
Returns a new Param object containing all entries that start with prefix.
OpenMS::IDDecoyProbability::Transformation_::operator=
Transformation_ & operator=(const Transformation_ &rhs)
Definition: IDDecoyProbability.h:112
OpenMS::IdXMLFile::store
void store(const String &filename, const std::vector< ProteinIdentification > &protein_ids, const std::vector< PeptideIdentification > &peptide_ids, const String &document_id="")
Stores the data in an idXML file.
GaussFitter.h
OpenMS::IDDecoyProbability::Transformation_::diff_score
double diff_score
Definition: IDDecoyProbability.h:126
OpenMS::Math::GaussFitter::GaussFitResult
struct of parameters of a Gaussian distribution
Definition: GaussFitter.h:65
OpenMS::String
A more convenient string class.
Definition: String.h:59
OpenMS::IDDecoyProbability::Transformation_::Transformation_
Transformation_(const Transformation_ &rhs)
Definition: IDDecoyProbability.h:103
OpenMS::Size
size_t Size
Size type e.g. used as variable which can hold result of size()
Definition: Types.h:127
IdXMLFile.h
OpenMS::Math::GammaDistributionFitter::GammaDistributionFitResult
struct to represent the parameters of a gamma distribution
Definition: GammaDistributionFitter.h:65
OpenMS::IDDecoyProbability::Transformation_::max_score
double max_score
Definition: IDDecoyProbability.h:128
OpenMS::DefaultParamHandler
A base class for all classes handling default parameters.
Definition: DefaultParamHandler.h:92
OpenMS::IdXMLFile::load
void load(const String &filename, std::vector< ProteinIdentification > &protein_ids, std::vector< PeptideIdentification > &peptide_ids)
Loads the identifications of an idXML file without identifier.
OpenMS::IDDecoyProbability::Transformation_::Transformation_
Transformation_()
Definition: IDDecoyProbability.h:94
OpenMS
Main OpenMS namespace.
Definition: FeatureDeconvolution.h:46
OpenMS::IDDecoyProbability::Transformation_::min_score
double min_score
Definition: IDDecoyProbability.h:127
IDDecoyProbability.h
OpenMS::DefaultParamHandler::setParameters
void setParameters(const Param &param)
Sets the parameters.
OpenMS::DefaultParamHandler::getParameters
const Param & getParameters() const
Non-mutable access to the parameters.
main
int main(int argc, const char **argv)
Definition: INIFileEditor.cpp:73
OpenMS::IDDecoyProbability::apply
void apply(std::vector< PeptideIdentification > &prob_ids, const std::vector< PeptideIdentification > &fwd_ids, const std::vector< PeptideIdentification > &rev_ids)
GammaDistributionFitter.h
OpenMS::Param
Management and storage of parameters / INI files.
Definition: Param.h:73
OpenMS::IDDecoyProbability::Transformation_::max_intensity
double max_intensity
Definition: IDDecoyProbability.h:125
PeptideIdentification.h
OpenMS::IDDecoyProbability::Transformation_::max_intensity_bin
Size max_intensity_bin
Definition: IDDecoyProbability.h:129
OpenMS::IDDecoyProbability::Transformation_
struct to be used to store a transformation (used for fitting)
Definition: IDDecoyProbability.h:92
StandardTypes.h
OpenMS::IDDecoyProbability
IDDecoyProbability calculates probabilities using decoy approach.
Definition: IDDecoyProbability.h:57
TOPPBase.h
OpenMS::IdXMLFile
Used to load and store idXML files.
Definition: IdXMLFile.h:63