OpenMS
Observation.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 
14 
15 #include <boost/multi_index_container.hpp>
16 #include <boost/multi_index/ordered_index.hpp>
17 #include <boost/multi_index/composite_key.hpp>
18 #include <boost/multi_index/member.hpp>
19 
20 namespace OpenMS
21 {
22  namespace IdentificationDataInternal
23  {
28  {
31 
34 
35  double rt, mz; //< Position
36 
38  explicit Observation(
39  const String& data_id,
40  const InputFileRef& input_file,
41  double rt = std::numeric_limits<double>::quiet_NaN(),
42  double mz = std::numeric_limits<double>::quiet_NaN()):
44  {
45  }
46 
48  Observation& merge(const Observation& other)
49  {
50  // merge meta info - existing entries may be overwritten:
51  addMetaValues(other);
52  rt = other.rt;
53  mz = other.mz;
54  return *this;
55  }
56  };
57 
58  // combination of input file and data ID must be unique:
59  typedef boost::multi_index_container<
60  Observation,
61  boost::multi_index::indexed_by<
62  boost::multi_index::ordered_unique<
63  boost::multi_index::composite_key<
64  Observation,
65  boost::multi_index::member<Observation, InputFileRef,
67  boost::multi_index::member<Observation, String,
71  }
72 }
Interface for classes that can store arbitrary meta information (Type-Name-Value tuples).
Definition: MetaInfoInterface.h:35
void addMetaValues(const MetaInfoInterface &from)
function to copy all meta values from one object to this one
A more convenient string class.
Definition: String.h:34
boost::multi_index_container< Observation, boost::multi_index::indexed_by< boost::multi_index::ordered_unique< boost::multi_index::composite_key< Observation, boost::multi_index::member< Observation, InputFileRef, &Observation::input_file >, boost::multi_index::member< Observation, String, &Observation::data_id > > > > > Observations
Definition: Observation.h:69
IteratorWrapper< Observations::iterator > ObservationRef
Definition: Observation.h:70
IteratorWrapper< InputFiles::iterator > InputFileRef
Definition: include/OpenMS/METADATA/ID/InputFile.h:69
Main OpenMS namespace.
Definition: FeatureDeconvolution.h:22
Representation of an observation, e.g. a spectrum or feature, in an input data file.
Definition: Observation.h:28
Observation(const String &data_id, const InputFileRef &input_file, double rt=std::numeric_limits< double >::quiet_NaN(), double mz=std::numeric_limits< double >::quiet_NaN())
Constructor.
Definition: Observation.h:38
double mz
Definition: Observation.h:35
InputFileRef input_file
Reference to the input file.
Definition: Observation.h:33
String data_id
Spectrum or feature ID (from the file referenced by @t input_file)
Definition: Observation.h:30
double rt
Definition: Observation.h:35
Observation & merge(const Observation &other)
Merge in data from another object.
Definition: Observation.h:48