OpenMS
Loading...
Searching...
No Matches
NuXLFragmentAnnotationHelper.h
Go to the documentation of this file.
1// Copyright (c) 2002-present, OpenMS Inc. -- EKU Tuebingen, ETH Zurich, and FU Berlin
2// SPDX-License-Identifier: BSD-3-Clause
3//
4// --------------------------------------------------------------------------
5// $Maintainer: Timo Sachsenberg $
6// $Authors: Timo Sachsenberg $
7// --------------------------------------------------------------------------
8
9#pragma once
10
15
16#include <set>
17#include <map>
18#include <vector>
19#include <algorithm>
20
21namespace OpenMS
22{
23
30{
31 public:
32
34 struct OPENMS_DLLAPI FragmentAnnotationDetail_
35 {
36 FragmentAnnotationDetail_(String s, int z, double m, double i):
37 shift(s),
38 charge(z),
39 mz(m),
40 intensity(i)
41 {}
43 int charge;
44 double mz;
45 double intensity;
46
47 bool operator<(const FragmentAnnotationDetail_& other) const
48 {
49 return std::tie(charge, shift, mz, intensity) <
50 std::tie(other.charge, other.shift, other.mz, other.intensity);
51 }
52
53 bool operator==(const FragmentAnnotationDetail_& other) const
54 {
55 double mz_diff = fabs(mz - other.mz);
56 double intensity_diff = fabs(intensity - other.intensity);
57 return (charge == other.charge && shift == other.shift && mz_diff < 1e-6 && intensity_diff < 1e-6); // mz and intensity difference comparison actually not needed but kept for completeness
58 }
59 };
60
61 static String getAnnotatedImmoniumIon(char c, const String& fragment_shift_name);
62
64 static std::vector<PeptideHit::PeakAnnotation> fragmentAnnotationDetailsToPHFA(
65 const String& ion_type,
66 const std::map<Size, std::vector<FragmentAnnotationDetail_> >& ion_annotation_details);
67
68 static std::vector<PeptideHit::PeakAnnotation> shiftedToPHFA(
69 const std::map<String,
70 std::set<std::pair<String, double> > >& shifted_ions);
71
72
73 static String shiftedIonsToString(const std::vector<PeptideHit::PeakAnnotation>& as);
74
75 static void addShiftedPeakFragmentAnnotation_(const std::map<Size, std::vector<FragmentAnnotationDetail_>>& shifted_b_ions,
76 const std::map<Size, std::vector<FragmentAnnotationDetail_>>& shifted_y_ions,
77 const std::map<Size, std::vector<FragmentAnnotationDetail_>>& shifted_a_ions,
78 const std::vector<PeptideHit::PeakAnnotation>& shifted_immonium_ions,
79 const std::vector<PeptideHit::PeakAnnotation>& annotated_marker_ions,
80 const std::vector<PeptideHit::PeakAnnotation>& annotated_precursor_ions,
81 std::vector<PeptideHit::PeakAnnotation>& fas);
82};
83} // namespace OpenMS
84
85
Convenience functions to construct appealing fragment annotation strings and store them as PeptideHit...
Definition NuXLFragmentAnnotationHelper.h:30
static String shiftedIonsToString(const std::vector< PeptideHit::PeakAnnotation > &as)
static std::vector< PeptideHit::PeakAnnotation > shiftedToPHFA(const std::map< String, std::set< std::pair< String, double > > > &shifted_ions)
static std::vector< PeptideHit::PeakAnnotation > fragmentAnnotationDetailsToPHFA(const String &ion_type, const std::map< Size, std::vector< FragmentAnnotationDetail_ > > &ion_annotation_details)
conversion of NuXL annotations to PeptideHit::PeakAnnotation
static void addShiftedPeakFragmentAnnotation_(const std::map< Size, std::vector< FragmentAnnotationDetail_ > > &shifted_b_ions, const std::map< Size, std::vector< FragmentAnnotationDetail_ > > &shifted_y_ions, const std::map< Size, std::vector< FragmentAnnotationDetail_ > > &shifted_a_ions, const std::vector< PeptideHit::PeakAnnotation > &shifted_immonium_ions, const std::vector< PeptideHit::PeakAnnotation > &annotated_marker_ions, const std::vector< PeptideHit::PeakAnnotation > &annotated_precursor_ions, std::vector< PeptideHit::PeakAnnotation > &fas)
static String getAnnotatedImmoniumIon(char c, const String &fragment_shift_name)
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
Main OpenMS namespace.
Definition openswathalgo/include/OpenMS/OPENSWATHALGO/DATAACCESS/ISpectrumAccess.h:19
Single fragment annotation.
Definition NuXLFragmentAnnotationHelper.h:35
double intensity
Definition NuXLFragmentAnnotationHelper.h:45
double mz
Definition NuXLFragmentAnnotationHelper.h:44
String shift
Definition NuXLFragmentAnnotationHelper.h:42
bool operator==(const FragmentAnnotationDetail_ &other) const
Definition NuXLFragmentAnnotationHelper.h:53
FragmentAnnotationDetail_(String s, int z, double m, double i)
Definition NuXLFragmentAnnotationHelper.h:36
bool operator<(const FragmentAnnotationDetail_ &other) const
Definition NuXLFragmentAnnotationHelper.h:47
int charge
Definition NuXLFragmentAnnotationHelper.h:43