tracepeaklist.cpp
Go to the documentation of this file.
/**
* \file pappsomspp/processing/detection/tracepeaklist.cpp
* \date 15/09/2021
* \author Olivier Langella
* \brief trace peak list
*/
/*******************************************************************************
* Copyright (c) 2021 Olivier Langella
*<Olivier.Langella@universite-paris-saclay.fr>.
*
* This file is part of the PAPPSOms++ library.
*
* PAPPSOms++ is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* PAPPSOms++ is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with PAPPSOms++. If not, see <http://www.gnu.org/licenses/>.
*
******************************************************************************/
#include "tracepeaklist.h"
using namespace pappso;
TracePeakList::TracePeakList()
{
}
TracePeakList::TracePeakList(const TracePeakList &other)
: std::vector<TracePeak>(other)
{
}
TracePeakList::~TracePeakList()
{
}
void
pappso::TracePeakList::setTracePeak(pappso::TracePeak &xic_peak)
{
push_back(xic_peak);
}
std::vector<TracePeak>::iterator
pappso::findBestTracePeakGivenRtList(std::vector<TracePeak>::iterator begin,
std::vector<TracePeak>::iterator end,
const std::vector<double> &rt_list,
std::size_t &nb_peaks)
{
// get peak containing rt ahead :
auto itend = std::partition(begin, end, [rt_list](const TracePeak &a) {
for(double rt : rt_list)
{
if(a.containsRt(rt))
{
return true;
};
}
return false;
});
nb_peaks = std::distance(begin, itend);
if(nb_peaks == 0)
return end;
return std::max_element(
begin, itend, [](const TracePeak &a, const TracePeak &b) {
return a.getArea() < b.getArea();
});
}
std::vector<TracePeak>::iterator
pappso::findTracePeakGivenRt(std::vector<TracePeak>::iterator begin,
std::vector<TracePeak>::iterator end,
double rt)
{
return find_if(
begin, end, [rt](const TracePeak &a) { return a.containsRt(rt); });
}
pappso::TracePeakList
Definition: tracepeaklist.h:43
pappso::TracePeakList::TracePeakList
TracePeakList()
Definition: tracepeaklist.cpp:34
pappso::TracePeakList::~TracePeakList
virtual ~TracePeakList()
Definition: tracepeaklist.cpp:43
pappso::TracePeakList::setTracePeak
virtual void setTracePeak(TracePeak &xic_peak) override
Definition: tracepeaklist.cpp:48
pappso::TracePeak
Definition: tracepeak.h:40
pappso
tries to keep as much as possible monoisotopes, removing any possible C13 peaks and changes multichar...
Definition: aa.cpp:39
pappso::findBestTracePeakGivenRtList
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
Definition: tracepeaklist.cpp:55
pappso::findTracePeakGivenRt
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
Definition: tracepeaklist.cpp:81
pappso::PeptideIonNter::a
@ a
pappso::PeptideIonNter::b
@ b
pappso::DataKind::rt
@ rt
Retention time.
tracepeaklist.h
trace peak list