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
38TracePeakList::TracePeakList(const TracePeakList &other) : std::vector<TracePeak>(other)
39{
40}
41
45
46void
48{
49 push_back(xic_peak);
50}
51
52
53std::vector<TracePeak>::iterator
54pappso::findBestTracePeakGivenRtList(std::vector<TracePeak>::iterator begin,
55 std::vector<TracePeak>::iterator end,
56 const std::vector<double> &rt_list,
57 std::size_t &nb_peaks)
58{
59 // get peak containing rt ahead :
60 auto itend = std::partition(begin, end, [rt_list](const TracePeak &a) {
61 for(double rt : rt_list)
62 {
63 if(a.containsRt(rt))
64 {
65 return true;
66 };
67 }
68 return false;
69 });
70 nb_peaks = std::distance(begin, itend);
71 if(nb_peaks == 0)
72 return end;
73 return std::max_element(
74 begin, itend, [](const TracePeak &a, const TracePeak &b) { return a.getArea() < b.getArea(); });
75}
76
77std::vector<TracePeak>::iterator
78pappso::findTracePeakGivenRt(std::vector<TracePeak>::iterator begin,
79 std::vector<TracePeak>::iterator end,
80 double rt)
81{
82 return find_if(begin, end, [rt](const TracePeak &a) { return a.containsRt(rt); });
83}
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