libpappsomspp
Library for mass spectrometry
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 ******************************************************************************/
25
26namespace pappso
27{
28TraceDetectionMoulon::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
43
47
48
49void
54
55void
57{
58 m_ticStart = tic_start;
59}
60void
62{
63 m_ticStop = tic_stop;
64}
65
66unsigned int
68{
69 return m_xicFilterSmoothing.getHalfWindowSize();
70}
71
77
83
84void
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
mean filter apply mean of y values inside the window : this results in a kind of smoothing
void detect(const Trace &xic, TraceDetectionSinkInterface &sink, bool remove_peak_base) const override
detect peaks on a trace
void setFilterMorphoMean(const FilterMorphoMean &smooth)
unsigned int getSmoothingHalfEdgeWindows() const
TraceDetectionMoulon(unsigned int smoothing_half_window_length, pappso_double tic_start, pappso_double tic_stop)
virtual void setTracePeak(TracePeak &xic_peak)=0
A simple container of DataPoint instances.
Definition trace.h:148
tries to keep as much as possible monoisotopes, removing any possible C13 peaks and changes multichar...
Definition aa.cpp:39
double pappso_double
A type definition for doubles.
Definition types.h:61