libpappsomspp
Library for mass spectrometry
Toggle main menu visibility
Loading...
Searching...
No Matches
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 <QObject>
27
28
#include "
xic.h
"
29
#include <algorithm>
30
#include <cmath>
31
#include "
pappsomspp/core/exception/exceptionoutofrange.h
"
32
33
namespace
pappso
34
{
35
36
37
Xic::Xic
()
38
{
39
qDebug() <<
"Xic::Xic begin"
;
40
qDebug() <<
"Xic::Xic end"
;
41
}
42
43
Xic::Xic
(
const
Trace
&other) :
Trace
(other)
44
{
45
}
46
47
Xic::~Xic
()
48
{
49
}
50
51
52
XicCstSPtr
53
Xic::makeXicCstSPtr
()
const
54
{
55
return
std::make_shared<const Xic>(*
this
);
56
}
57
58
XicSPtr
59
Xic::makeXicSPtr
()
const
60
{
61
return
std::make_shared<Xic>(*
this
);
62
}
63
64
void
65
Xic::debugPrintValues
()
const
66
{
67
for
(
auto
&&peak : *
this
)
68
{
69
qDebug() <<
"rt = "
<< peak.x <<
", int = "
<< peak.y;
70
}
71
}
72
73
const
DataPoint
&
74
Xic::atRetentionTime
(
pappso_double
rt)
const
75
{
76
for
(
auto
&&peak : *
this
)
77
{
78
if
(peak.y == rt)
79
return
peak;
80
}
81
throw
ExceptionOutOfRange
(QObject::tr(
"no intensity for this retention time"
));
82
}
83
84
unsigned
int
85
Xic::getMsPointDistance
(
pappso_double
rt_first,
pappso_double
rt_second)
const
86
{
87
if
(rt_first > rt_second)
88
{
89
std::swap(rt_first, rt_second);
90
}
91
unsigned
int
distance = 0;
92
auto
it = this->begin();
93
auto
itend = this->end();
94
95
while
((it->x < rt_first) && (it != itend))
96
{
97
it++;
98
}
99
while
((rt_second > it->x) && (it != itend))
100
{
101
qDebug() <<
"Xic::getMsPointDistance "
<< rt_first <<
" it->rt "
<< it->x <<
" rt_second "
102
<< rt_second << distance;
103
distance++;
104
it++;
105
}
106
107
108
return
distance;
109
}
110
111
void
112
Xic::sortByRetentionTime
()
113
{
114
sortX
();
115
}
116
117
}
// namespace pappso
pappso::ExceptionOutOfRange
Definition
exceptionoutofrange.h:32
pappso::Trace::sortX
void sortX(Enums::SortOrder sort_order=Enums::SortOrder::ascending)
Definition
trace.cpp:1070
pappso::Trace::Trace
Trace()
Definition
trace.cpp:455
pappso::Xic::atRetentionTime
const DataPoint & atRetentionTime(pappso_double rt) const
get the DataPoint at the given retention time
Definition
xic.cpp:74
pappso::Xic::sortByRetentionTime
void sortByRetentionTime()
sort peaks by retention time
Definition
xic.cpp:112
pappso::Xic::makeXicCstSPtr
XicCstSPtr makeXicCstSPtr() const
Definition
xic.cpp:53
pappso::Xic::debugPrintValues
void debugPrintValues() const
Definition
xic.cpp:65
pappso::Xic::getMsPointDistance
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:85
pappso::Xic::Xic
Xic()
Definition
xic.cpp:37
pappso::Xic::makeXicSPtr
XicSPtr makeXicSPtr() const
Definition
xic.cpp:59
pappso::Xic::~Xic
virtual ~Xic()
Definition
xic.cpp:47
exceptionoutofrange.h
pappso
tries to keep as much as possible monoisotopes, removing any possible C13 peaks and changes multichar...
Definition
aa.cpp:39
pappso::XicCstSPtr
std::shared_ptr< const Xic > XicCstSPtr
Definition
xic.h:38
pappso::pappso_double
double pappso_double
A type definition for doubles.
Definition
types.h:60
pappso::XicSPtr
std::shared_ptr< Xic > XicSPtr
Definition
xic.h:39
pappso::DataPoint
Definition
datapoint.h:22
xic.h
pappsomspp
core
xic
xic.cpp
Generated on
for libpappsomspp by
1.17.0