OpenMS
BayesianProteinInferenceAlgorithm.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: Julianus Pfeuffer $
6 // $Authors: Julianus Pfeuffer $
7 // --------------------------------------------------------------------------
8 #pragma once
9 
10 //#define INFERENCE_BENCH
11 
16 
17 #include <vector>
18 #include <functional>
19 #include <optional>
20 
21 namespace OpenMS
22 {
23  class ConsensusMap;
24  namespace Internal
25  {
26  class IDBoostGraph;
27  }
30 
49  class OPENMS_DLLAPI BayesianProteinInferenceAlgorithm :
50  public DefaultParamHandler,
51  public ProgressLogger
52  {
53  public:
55  explicit BayesianProteinInferenceAlgorithm(unsigned int debug_lvl = 0);
56 
58  ~BayesianProteinInferenceAlgorithm() override = default;
59 
60  void updateMembers_() override;
61 
64  class GraphInferenceFunctor;
65 
69  class ExtendedGraphInferenceFunctor;
70 
72  struct GridSearchEvaluator;
73 
74 
91  std::vector<ProteinIdentification>& proteinIDs,
92  std::vector<PeptideIdentification>& peptideIDs,
93  bool greedy_group_resolution,
94  std::optional<const ExperimentalDesign> exp_des = std::optional<const ExperimentalDesign>());
95 
108  ConsensusMap& cmap,
109  bool greedy_group_resolution,
110  std::optional<const ExperimentalDesign> exp_des = std::optional<const ExperimentalDesign>());
111 
112  private:
113 
117 
120  std::vector<double>& alpha_search,
121  std::vector<double>& beta_search,
122  std::vector<double>& gamma_search
123  );
124 
127 
129  // TODO double-check if -1 is maybe the better option
130  // to distinguish between "untouched/unused/unreferenced" (e.g. if somehow
131  // not removed/filtered) and an inferred probability of 0.0. But it might give
132  // problems in FDR algorithms if not ignored/removed correctly
133  void resetProteinScores_(ProteinIdentification& protein_id, bool keep_old_as_prior);
134 
137  std::function<void(PeptideIdentification&/*, const String& run_id*/)> checkConvertAndFilterPepHits_;
138 
139  unsigned int debug_lvl_;
140 
141  #ifdef INFERENCE_BENCH
142  std::vector<std::pair<double,Size>> debug_times_;
143  #endif
144 
145  };
146 }
Performs a Bayesian protein inference on Protein/Peptide identifications or ConsensusMap (experimenta...
Definition: BayesianProteinInferenceAlgorithm.h:52
void setScoreTypeAndSettings_(ProteinIdentification &proteinIDs)
set score type and settings for every ProteinID run processed
std::function< void(PeptideIdentification &)> checkConvertAndFilterPepHits_
Definition: BayesianProteinInferenceAlgorithm.h:137
void resetProteinScores_(ProteinIdentification &protein_id, bool keep_old_as_prior)
reset all protein scores to 0.0, save old ones as Prior MetaValue if requested
~BayesianProteinInferenceAlgorithm() override=default
Destructor.
GridSearch< double, double, double > initGridSearchFromParams_(std::vector< double > &alpha_search, std::vector< double > &beta_search, std::vector< double > &gamma_search)
read Param object and set the grid
void inferPosteriorProbabilities_(Internal::IDBoostGraph &ibg)
void inferPosteriorProbabilities(std::vector< ProteinIdentification > &proteinIDs, std::vector< PeptideIdentification > &peptideIDs, bool greedy_group_resolution, std::optional< const ExperimentalDesign > exp_des=std::optional< const ExperimentalDesign >())
Perform inference. Filter, build graph, run the private inferPosteriorProbabilities_ function....
BayesianProteinInferenceAlgorithm(unsigned int debug_lvl=0)
Constructor.
void inferPosteriorProbabilities(ConsensusMap &cmap, bool greedy_group_resolution, std::optional< const ExperimentalDesign > exp_des=std::optional< const ExperimentalDesign >())
Perform inference. Filter, build graph, run the private inferPosteriorProbabilities_ function....
void updateMembers_() override
This method is used to update extra member variables at the end of the setParameters() method.
unsigned int debug_lvl_
Definition: BayesianProteinInferenceAlgorithm.h:139
A container for consensus elements.
Definition: ConsensusMap.h:66
A base class for all classes handling default parameters.
Definition: DefaultParamHandler.h:66
Definition: GridSearch.h:73
Creates and maintains a boost graph based on the OpenMS ID datastructures.
Definition: IDBoostGraph.h:57
Represents the peptide hits for a spectrum.
Definition: PeptideIdentification.h:39
Base class for all classes that want to report their progress.
Definition: ProgressLogger.h:27
Representation of a protein identification run.
Definition: ProteinIdentification.h:50
Main OpenMS namespace.
Definition: openswathalgo/include/OpenMS/OPENSWATHALGO/DATAACCESS/ISpectrumAccess.h:19