libpappsomspp
Library for mass spectrometry
Toggle main menu visibility
Loading...
Searching...
No Matches
tracedetectionmoulon.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
#include "
tracedetectionmoulon.h
"
25
26
namespace
pappso
27
{
28
TraceDetectionMoulon::TraceDetectionMoulon
(
unsigned
int
smoothing_half_window_length,
29
pappso_double
tic_start,
30
pappso_double
tic_stop)
31
:
m_xicFilterSmoothing
(smoothing_half_window_length)
32
{
33
m_ticStart
= tic_start;
34
m_ticStop
= tic_stop;
35
}
36
37
TraceDetectionMoulon::TraceDetectionMoulon
(
const
TraceDetectionMoulon
&other)
38
:
m_xicFilterSmoothing
(other.
m_xicFilterSmoothing
)
39
{
40
m_ticStart
= other.
m_ticStart
;
41
m_ticStop
= other.
m_ticStop
;
42
}
43
44
TraceDetectionMoulon::~TraceDetectionMoulon
()
45
{
46
}
47
48
49
void
50
TraceDetectionMoulon::setFilterMorphoMean
(
const
FilterMorphoMean
&smooth)
51
{
52
m_xicFilterSmoothing
= smooth;
53
}
54
55
void
56
TraceDetectionMoulon::setTicStart
(
double
tic_start)
57
{
58
m_ticStart
= tic_start;
59
}
60
void
61
TraceDetectionMoulon::setTicStop
(
double
tic_stop)
62
{
63
m_ticStop
= tic_stop;
64
}
65
66
unsigned
int
67
TraceDetectionMoulon::getSmoothingHalfEdgeWindows
()
const
68
{
69
return
m_xicFilterSmoothing
.getHalfWindowSize();
70
}
71
72
pappso_double
73
TraceDetectionMoulon::getTicStart
()
const
74
{
75
return
m_ticStart
;
76
}
77
78
pappso_double
79
TraceDetectionMoulon::getTicStop
()
const
80
{
81
return
m_ticStop
;
82
}
83
84
void
85
TraceDetectionMoulon::detect
(
const
Trace
&xic,
86
TraceDetectionSinkInterface
&sink,
87
bool
remove_peak_base)
const
88
{
89
90
Trace
xic_smoothed(xic);
91
92
m_xicFilterSmoothing
.filter(xic_smoothed);
93
94
// detect peaks :
95
bool
banked(
false
);
96
unsigned
int
nb_tic_start(0);
97
98
std::vector<DataPoint>::const_iterator it_smoothed;
99
std::vector<DataPoint>::const_iterator it, it_begin;
100
101
// TracePeak *p_current_peak = nullptr;
102
103
for
(it_smoothed = xic_smoothed.begin(), it = xic.begin(); it_smoothed != xic_smoothed.end();
104
++it_smoothed, ++it)
105
{
106
107
if
((nb_tic_start == 0) && (it_begin != xic.end()) && (banked ==
false
))
108
{
109
// delete(p_current_peak);
110
// p_current_peak = nullptr;
111
it_begin = xic.end();
112
}
113
114
if
(it_smoothed->y >=
m_ticStart
)
115
{
116
nb_tic_start++;
117
if
(it_begin == xic.end())
118
{
119
// p_current_peak = new TracePeak;
120
// p_current_peak->setLeftBoundary(*it_smoothed);
121
it_begin = it;
122
banked =
false
;
123
}
124
if
((nb_tic_start == 2) && (banked ==
false
))
125
{
126
banked =
true
;
127
}
128
}
129
else
130
{
131
nb_tic_start = 0;
132
}
133
if
(it_smoothed->y <=
m_ticStop
)
134
{
135
if
(it_begin != xic.end())
136
{
137
138
if
(banked)
139
{
140
TracePeak
peak(it_begin, it + 1, remove_peak_base);
141
sink.
setTracePeak
(peak);
142
}
143
banked =
false
;
144
}
145
}
146
}
147
}
148
}
// namespace pappso
pappso::FilterMorphoMean
mean filter apply mean of y values inside the window : this results in a kind of smoothing
Definition
filtermorpho.h:225
pappso::TraceDetectionMoulon::setTicStart
void setTicStart(double tic_start)
Definition
tracedetectionmoulon.cpp:56
pappso::TraceDetectionMoulon::~TraceDetectionMoulon
virtual ~TraceDetectionMoulon()
Definition
tracedetectionmoulon.cpp:44
pappso::TraceDetectionMoulon::getTicStart
pappso_double getTicStart() const
Definition
tracedetectionmoulon.cpp:73
pappso::TraceDetectionMoulon::detect
void detect(const Trace &xic, TraceDetectionSinkInterface &sink, bool remove_peak_base) const override
detect peaks on a trace
Definition
tracedetectionmoulon.cpp:85
pappso::TraceDetectionMoulon::m_xicFilterSmoothing
FilterMorphoMean m_xicFilterSmoothing
Definition
tracedetectionmoulon.h:58
pappso::TraceDetectionMoulon::m_ticStop
pappso_double m_ticStop
Definition
tracedetectionmoulon.h:60
pappso::TraceDetectionMoulon::setFilterMorphoMean
void setFilterMorphoMean(const FilterMorphoMean &smooth)
Definition
tracedetectionmoulon.cpp:50
pappso::TraceDetectionMoulon::m_ticStart
pappso_double m_ticStart
Definition
tracedetectionmoulon.h:59
pappso::TraceDetectionMoulon::getSmoothingHalfEdgeWindows
unsigned int getSmoothingHalfEdgeWindows() const
Definition
tracedetectionmoulon.cpp:67
pappso::TraceDetectionMoulon::getTicStop
pappso_double getTicStop() const
Definition
tracedetectionmoulon.cpp:79
pappso::TraceDetectionMoulon::TraceDetectionMoulon
TraceDetectionMoulon(unsigned int smoothing_half_window_length, pappso_double tic_start, pappso_double tic_stop)
Definition
tracedetectionmoulon.cpp:28
pappso::TraceDetectionMoulon::setTicStop
void setTicStop(double tic_stop)
Definition
tracedetectionmoulon.cpp:61
pappso::TraceDetectionSinkInterface
Definition
tracedetectioninterface.h:38
pappso::TraceDetectionSinkInterface::setTracePeak
virtual void setTracePeak(TracePeak &xic_peak)=0
pappso::TracePeak
Definition
tracepeak.h:40
pappso::Trace
A simple container of DataPoint instances.
Definition
trace.h:152
pappso
tries to keep as much as possible monoisotopes, removing any possible C13 peaks and changes multichar...
Definition
aa.cpp:39
pappso::pappso_double
double pappso_double
A type definition for doubles.
Definition
types.h:60
tracedetectionmoulon.h
pappsomspp
core
processing
detection
tracedetectionmoulon.cpp
Generated on
for libpappsomspp by
1.17.0