OpenMS
IdentifiedSequence.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 
15 
16 #include <boost/multi_index_container.hpp>
17 #include <boost/multi_index/ordered_index.hpp>
18 #include <boost/multi_index/member.hpp>
19 
20 namespace OpenMS
21 {
22  namespace IdentificationDataInternal
23  {
25  template <typename SeqType>
27  {
28  SeqType sequence;
29 
31 
33  const SeqType& sequence,
39  {
40  }
41 
42  IdentifiedSequence(const IdentifiedSequence& other) = default;
43 
45  {
47  // merge parent matches:
48  for (const auto& pair : other.parent_matches)
49  {
50  auto pos = parent_matches.find(pair.first);
51  if (pos == parent_matches.end()) // new entry
52  {
53  parent_matches.insert(pair);
54  }
55  else // merge entries
56  {
57  pos->second.insert(pair.second.begin(), pair.second.end());
58  }
59  }
60 
61  return *this;
62  }
63 
64  bool allParentsAreDecoys() const
65  {
66  if (parent_matches.empty())
67  {
68  String msg = "no parent found for identified molecule";
69  throw Exception::MissingInformation(__FILE__, __LINE__,
70  OPENMS_PRETTY_FUNCTION, msg);
71  }
72  for (const auto& pair : parent_matches)
73  {
74  if (!pair.first->is_decoy) return false;
75  }
76  return true;
77  }
78  };
79 
82 
83  // identified peptides indexed by their sequences:
84  typedef boost::multi_index_container<
86  boost::multi_index::indexed_by<
87  boost::multi_index::ordered_unique<boost::multi_index::member<
91 
92  // identified oligos indexed by their sequences:
93  typedef boost::multi_index_container<
95  boost::multi_index::indexed_by<
96  boost::multi_index::ordered_unique<boost::multi_index::member<
100 
101  }
102 }
Representation of a peptide/protein sequence.
Definition: AASequence.h:86
Not all required information provided.
Definition: Exception.h:162
Representation of a nucleic acid sequence.
Definition: NASequence.h:34
A more convenient string class.
Definition: String.h:34
IdentifiedSequence< NASequence > IdentifiedOligo
Definition: IdentifiedSequence.h:81
IteratorWrapper< IdentifiedOligos::iterator > IdentifiedOligoRef
Definition: IdentifiedSequence.h:99
IteratorWrapper< IdentifiedPeptides::iterator > IdentifiedPeptideRef
Definition: IdentifiedSequence.h:90
boost::multi_index_container< AppliedProcessingStep, boost::multi_index::indexed_by< boost::multi_index::sequenced<>, boost::multi_index::ordered_unique< boost::multi_index::member< AppliedProcessingStep, std::optional< ProcessingStepRef >, &AppliedProcessingStep::processing_step_opt > > > > AppliedProcessingSteps
Definition: AppliedProcessingStep.h:107
boost::multi_index_container< IdentifiedPeptide, boost::multi_index::indexed_by< boost::multi_index::ordered_unique< boost::multi_index::member< IdentifiedPeptide, AASequence, &IdentifiedPeptide::sequence > > > > IdentifiedPeptides
Definition: IdentifiedSequence.h:89
boost::multi_index_container< IdentifiedOligo, boost::multi_index::indexed_by< boost::multi_index::ordered_unique< boost::multi_index::member< IdentifiedOligo, NASequence, &IdentifiedOligo::sequence > > > > IdentifiedOligos
Definition: IdentifiedSequence.h:98
std::map< ParentSequenceRef, std::set< ParentMatch > > ParentMatches
mapping: parent sequence -> match information
Definition: ParentMatch.h:75
IdentifiedSequence< AASequence > IdentifiedPeptide
Definition: IdentifiedSequence.h:80
Main OpenMS namespace.
Definition: FeatureDeconvolution.h:22
Representation of an identified sequence (peptide or oligonucleotide)
Definition: IdentifiedSequence.h:27
IdentifiedSequence & merge(const IdentifiedSequence &other)
Definition: IdentifiedSequence.h:44
SeqType sequence
Definition: IdentifiedSequence.h:28
IdentifiedSequence(const IdentifiedSequence &other)=default
IdentifiedSequence(const SeqType &sequence, const ParentMatches &parent_matches=ParentMatches(), const AppliedProcessingSteps &steps_and_scores=AppliedProcessingSteps())
Definition: IdentifiedSequence.h:32
ParentMatches parent_matches
Definition: IdentifiedSequence.h:30
bool allParentsAreDecoys() const
Definition: IdentifiedSequence.h:64
Wrapper that adds operator< to iterators, so they can be used as (part of) keys in maps/sets or multi...
Definition: MetaData.h:20
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
ScoredProcessingResult & merge(const ScoredProcessingResult &other)
Merge in data from another object.
Definition: ScoredProcessingResult.h:81