All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
BayesianProteinInferenceAlgorithm.h
Go to the documentation of this file.
1 // Copyright (c) 2002-present, OpenMS Inc. -- 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 
17 
18 #include <vector>
19 #include <functional>
20 #include <optional>
21 
22 namespace OpenMS
23 {
24  class ConsensusMap;
25  namespace Internal
26  {
27  class IDBoostGraph;
28  }
31 
50  class OPENMS_DLLAPI BayesianProteinInferenceAlgorithm :
51  public DefaultParamHandler,
52  public ProgressLogger
53  {
54  public:
56  explicit BayesianProteinInferenceAlgorithm(unsigned int debug_lvl = 0);
57 
59  ~BayesianProteinInferenceAlgorithm() override = default;
60 
61  void updateMembers_() override;
62 
65  class GraphInferenceFunctor;
66 
70  class ExtendedGraphInferenceFunctor;
71 
73  struct GridSearchEvaluator;
74 
75 
92  std::vector<ProteinIdentification>& proteinIDs,
93  PeptideIdentificationList& peptideIDs,
94  bool greedy_group_resolution,
95  std::optional<const ExperimentalDesign> exp_des = std::optional<const ExperimentalDesign>());
96 
109  ConsensusMap& cmap,
110  bool greedy_group_resolution,
111  std::optional<const ExperimentalDesign> exp_des = std::optional<const ExperimentalDesign>());
112 
113  private:
114 
118 
121  std::vector<double>& alpha_search,
122  std::vector<double>& beta_search,
123  std::vector<double>& gamma_search
124  );
125 
128 
130  // TODO double-check if -1 is maybe the better option
131  // to distinguish between "untouched/unused/unreferenced" (e.g. if somehow
132  // not removed/filtered) and an inferred probability of 0.0. But it might give
133  // problems in FDR algorithms if not ignored/removed correctly
134  void resetProteinScores_(ProteinIdentification& protein_id, bool keep_old_as_prior);
135 
138  std::function<void(PeptideIdentification&/*, const String& run_id*/)> checkConvertAndFilterPepHits_;
139 
140  unsigned int debug_lvl_;
141 
142  #ifdef INFERENCE_BENCH
143  std::vector<std::pair<double,Size>> debug_times_;
144  #endif
145 
146  };
147 }
Performs a Bayesian protein inference on Protein/Peptide identifications or ConsensusMap (experimenta...
Definition: BayesianProteinInferenceAlgorithm.h:53
void setScoreTypeAndSettings_(ProteinIdentification &proteinIDs)
set score type and settings for every ProteinID run processed
std::function< void(PeptideIdentification &)> checkConvertAndFilterPepHits_
Definition: BayesianProteinInferenceAlgorithm.h:138
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)
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:140
void inferPosteriorProbabilities(std::vector< ProteinIdentification > &proteinIDs, PeptideIdentificationList &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....
A container for consensus elements.
Definition: ConsensusMap.h:68
A base class for all classes handling default parameters.
Definition: DefaultParamHandler.h:66
Definition: GridSearch.h:80
Creates and maintains a boost graph based on the OpenMS ID datastructures.
Definition: IDBoostGraph.h:58
Container for peptide identifications from multiple spectra.
Definition: PeptideIdentificationList.h:66
Represents the set of candidates (SpectrumMatches) identified for a single precursor spectrum.
Definition: PeptideIdentification.h:63
Base class for all classes that want to report their progress.
Definition: ProgressLogger.h:27
Representation of a protein identification run.
Definition: ProteinIdentification.h:51
Main OpenMS namespace.
Definition: openswathalgo/include/OpenMS/OPENSWATHALGO/DATAACCESS/ISpectrumAccess.h:19