OpenMS
BasicProteinInferenceAlgorithm.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 
15 
16 namespace OpenMS
17 {
18 
34  class OPENMS_DLLAPI BasicProteinInferenceAlgorithm :
35  public DefaultParamHandler,
36  public ProgressLogger
37  {
38  public:
39 
40  typedef std::unordered_map<std::string, std::map<Int, PeptideHit*>> SequenceToChargeToPSM;
41 
45  enum class AggregationMethod
46  {
47  PROD,
48  SUM,
49  BEST
50  };
51 
54 
60  void run(std::vector<PeptideIdentification>& pep_ids, std::vector<ProteinIdentification>& prot_ids) const;
61 
67  void run(std::vector<PeptideIdentification>& pep_ids, ProteinIdentification& prot_id) const;
68 
76  void run(ConsensusMap& cmap, ProteinIdentification& prot_id, bool include_unassigned) const;
77 
78  private:
79 
90  std::unordered_map<std::string, std::pair<ProteinHit*, Size>>& acc_to_protein_hitP_and_count,
91  SequenceToChargeToPSM& best_pep,
92  ProteinIdentification& prot_run,
93  std::vector<PeptideIdentification>& pep_ids) const;
94 
104  SequenceToChargeToPSM& best_pep,
105  std::vector<PeptideIdentification>& pep_ids,
106  const String& overall_score_type,
107  bool higher_better,
108  const std::string& run_id) const;
109 
119  std::unordered_map<std::string, std::pair<ProteinHit*, Size>>& acc_to_protein_hitP_and_count,
120  const SequenceToChargeToPSM& best_pep,
121  bool pep_scores,
122  bool higher_better) const;
123 
125  AggregationMethod aggFromString_(const std::string& method_string) const;
126 
130  const String& score_type,
131  const AggregationMethod& aggregation_method
132  ) const;
133 
135  double getInitScoreForAggMethod_(const AggregationMethod& aggregation_method, bool higher_better) const;
136 
138  typedef double (*fptr)(double, double);
139  fptr aggFunFromEnum_(const BasicProteinInferenceAlgorithm::AggregationMethod& agg_method, bool higher_better) const;
140  };
141 } //namespace OpenMS
Algorithm class that implements simple protein inference by aggregation of peptide scores....
Definition: BasicProteinInferenceAlgorithm.h:37
void run(std::vector< PeptideIdentification > &pep_ids, ProteinIdentification &prot_id) const
BasicProteinInferenceAlgorithm()
Default constructor.
void updateProteinScores_(std::unordered_map< std::string, std::pair< ProteinHit *, Size >> &acc_to_protein_hitP_and_count, const SequenceToChargeToPSM &best_pep, bool pep_scores, bool higher_better) const
aggregates and updates protein scores based on aggregation settings and aggregated peptide level resu...
std::unordered_map< std::string, std::map< Int, PeptideHit * > > SequenceToChargeToPSM
Definition: BasicProteinInferenceAlgorithm.h:40
void processRun_(std::unordered_map< std::string, std::pair< ProteinHit *, Size >> &acc_to_protein_hitP_and_count, SequenceToChargeToPSM &best_pep, ProteinIdentification &prot_run, std::vector< PeptideIdentification > &pep_ids) const
Performs simple aggregation-based inference on one protein run.
void checkCompat_(const String &score_type, const AggregationMethod &aggregation_method) const
void run(ConsensusMap &cmap, ProteinIdentification &prot_id, bool include_unassigned) const
double getInitScoreForAggMethod_(const AggregationMethod &aggregation_method, bool higher_better) const
get the initial score value based on the chosen aggregation_method, higher_better is needed for "best...
void aggregatePeptideScores_(SequenceToChargeToPSM &best_pep, std::vector< PeptideIdentification > &pep_ids, const String &overall_score_type, bool higher_better, const std::string &run_id) const
fills and updates the map of best peptide scores best_pep (by sequence or modified sequence,...
void run(std::vector< PeptideIdentification > &pep_ids, std::vector< ProteinIdentification > &prot_ids) const
AggregationMethod
The aggregation method.
Definition: BasicProteinInferenceAlgorithm.h:46
AggregationMethod aggFromString_(const std::string &method_string) const
get the AggregationMethod enum from a method_string
fptr aggFunFromEnum_(const BasicProteinInferenceAlgorithm::AggregationMethod &agg_method, bool higher_better) const
A container for consensus elements.
Definition: ConsensusMap.h:66
A base class for all classes handling default parameters.
Definition: DefaultParamHandler.h:66
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
A more convenient string class.
Definition: String.h:34
Main OpenMS namespace.
Definition: openswathalgo/include/OpenMS/OPENSWATHALGO/DATAACCESS/ISpectrumAccess.h:19