libpappsomspp
Library for mass spectrometry
Loading...
Searching...
No Matches
tracepeaklist.cpp
Go to the documentation of this file.
1/**
2 * \file pappsomspp/processing/detection/tracepeaklist.cpp
3 * \date 15/09/2021
4 * \author Olivier Langella
5 * \brief trace peak list
6 */
7
8/*******************************************************************************
9 * Copyright (c) 2021 Olivier Langella
10 *<Olivier.Langella@universite-paris-saclay.fr>.
11 *
12 * This file is part of the PAPPSOms++ library.
13 *
14 * PAPPSOms++ is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU General Public License as published by
16 * the Free Software Foundation, either version 3 of the License, or
17 * (at your option) any later version.
18 *
19 * PAPPSOms++ is distributed in the hope that it will be useful,
20 * but WITHOUT ANY WARRANTY; without even the implied warranty of
21 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22 * GNU General Public License for more details.
23 *
24 * You should have received a copy of the GNU General Public License
25 * along with PAPPSOms++. If not, see <http://www.gnu.org/licenses/>.
26 *
27 ******************************************************************************/
28
29
30#include "tracepeaklist.h"
31
32using namespace pappso;
33
37
39 : std::vector<TracePeak>(other)
40{
41}
42
46
47void
49{
50 push_back(xic_peak);
51}
52
53
54std::vector<TracePeak>::iterator
55pappso::findBestTracePeakGivenRtList(std::vector<TracePeak>::iterator begin,
56 std::vector<TracePeak>::iterator end,
57 const std::vector<double> &rt_list,
58 std::size_t &nb_peaks)
59{
60 // get peak containing rt ahead :
61 auto itend = std::partition(begin, end, [rt_list](const TracePeak &a) {
62 for(double rt : rt_list)
63 {
64 if(a.containsRt(rt))
65 {
66 return true;
67 };
68 }
69 return false;
70 });
71 nb_peaks = std::distance(begin, itend);
72 if(nb_peaks == 0)
73 return end;
74 return std::max_element(
75 begin, itend, [](const TracePeak &a, const TracePeak &b) {
76 return a.getArea() < b.getArea();
77 });
78}
79
80std::vector<TracePeak>::iterator
81pappso::findTracePeakGivenRt(std::vector<TracePeak>::iterator begin,
82 std::vector<TracePeak>::iterator end,
83 double rt)
84{
85 return find_if(
86 begin, end, [rt](const TracePeak &a) { return a.containsRt(rt); });
87}
virtual void setTracePeak(TracePeak &xic_peak) override
tries to keep as much as possible monoisotopes, removing any possible C13 peaks and changes multichar...
Definition aa.cpp:39
PMSPP_LIB_DECL std::vector< TracePeak >::iterator findBestTracePeakGivenRtList(std::vector< TracePeak >::iterator begin, std::vector< TracePeak >::iterator end, const std::vector< double > &rt_list, std::size_t &nb_peaks)
find the best peak matching a list of retention times
PMSPP_LIB_DECL std::vector< TracePeak >::iterator findTracePeakGivenRt(std::vector< TracePeak >::iterator begin, std::vector< TracePeak >::iterator end, double rt)
find the peak matching a retention time
@ rt
Retention time.
trace peak list