OpenMS  3.0.0
BasicProteinInferenceAlgorithm.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-2022.
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: Julianus Pfeuffer $
32 // $Authors: Julianus Pfeuffer $
33 // --------------------------------------------------------------------------
34 #pragma once
35 
41 
42 namespace OpenMS
43 {
44 
60  class OPENMS_DLLAPI BasicProteinInferenceAlgorithm :
61  public DefaultParamHandler,
62  public ProgressLogger
63  {
64  public:
65 
66  typedef std::unordered_map<std::string, std::map<Int, PeptideHit*>> SequenceToChargeToPSM;
67 
71  enum class AggregationMethod
72  {
73  PROD,
74  SUM,
75  BEST
76  };
77 
80 
86  void run(std::vector<PeptideIdentification>& pep_ids, std::vector<ProteinIdentification>& prot_ids) const;
87 
93  void run(std::vector<PeptideIdentification>& pep_ids, ProteinIdentification& prot_id) const;
94 
102  void run(ConsensusMap& cmap, ProteinIdentification& prot_id, bool include_unassigned) const;
103 
104  private:
105 
115  void processRun_(
116  std::unordered_map<std::string, std::pair<ProteinHit*, Size>>& acc_to_protein_hitP_and_count,
117  SequenceToChargeToPSM& best_pep,
118  ProteinIdentification& prot_run,
119  std::vector<PeptideIdentification>& pep_ids) const;
120 
129  void aggregatePeptideScores_(
130  SequenceToChargeToPSM& best_pep,
131  std::vector<PeptideIdentification>& pep_ids,
132  const String& overall_score_type,
133  bool higher_better,
134  const std::string& run_id) const;
135 
144  void updateProteinScores_(
145  std::unordered_map<std::string, std::pair<ProteinHit*, Size>>& acc_to_protein_hitP_and_count,
146  const SequenceToChargeToPSM& best_pep,
147  bool pep_scores,
148  bool higher_better) const;
149 
151  AggregationMethod aggFromString_(const std::string& method_string) const;
152 
155  void checkCompat_(
156  const String& score_type,
157  const AggregationMethod& aggregation_method
158  ) const;
159 
161  double getInitScoreForAggMethod_(const AggregationMethod& aggregation_method, bool higher_better) const;
162 
164  typedef double (*fptr)(double, double);
165  fptr aggFunFromEnum_(const BasicProteinInferenceAlgorithm::AggregationMethod& agg_method, bool higher_better) const;
166  };
167 } //namespace OpenMS
DefaultParamHandler.h
double
OpenMS::String
A more convenient string class.
Definition: String.h:58
ConsensusMap.h
OpenMS::ProteinIdentification
Representation of a protein identification run.
Definition: ProteinIdentification.h:70
OpenMS::DefaultParamHandler
A base class for all classes handling default parameters.
Definition: DefaultParamHandler.h:92
OpenMS
Main OpenMS namespace.
Definition: FeatureDeconvolution.h:47
OpenMS::BasicProteinInferenceAlgorithm
Algorithm class that implements simple protein inference by aggregation of peptide scores....
Definition: BasicProteinInferenceAlgorithm.h:60
PeptideHit.h
OpenMS::ProgressLogger
Base class for all classes that want to report their progress.
Definition: ProgressLogger.h:52
ProgressLogger.h
OpenMS::BasicProteinInferenceAlgorithm::SequenceToChargeToPSM
std::unordered_map< std::string, std::map< Int, PeptideHit * > > SequenceToChargeToPSM
Definition: BasicProteinInferenceAlgorithm.h:66
ProteinIdentification.h
OpenMS::ConsensusMap
A container for consensus elements.
Definition: ConsensusMap.h:82
OpenMS::IntensityAveragingMethod::SUM
OpenMS::BasicProteinInferenceAlgorithm::AggregationMethod
AggregationMethod
The aggregation method.
Definition: BasicProteinInferenceAlgorithm.h:71