libpappsomspp
Library for mass spectrometry
xic.cpp
Go to the documentation of this file.
1/*
2 * *******************************************************************************
3 * * Copyright (c) 2015 Olivier Langella <Olivier.Langella@moulon.inra.fr>.
4 * *
5 * * This file is part of MassChroqPRM.
6 * *
7 * * MassChroqPRM is free software: you can redistribute it and/or modify
8 * * it under the terms of the GNU General Public License as published by
9 * * the Free Software Foundation, either version 3 of the License, or
10 * * (at your option) any later version.
11 * *
12 * * MassChroqPRM is distributed in the hope that it will be useful,
13 * * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * * GNU General Public License for more details.
16 * *
17 * * You should have received a copy of the GNU General Public License
18 * * along with MassChroqPRM. If not, see <http://www.gnu.org/licenses/>.
19 * *
20 * * Contributors:
21 * * Olivier Langella <Olivier.Langella@moulon.inra.fr> - initial API and
22 * implementation
23 * ******************************************************************************/
24
25#include <QDebug>
26#include "xic.h"
27#include <algorithm>
28#include <cmath>
29#include "../exception/exceptionoutofrange.h"
30
31namespace pappso
32{
33
34
36{
37 qDebug() << "Xic::Xic begin";
38 qDebug() << "Xic::Xic end";
39}
40
41Xic::Xic(const Trace &other) : Trace(other)
42{
43}
44
46{
47}
48
49
52{
53 return std::make_shared<const Xic>(*this);
54}
55
58{
59 return std::make_shared<Xic>(*this);
60}
61
62void
64{
65 for(auto &&peak : *this)
66 {
67 qDebug() << "rt = " << peak.x << ", int = " << peak.y;
68 }
69}
70
71const DataPoint &
73{
74 for(auto &&peak : *this)
75 {
76 if(peak.y == rt)
77 return peak;
78 }
80 QObject::tr("no intensity for this retention time"));
81}
82
83unsigned int
85{
86 if(rt_first > rt_second)
87 {
88 std::swap(rt_first, rt_second);
89 }
90 unsigned int distance = 0;
91 auto it = this->begin();
92 auto itend = this->end();
93
94 while((it->x < rt_first) && (it != itend))
95 {
96 it++;
97 }
98 while((rt_second > it->x) && (it != itend))
99 {
100 qDebug() << "Xic::getMsPointDistance " << rt_first << " it->rt " << it->x
101 << " rt_second " << rt_second << distance;
102 distance++;
103 it++;
104 }
105
106
107 return distance;
108}
109
110void
112{
113 sortX();
114}
115
116} // namespace pappso
A simple container of DataPoint instances.
Definition: trace.h:147
void sortX()
Definition: trace.cpp:936
const DataPoint & atRetentionTime(pappso_double rt) const
get the DataPoint at the given retention time
Definition: xic.cpp:72
void sortByRetentionTime()
sort peaks by retention time
Definition: xic.cpp:111
XicCstSPtr makeXicCstSPtr() const
Definition: xic.cpp:51
void debugPrintValues() const
Definition: xic.cpp:63
unsigned int getMsPointDistance(pappso_double rt, pappso_double rt_other) const
get the number of MS measurement between 2 retention times on this xic
Definition: xic.cpp:84
XicSPtr makeXicSPtr() const
Definition: xic.cpp:57
virtual ~Xic()
Definition: xic.cpp:45
tries to keep as much as possible monoisotopes, removing any possible C13 peaks and changes multichar...
Definition: aa.cpp:39
std::shared_ptr< const Xic > XicCstSPtr
Definition: xic.h:38
double pappso_double
A type definition for doubles.
Definition: types.h:48
std::shared_ptr< Xic > XicSPtr
Definition: xic.h:39
@ rt
Retention time.