OpenMS
ParentMatch.h
Go to the documentation of this file.
1 // Copyright (c) 2002-present, 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 
12 
13 namespace OpenMS
14 {
15  namespace IdentificationDataInternal
16  {
20  {
21  // in extraordinary cases (e.g. database searches that allow insertions/
22  // deletions), the length of the identified molecule may differ from the
23  // length of the subsequence in the parent; therefore, store "end_pos":
25 
26  // String instead of char so modified residues can be represented:
27  String left_neighbor, right_neighbor; // neighboring sequence elements
28 
29  static constexpr Size UNKNOWN_POSITION = Size(-1);
30  static constexpr char UNKNOWN_NEIGHBOR = 'X';
31  static constexpr char LEFT_TERMINUS = '[';
32  static constexpr char RIGHT_TERMINUS = ']';
33 
40  {
41  }
42 
43  bool operator<(const ParentMatch& other) const
44  {
45  // positions determine neighbors - no need to compare those:
46  return (std::tie(start_pos, end_pos) <
47  std::tie(other.start_pos, other.end_pos));
48  }
49 
50  bool operator==(const ParentMatch& other) const
51  {
52  // positions determine neighbors - no need to compare those:
53  return (std::tie(start_pos, end_pos) ==
54  std::tie(other.start_pos, other.end_pos));
55  }
56 
57  bool hasValidPositions(Size molecule_length = 0, Size parent_length = 0) const
58  {
60  {
61  return false;
62  }
63  if (end_pos < start_pos) return false;
64  if (molecule_length && (end_pos - start_pos + 1 != molecule_length))
65  {
66  return false;
67  }
68  if (parent_length && (end_pos >= parent_length)) return false;
69  return true;
70  }
71  };
72 
74  typedef std::map<ParentSequenceRef,
75  std::set<ParentMatch>> ParentMatches;
76 
77  }
78 }
Interface for classes that can store arbitrary meta information (Type-Name-Value tuples).
Definition: MetaInfoInterface.h:35
A more convenient string class.
Definition: String.h:34
size_t Size
Size type e.g. used as variable which can hold result of size()
Definition: Types.h:97
std::map< ParentSequenceRef, std::set< ParentMatch > > ParentMatches
mapping: parent sequence -> match information
Definition: ParentMatch.h:75
IteratorWrapper< ParentSequences::iterator > ParentSequenceRef
Definition: ParentSequence.h:95
Main OpenMS namespace.
Definition: openswathalgo/include/OpenMS/OPENSWATHALGO/DATAACCESS/ISpectrumAccess.h:19
Meta data for the association between an identified molecule (e.g. peptide) and a parent sequence (e....
Definition: ParentMatch.h:20
bool operator==(const ParentMatch &other) const
Definition: ParentMatch.h:50
static constexpr Size UNKNOWN_POSITION
Definition: ParentMatch.h:29
bool operator<(const ParentMatch &other) const
Definition: ParentMatch.h:43
String right_neighbor
Definition: ParentMatch.h:27
Size start_pos
Definition: ParentMatch.h:24
Size end_pos
Definition: ParentMatch.h:24
bool hasValidPositions(Size molecule_length=0, Size parent_length=0) const
Definition: ParentMatch.h:57
String left_neighbor
Definition: ParentMatch.h:27
static constexpr char UNKNOWN_NEIGHBOR
Definition: ParentMatch.h:30
static constexpr char LEFT_TERMINUS
Definition: ParentMatch.h:31
static constexpr char RIGHT_TERMINUS
Definition: ParentMatch.h:32
ParentMatch(Size start_pos=UNKNOWN_POSITION, Size end_pos=UNKNOWN_POSITION, String left_neighbor=UNKNOWN_NEIGHBOR, String right_neighbor=UNKNOWN_NEIGHBOR)
Definition: ParentMatch.h:34