OpenMS
ObservationMatchGroup.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: Hendrik Weisser $
6 // $Authors: Hendrik Weisser $
7 // --------------------------------------------------------------------------
8 
9 #pragma once
10 
12 
13 #include <boost/multi_index_container.hpp>
14 #include <boost/multi_index/ordered_index.hpp>
15 
16 namespace OpenMS
17 {
18  namespace IdentificationDataInternal
19  {
25  {
26  std::set<ObservationMatchRef> observation_match_refs;
27 
28  bool allSameMolecule() const
29  {
30  // @TODO: return true or false for the empty set?
31  if (observation_match_refs.size() <= 1) return true;
32  const IdentifiedMolecule var =
33  (*observation_match_refs.begin())->identified_molecule_var;
34  for (auto it = ++observation_match_refs.begin();
35  it != observation_match_refs.end(); ++it)
36  {
37  if (!((*it)->identified_molecule_var == var)) return false;
38  }
39  return true;
40  }
41 
42  bool allSameQuery() const
43  {
44  // @TODO: return true or false for the empty set?
45  if (observation_match_refs.size() <= 1) return true;
46  ObservationRef ref = (*observation_match_refs.begin())->observation_ref;
47  for (auto it = ++observation_match_refs.begin();
48  it != observation_match_refs.end(); ++it)
49  {
50  if ((*it)->observation_ref != ref) return false;
51  }
52  return true;
53  }
54 
55  bool operator==(const ObservationMatchGroup& rhs) const
56  {
59  }
60 
61  bool operator!=(const ObservationMatchGroup& rhs) const
62  {
63  return !operator==(rhs);
64  }
65  };
66 
67  typedef boost::multi_index_container<
68  ObservationMatchGroup,
69  boost::multi_index::indexed_by<
70  boost::multi_index::ordered_unique<
71  boost::multi_index::member<ObservationMatchGroup, std::set<ObservationMatchRef>,
75  }
76 }
IteratorWrapper< ObservationMatchGroups::iterator > MatchGroupRef
Definition: ObservationMatchGroup.h:74
boost::multi_index_container< ObservationMatchGroup, boost::multi_index::indexed_by< boost::multi_index::ordered_unique< boost::multi_index::member< ObservationMatchGroup, std::set< ObservationMatchRef >, &ObservationMatchGroup::observation_match_refs > > > > ObservationMatchGroups
Definition: ObservationMatchGroup.h:73
Main OpenMS namespace.
Definition: FeatureDeconvolution.h:22
Variant type holding Peptide/Compound/Oligo references and convenience functions.
Definition: IdentifiedMolecule.h:29
: Group of related (co-identified) input matches
Definition: ObservationMatchGroup.h:25
bool allSameQuery() const
Definition: ObservationMatchGroup.h:42
bool operator==(const ObservationMatchGroup &rhs) const
Definition: ObservationMatchGroup.h:55
bool operator!=(const ObservationMatchGroup &rhs) const
Definition: ObservationMatchGroup.h:61
bool allSameMolecule() const
Definition: ObservationMatchGroup.h:28
std::set< ObservationMatchRef > observation_match_refs
Definition: ObservationMatchGroup.h:26
Base class for ID data with scores and processing steps (and meta info)
Definition: ScoredProcessingResult.h:19
AppliedProcessingSteps steps_and_scores
Definition: ScoredProcessingResult.h:20