OpenMS
BasicProteinInferenceAlgorithm.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 
16 
17 namespace OpenMS
18 {
19 
35  class OPENMS_DLLAPI BasicProteinInferenceAlgorithm :
36  public DefaultParamHandler,
37  public ProgressLogger
38  {
39  public:
40 
41  typedef std::unordered_map<std::string, std::map<Int, PeptideHit*>> SequenceToChargeToPSM;
42 
46  enum class AggregationMethod
47  {
48  PROD,
49  SUM,
50  BEST
51  };
52 
55 
61  void run(std::vector<PeptideIdentification>& pep_ids, std::vector<ProteinIdentification>& prot_ids) const;
62 
68  void run(std::vector<PeptideIdentification>& pep_ids, ProteinIdentification& prot_id) const;
69 
77  void run(ConsensusMap& cmap, ProteinIdentification& prot_id, bool include_unassigned) const;
78 
79  private:
80 
91  std::unordered_map<std::string, std::pair<ProteinHit*, Size>>& acc_to_protein_hitP_and_count,
92  SequenceToChargeToPSM& best_pep,
93  ProteinIdentification& prot_run,
94  std::vector<PeptideIdentification>& pep_ids) const;
95 
105  SequenceToChargeToPSM& best_pep,
106  std::vector<PeptideIdentification>& pep_ids,
107  const String& overall_score_type,
108  bool higher_better,
109  const std::string& run_id) const;
110 
120  std::unordered_map<std::string, std::pair<ProteinHit*, Size>>& acc_to_protein_hitP_and_count,
121  const SequenceToChargeToPSM& best_pep,
122  bool pep_scores,
123  bool higher_better) const;
124 
126  AggregationMethod aggFromString_(const std::string& method_string) const;
127 
131  const String& score_type,
132  const AggregationMethod& aggregation_method
133  ) const;
134 
138  const IDScoreSwitcherAlgorithm::ScoreType& score_type,
139  const AggregationMethod& aggregation_method
140  ) const;
141 
143  double getInitScoreForAggMethod_(const AggregationMethod& aggregation_method, bool higher_better) const;
144 
146  typedef double (*fptr)(double, double);
147  fptr aggFunFromEnum_(const BasicProteinInferenceAlgorithm::AggregationMethod& agg_method, bool higher_better) const;
148  };
149 } //namespace OpenMS
Algorithm class that implements simple protein inference by aggregation of peptide scores....
Definition: BasicProteinInferenceAlgorithm.h:38
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...
void checkCompat_(const IDScoreSwitcherAlgorithm::ScoreType &score_type, const AggregationMethod &aggregation_method) const
std::unordered_map< std::string, std::map< Int, PeptideHit * > > SequenceToChargeToPSM
Definition: BasicProteinInferenceAlgorithm.h:41
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:47
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
ScoreType
This is a rough hierarchy of possible score types in MS.
Definition: IDScoreSwitcherAlgorithm.h:53
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