OpenMS
ConsensusMapMergerAlgorithm.h
Go to the documentation of this file.
1 // Copyright (c) 2002-2023, 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 
9 #pragma once
10 
16 
17 #include <unordered_set>
18 
19 namespace OpenMS
20 {
37  class OPENMS_DLLAPI ConsensusMapMergerAlgorithm:
38  public DefaultParamHandler,
39  public ProgressLogger
40  {
41  public:
43 
53 
58  void mergeAllIDRuns(ConsensusMap& cmap) const;
59 
65  const std::map<unsigned, unsigned>& mapIdx_to_new_protIDRun) const;
66 
67  private:
68 
73  bool checkOldRunConsistency_(const std::vector<ProteinIdentification>& protRuns, const String& experiment_type) const;
75  bool checkOldRunConsistency_(const std::vector<ProteinIdentification>& protRuns, const ProteinIdentification& ref, const String& experiment_type) const;
76 
77 
78  static size_t accessionHash_(const ProteinHit& p)
79  {
80  return std::hash<String>()(p.getAccession());
81  }
82  static bool accessionEqual_(const ProteinHit& p1, const ProteinHit& p2)
83  {
84  return p1.getAccession() == p2.getAccession();
85  }
86  using hash_type = std::size_t (*)(const ProteinHit&);
87  using equal_type = bool (*)(const ProteinHit&, const ProteinHit&);
88 
89  };
90 } // namespace OpenMS
Merges identification data in ConsensusMaps.
Definition: ConsensusMapMergerAlgorithm.h:40
bool(*)(const ProteinHit &, const ProteinHit &) equal_type
Definition: ConsensusMapMergerAlgorithm.h:87
void mergeAllIDRuns(ConsensusMap &cmap) const
void mergeProteinsAcrossFractionsAndReplicates(ConsensusMap &cmap, const ExperimentalDesign &exp_design) const
bool checkOldRunConsistency_(const std::vector< ProteinIdentification > &protRuns, const ProteinIdentification &ref, const String &experiment_type) const
Same as above but with specific reference run.
std::size_t(*)(const ProteinHit &) hash_type
Definition: ConsensusMapMergerAlgorithm.h:86
static size_t accessionHash_(const ProteinHit &p)
Definition: ConsensusMapMergerAlgorithm.h:78
void mergeProteinIDRuns(ConsensusMap &cmap, const std::map< unsigned, unsigned > &mapIdx_to_new_protIDRun) const
static bool accessionEqual_(const ProteinHit &p1, const ProteinHit &p2)
Definition: ConsensusMapMergerAlgorithm.h:82
bool checkOldRunConsistency_(const std::vector< ProteinIdentification > &protRuns, const String &experiment_type) const
A container for consensus elements.
Definition: ConsensusMap.h:66
A base class for all classes handling default parameters.
Definition: DefaultParamHandler.h:66
Representation of an experimental design in OpenMS. Instances can be loaded with the ExperimentalDesi...
Definition: ExperimentalDesign.h:219
Base class for all classes that want to report their progress.
Definition: ProgressLogger.h:27
Representation of a protein hit.
Definition: ProteinHit.h:34
const String & getAccession() const
returns the accession of the protein
Representation of a protein identification run.
Definition: ProteinIdentification.h:50
A more convenient string class.
Definition: String.h:34
Main OpenMS namespace.
Definition: FeatureDeconvolution.h:22