OpenMS  2.6.0
MoleculeParentMatch.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 namespace OpenMS
40 {
41  namespace IdentificationDataInternal
42  {
46  {
47  // in extraordinary cases (e.g. database searches that allow insertions/
48  // deletions), the length of the identified molecule may differ from the
49  // length of the subsequence in the parent; therefore, store "end_pos":
51 
52  // String instead of char so modified residues can be represented:
53  String left_neighbor, right_neighbor; // neighboring sequence elements
54 
55  static constexpr Size UNKNOWN_POSITION = Size(-1);
56  static constexpr char UNKNOWN_NEIGHBOR = 'X';
57  static constexpr char LEFT_TERMINUS = '[';
58  static constexpr char RIGHT_TERMINUS = ']';
59 
66  {
67  }
68 
69  bool operator<(const MoleculeParentMatch& other) const
70  {
71  // positions determine neighbors - no need to compare those:
72  return (std::tie(start_pos, end_pos) <
73  std::tie(other.start_pos, other.end_pos));
74  }
75 
76  bool operator==(const MoleculeParentMatch& other) const
77  {
78  // positions determine neighbors - no need to compare those:
79  return (std::tie(start_pos, end_pos) ==
80  std::tie(other.start_pos, other.end_pos));
81  }
82 
83  bool hasValidPositions(Size molecule_length = 0, Size parent_length = 0) const
84  {
86  {
87  return false;
88  }
89  if (end_pos < start_pos) return false;
90  if (molecule_length && (end_pos - start_pos + 1 != molecule_length))
91  {
92  return false;
93  }
94  if (parent_length && (end_pos >= parent_length)) return false;
95  return true;
96  }
97  };
98 
100  typedef std::map<ParentMoleculeRef,
101  std::set<MoleculeParentMatch>> ParentMatches;
102 
103  }
104 }
OpenMS::IdentificationDataInternal::MoleculeParentMatch::MoleculeParentMatch
MoleculeParentMatch(Size start_pos=UNKNOWN_POSITION, Size end_pos=UNKNOWN_POSITION, String left_neighbor=UNKNOWN_NEIGHBOR, String right_neighbor=UNKNOWN_NEIGHBOR)
Definition: MoleculeParentMatch.h:60
OpenMS::IdentificationDataInternal::ParentMoleculeRef
IteratorWrapper< ParentMolecules::iterator > ParentMoleculeRef
Definition: ParentMolecule.h:100
OpenMS::IdentificationDataInternal::MoleculeParentMatch::RIGHT_TERMINUS
static constexpr char RIGHT_TERMINUS
Definition: MoleculeParentMatch.h:58
OpenMS::String
A more convenient string class.
Definition: String.h:59
OpenMS::Size
size_t Size
Size type e.g. used as variable which can hold result of size()
Definition: Types.h:127
OpenMS::IdentificationDataInternal::MoleculeParentMatch::end_pos
Size end_pos
Definition: MoleculeParentMatch.h:50
OpenMS::IdentificationDataInternal::MoleculeParentMatch::UNKNOWN_POSITION
static constexpr Size UNKNOWN_POSITION
Definition: MoleculeParentMatch.h:55
OpenMS::IdentificationDataInternal::MoleculeParentMatch::operator<
bool operator<(const MoleculeParentMatch &other) const
Definition: MoleculeParentMatch.h:69
OpenMS
Main OpenMS namespace.
Definition: FeatureDeconvolution.h:46
OpenMS::IdentificationDataInternal::MoleculeParentMatch::UNKNOWN_NEIGHBOR
static constexpr char UNKNOWN_NEIGHBOR
Definition: MoleculeParentMatch.h:56
OpenMS::MetaInfoInterface
Interface for classes that can store arbitrary meta information (Type-Name-Value tuples).
Definition: MetaInfoInterface.h:60
OpenMS::IdentificationDataInternal::MoleculeParentMatch::start_pos
Size start_pos
Definition: MoleculeParentMatch.h:50
OpenMS::IdentificationDataInternal::MoleculeParentMatch::LEFT_TERMINUS
static constexpr char LEFT_TERMINUS
Definition: MoleculeParentMatch.h:57
OpenMS::IdentificationDataInternal::MoleculeParentMatch::operator==
bool operator==(const MoleculeParentMatch &other) const
Definition: MoleculeParentMatch.h:76
OpenMS::IdentificationDataInternal::ParentMatches
std::map< ParentMoleculeRef, std::set< MoleculeParentMatch > > ParentMatches
mapping: parent molecule -> match information
Definition: MoleculeParentMatch.h:101
OpenMS::IdentificationDataInternal::MoleculeParentMatch::right_neighbor
String right_neighbor
Definition: MoleculeParentMatch.h:53
OpenMS::IdentificationDataInternal::MoleculeParentMatch::left_neighbor
String left_neighbor
Definition: MoleculeParentMatch.h:53
ParentMolecule.h
OpenMS::IdentificationDataInternal::MoleculeParentMatch
Meta data for the association between an identified molecule (e.g. peptide) and a parent molecule (e....
Definition: MoleculeParentMatch.h:45
OpenMS::IdentificationDataInternal::MoleculeParentMatch::hasValidPositions
bool hasValidPositions(Size molecule_length=0, Size parent_length=0) const
Definition: MoleculeParentMatch.h:83