libpappsomspp
Library for mass spectrometry
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{
29 unsigned int smoothing_half_window_length,
30 pappso_double tic_start,
31 pappso_double tic_stop)
32 : m_xicFilterSmoothing(smoothing_half_window_length)
33{
34 m_ticStart = tic_start;
35 m_ticStop = tic_stop;
36}
37
39 : m_xicFilterSmoothing(other.m_xicFilterSmoothing)
40{
41 m_ticStart = other.m_ticStart;
42 m_ticStop = other.m_ticStop;
43}
44
46{
47}
48
49
50void
52{
53 m_xicFilterSmoothing = smooth;
54}
55
56void
58{
59 m_ticStart = tic_start;
60}
61void
63{
64 m_ticStop = tic_stop;
65}
66
67unsigned int
69{
71}
72
75{
76 return m_ticStart;
77}
78
81{
82 return m_ticStop;
83}
84
85void
88 bool remove_peak_base) const
89{
90
91 Trace xic_smoothed(xic);
92
93 m_xicFilterSmoothing.filter(xic_smoothed);
94
95 // detect peaks :
96 bool banked(false);
97 unsigned int nb_tic_start(0);
98
99 std::vector<DataPoint>::const_iterator it_smoothed;
100 std::vector<DataPoint>::const_iterator it, it_begin;
101
102 // TracePeak *p_current_peak = nullptr;
103
104 for(it_smoothed = xic_smoothed.begin(), it = xic.begin();
105 it_smoothed != xic_smoothed.end();
106 ++it_smoothed, ++it)
107 {
108
109 if((nb_tic_start == 0) && (it_begin != xic.end()) && (banked == false))
110 {
111 // delete(p_current_peak);
112 // p_current_peak = nullptr;
113 it_begin = xic.end();
114 }
115
116 if(it_smoothed->y >= m_ticStart)
117 {
118 nb_tic_start++;
119 if(it_begin == xic.end())
120 {
121 // p_current_peak = new TracePeak;
122 // p_current_peak->setLeftBoundary(*it_smoothed);
123 it_begin = it;
124 banked = false;
125 }
126 if((nb_tic_start == 2) && (banked == false))
127 {
128 banked = true;
129 }
130 }
131 else
132 {
133 nb_tic_start = 0;
134 }
135 if(it_smoothed->y <= m_ticStop)
136 {
137 if(it_begin != xic.end())
138 {
139
140 if(banked)
141 {
142 TracePeak peak(it_begin, it + 1, remove_peak_base);
143 sink.setTracePeak(peak);
144 }
145 banked = false;
146 }
147 }
148 }
149}
150} // namespace pappso
mean filter apply mean of y values inside the window : this results in a kind of smoothing
Definition: filtermorpho.h:210
std::size_t getMeanHalfEdgeWindows() const
virtual Trace & filter(Trace &data_points) const override
void setTicStart(double tic_start)
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:38
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:49