OpenMS  2.6.0
ParentMolecule.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-2020.
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: Hendrik Weisser $
32 // $Authors: Hendrik Weisser $
33 // --------------------------------------------------------------------------
34 
35 #pragma once
36 
38 
39 #include <boost/multi_index_container.hpp>
40 #include <boost/multi_index/ordered_index.hpp>
41 #include <boost/multi_index/member.hpp>
42 
43 namespace OpenMS
44 {
45  namespace IdentificationDataInternal
46  {
50  {
52 
54 
55  // @TODO: if there are modifications in the sequence, "sequence.size()"
56  // etc. will be misleading!
58 
60 
61  double coverage;
62 
63  bool is_decoy;
64 
65  explicit ParentMolecule(
66  const String& accession,
68  const String& sequence = "", const String& description = "",
69  double coverage = 0.0, bool is_decoy = false,
75  {
76  }
77 
78  ParentMolecule(const ParentMolecule&) = default;
79 
81  {
83  if (sequence.empty()) sequence = other.sequence;
84  if (description.empty()) description = other.description;
85  if (!is_decoy) is_decoy = other.is_decoy; // believe it when it's set
86  // @TODO: what about coverage? (not reliable if we're merging data)
87 
88  return *this;
89  }
90  };
91 
92  // parent molecules indexed by their accessions:
93  // @TODO: allow querying/iterating over proteins and RNAs separately
94  typedef boost::multi_index_container<
95  ParentMolecule,
96  boost::multi_index::indexed_by<
97  boost::multi_index::ordered_unique<boost::multi_index::member<
98  ParentMolecule, String, &ParentMolecule::accession>>>
101 
102  }
103 }
OpenMS::IdentificationDataInternal::MoleculeType
MoleculeType
Definition: MetaData.h:63
OpenMS::IdentificationDataInternal::ParentMoleculeRef
IteratorWrapper< ParentMolecules::iterator > ParentMoleculeRef
Definition: ParentMolecule.h:100
OpenMS::IdentificationDataInternal::ParentMolecule::ParentMolecule
ParentMolecule(const String &accession, MoleculeType molecule_type=MoleculeType::PROTEIN, const String &sequence="", const String &description="", double coverage=0.0, bool is_decoy=false, const AppliedProcessingSteps &steps_and_scores=AppliedProcessingSteps())
Definition: ParentMolecule.h:65
OpenMS::IdentificationDataInternal::ParentMolecules
boost::multi_index_container< ParentMolecule, boost::multi_index::indexed_by< boost::multi_index::ordered_unique< boost::multi_index::member< ParentMolecule, String, &ParentMolecule::accession > > > > ParentMolecules
Definition: ParentMolecule.h:99
OpenMS::String
A more convenient string class.
Definition: String.h:59
OpenMS::IdentificationDataInternal::ParentMolecule::is_decoy
bool is_decoy
Definition: ParentMolecule.h:63
OpenMS::IdentificationDataInternal::PROTEIN
Definition: MetaData.h:65
OpenMS::IdentificationDataInternal::ScoredProcessingResult::steps_and_scores
AppliedProcessingSteps steps_and_scores
Definition: ScoredProcessingResult.h:46
OpenMS::IdentificationDataInternal::ParentMolecule::operator+=
ParentMolecule & operator+=(const ParentMolecule &other)
Definition: ParentMolecule.h:80
OpenMS::IdentificationDataInternal::ParentMolecule::accession
String accession
Definition: ParentMolecule.h:51
OpenMS
Main OpenMS namespace.
Definition: FeatureDeconvolution.h:46
OpenMS::IdentificationDataInternal::IteratorWrapper
Wrapper that adds operator< to iterators, so they can be used as (part of) keys in maps/sets or multi...
Definition: MetaData.h:43
OpenMS::IdentificationDataInternal::ParentMolecule::molecule_type
enum MoleculeType molecule_type
Definition: ParentMolecule.h:53
OpenMS::IdentificationDataInternal::ParentMolecule::coverage
double coverage
sequence coverage as a fraction between 0 and 1
Definition: ParentMolecule.h:61
OpenMS::IdentificationDataInternal::ParentMolecule
Representation of a parent molecule that is identified only indirectly (e.g. a protein).
Definition: ParentMolecule.h:49
ScoredProcessingResult.h
OpenMS::IdentificationDataInternal::AppliedProcessingSteps
boost::multi_index_container< AppliedProcessingStep, boost::multi_index::indexed_by< boost::multi_index::sequenced<>, boost::multi_index::ordered_unique< boost::multi_index::member< AppliedProcessingStep, boost::optional< ProcessingStepRef >, &AppliedProcessingStep::processing_step_opt > > > > AppliedProcessingSteps
Definition: AppliedProcessingStep.h:116
OpenMS::IdentificationDataInternal::ScoredProcessingResult
Base class for ID data with scores and processing steps (and meta info)
Definition: ScoredProcessingResult.h:44
OpenMS::IdentificationDataInternal::ParentMolecule::description
String description
Definition: ParentMolecule.h:59
OpenMS::IdentificationDataInternal::ScoredProcessingResult::operator+=
ScoredProcessingResult & operator+=(const ScoredProcessingResult &other)
Merge in data from another object.
Definition: ScoredProcessingResult.h:107
OpenMS::IdentificationDataInternal::ParentMolecule::sequence
String sequence
Definition: ParentMolecule.h:57