libpappsomspp
Library for mass spectrometry
Toggle main menu visibility
Loading...
Searching...
No Matches
tracepeak.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 the PAPPSOms++ library.
6
*
7
* PAPPSOms++ 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
* PAPPSOms++ 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 PAPPSOms++. 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 <cmath>
26
#include "
tracepeak.h
"
27
#include "
../../trace/trace.h
"
28
29
namespace
pappso
30
{
31
TracePeak::TracePeak
()
32
{
33
}
34
35
TracePeak::TracePeak
(std::vector<DataPoint>::const_iterator it_begin,
36
std::vector<DataPoint>::const_iterator it_end)
37
{
38
39
m_left
= *it_begin;
40
m_right
= *(it_end - 1);
41
m_max
= *
maxYDataPoint
(it_begin, it_end);
42
m_area
=
areaTrace
(it_begin, it_end);
43
}
44
45
TracePeak::TracePeak
(std::vector<DataPoint>::const_iterator it_begin,
46
std::vector<DataPoint>::const_iterator it_end,
47
bool
remove_base)
48
{
49
50
m_left
= *it_begin;
51
m_right
= *(it_end - 1);
52
m_max
= *
maxYDataPoint
(it_begin, it_end);
53
m_area
=
areaTrace
(it_begin, it_end);
54
if
(remove_base)
55
{
56
// remove the base of this peak
57
m_area
-= std::min(
m_left
.y,
m_right
.y) * (
m_right
.x -
m_left
.x);
58
if
(
m_area
< 0)
59
m_area
= 0;
60
}
61
}
62
63
TracePeak::TracePeak
(
const
TracePeak
&other)
64
{
65
m_area
= other.
m_area
;
66
m_left
= other.
m_left
;
67
m_right
= other.
m_right
;
68
m_max
= other.
m_max
;
69
}
70
71
TracePeak::~TracePeak
()
72
{
73
}
74
75
76
TracePeakCstSPtr
77
TracePeak::makeTracePeakCstSPtr
()
const
78
{
79
return
std::make_shared<const TracePeak>(*
this
);
80
}
81
82
DataPoint
&
83
TracePeak::getMaxXicElement
()
84
{
85
return
m_max
;
86
};
87
void
88
TracePeak::setMaxXicElement
(
const
DataPoint
&max)
89
{
90
m_max
= max;
91
};
92
DataPoint
&
93
TracePeak::getLeftBoundary
()
94
{
95
return
m_left
;
96
};
97
void
98
TracePeak::setLeftBoundary
(
const
DataPoint
&left)
99
{
100
m_left
= left;
101
};
102
103
DataPoint
&
104
TracePeak::getRightBoundary
()
105
{
106
return
m_right
;
107
};
108
const
DataPoint
&
109
TracePeak::getRightBoundary
()
const
110
{
111
return
m_right
;
112
};
113
void
114
TracePeak::setRightBoundary
(
const
DataPoint
&right)
115
{
116
m_right
= right;
117
};
118
pappso_double
119
TracePeak::getArea
()
const
120
{
121
return
m_area
;
122
};
123
void
124
TracePeak::setArea
(
pappso_double
area)
125
{
126
m_area
= area;
127
};
128
129
bool
130
TracePeak::containsRt
(
pappso::pappso_double
rt)
const
131
{
132
if
((rt >=
m_left
.x) && (rt <=
m_right
.x))
133
{
134
return
(
true
);
135
}
136
return
(
false
);
137
}
138
139
140
const
DataPoint
&
141
TracePeak::getMaxXicElement
()
const
142
{
143
return
m_max
;
144
}
145
146
const
DataPoint
&
147
TracePeak::getLeftBoundary
()
const
148
{
149
return
m_left
;
150
}
151
152
153
bool
154
TracePeak::operator==
(
const
TracePeak
&other)
const
155
{
156
return
((
m_area
== other.
m_area
) && (
m_max
== other.
m_max
) && (
m_left
== other.
m_left
) &&
157
(
m_right
== other.
m_right
));
158
}
159
160
TracePeak
&
161
TracePeak::operator=
(
const
TracePeak
&other)
162
{
163
if
(
this
== &other)
164
return
*
this
;
165
166
m_area
= other.
m_area
;
167
m_max
= other.
m_max
;
168
m_left
= other.
m_left
;
169
m_right
= other.
m_right
;
170
171
return
*
this
;
172
}
173
}
// namespace pappso
pappso::TracePeak
Definition
tracepeak.h:40
pappso::TracePeak::TracePeak
TracePeak()
Definition
tracepeak.cpp:31
pappso::TracePeak::getLeftBoundary
DataPoint & getLeftBoundary()
Definition
tracepeak.cpp:93
pappso::TracePeak::setLeftBoundary
void setLeftBoundary(const DataPoint &left)
Definition
tracepeak.cpp:98
pappso::TracePeak::getArea
pappso_double getArea() const
Definition
tracepeak.cpp:119
pappso::TracePeak::operator==
bool operator==(const TracePeak &other) const
Definition
tracepeak.cpp:154
pappso::TracePeak::operator=
TracePeak & operator=(const TracePeak &other)
Definition
tracepeak.cpp:161
pappso::TracePeak::setArea
void setArea(pappso_double area)
Definition
tracepeak.cpp:124
pappso::TracePeak::m_left
DataPoint m_left
Definition
tracepeak.h:90
pappso::TracePeak::makeTracePeakCstSPtr
TracePeakCstSPtr makeTracePeakCstSPtr() const
Definition
tracepeak.cpp:77
pappso::TracePeak::setRightBoundary
void setRightBoundary(const DataPoint &right)
Definition
tracepeak.cpp:114
pappso::TracePeak::m_max
DataPoint m_max
Definition
tracepeak.h:89
pappso::TracePeak::~TracePeak
~TracePeak()
Definition
tracepeak.cpp:71
pappso::TracePeak::m_right
DataPoint m_right
Definition
tracepeak.h:91
pappso::TracePeak::m_area
pappso_double m_area
Definition
tracepeak.h:88
pappso::TracePeak::containsRt
bool containsRt(pappso::pappso_double rt) const
Definition
tracepeak.cpp:130
pappso::TracePeak::getMaxXicElement
DataPoint & getMaxXicElement()
Definition
tracepeak.cpp:83
pappso::TracePeak::getRightBoundary
DataPoint & getRightBoundary()
Definition
tracepeak.cpp:104
pappso::TracePeak::setMaxXicElement
void setMaxXicElement(const DataPoint &max)
Definition
tracepeak.cpp:88
pappso
tries to keep as much as possible monoisotopes, removing any possible C13 peaks and changes multichar...
Definition
aa.cpp:39
pappso::maxYDataPoint
std::vector< DataPoint >::const_iterator maxYDataPoint(std::vector< DataPoint >::const_iterator begin, std::vector< DataPoint >::const_iterator end)
Definition
trace.cpp:169
pappso::areaTrace
double areaTrace(std::vector< DataPoint >::const_iterator begin, std::vector< DataPoint >::const_iterator end)
calculate the area of a trace
Definition
trace.cpp:283
pappso::pappso_double
double pappso_double
A type definition for doubles.
Definition
types.h:60
pappso::TracePeakCstSPtr
std::shared_ptr< const TracePeak > TracePeakCstSPtr
Definition
tracepeak.h:35
pappso::DataPoint
Definition
datapoint.h:22
trace.h
tracepeak.h
pappsomspp
core
processing
detection
tracepeak.cpp
Generated on
for libpappsomspp by
1.17.0