OpenMS  2.7.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-2021.
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 }
Interface for classes that can store arbitrary meta information (Type-Name-Value tuples).
Definition: MetaInfoInterface.h:61
A more convenient string class.
Definition: String.h:61
size_t Size
Size type e.g. used as variable which can hold result of size()
Definition: Types.h:127
std::map< ParentMoleculeRef, std::set< MoleculeParentMatch > > ParentMatches
mapping: parent molecule -> match information
Definition: MoleculeParentMatch.h:101
IteratorWrapper< ParentMolecules::iterator > ParentMoleculeRef
Definition: ParentMolecule.h:100
Main OpenMS namespace.
Definition: FeatureDeconvolution.h:47
Meta data for the association between an identified molecule (e.g. peptide) and a parent molecule (e....
Definition: MoleculeParentMatch.h:46
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
static constexpr Size UNKNOWN_POSITION
Definition: MoleculeParentMatch.h:55
String right_neighbor
Definition: MoleculeParentMatch.h:53
Size start_pos
Definition: MoleculeParentMatch.h:50
Size end_pos
Definition: MoleculeParentMatch.h:50
bool hasValidPositions(Size molecule_length=0, Size parent_length=0) const
Definition: MoleculeParentMatch.h:83
bool operator<(const MoleculeParentMatch &other) const
Definition: MoleculeParentMatch.h:69
bool operator==(const MoleculeParentMatch &other) const
Definition: MoleculeParentMatch.h:76
String left_neighbor
Definition: MoleculeParentMatch.h:53
static constexpr char UNKNOWN_NEIGHBOR
Definition: MoleculeParentMatch.h:56
static constexpr char LEFT_TERMINUS
Definition: MoleculeParentMatch.h:57
static constexpr char RIGHT_TERMINUS
Definition: MoleculeParentMatch.h:58