libpappsomspp
Library for mass spectrometry
Toggle main menu visibility
Loading...
Searching...
No Matches
filterremovec13.cpp
Go to the documentation of this file.
1
/**
2
* \file pappsomspp/processing/filters/filterremovec13.h
3
* \date 19/08/2020
4
* \author Olivier Langella
5
* \brief sum peaks under a triangle base
6
*/
7
8
/*******************************************************************************
9
* Copyright (c) 2020 Olivier Langella <Olivier.Langella@u-psud.fr>.
10
*
11
* This file is part of the PAPPSOms++ library.
12
*
13
* PAPPSOms++ is free software: you can redistribute it and/or modify
14
* it under the terms of the GNU General Public License as published by
15
* the Free Software Foundation, either version 3 of the License, or
16
* (at your option) any later version.
17
*
18
* PAPPSOms++ is distributed in the hope that it will be useful,
19
* but WITHOUT ANY WARRANTY; without even the implied warranty of
20
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21
* GNU General Public License for more details.
22
*
23
* You should have received a copy of the GNU General Public License
24
* along with PAPPSOms++. If not, see <http://www.gnu.org/licenses/>.
25
*
26
******************************************************************************/
27
28
#include "
filterremovec13.h
"
29
#include "
pappsomspp/core/mzrange.h
"
30
31
using namespace
pappso
;
32
33
FilterRemoveC13::FilterRemoveC13
(
PrecisionPtr
precision_ptr) :
m_precisionPtr
(precision_ptr)
34
{
35
m_diffC12C13_z1
=
DIFFC12C13
;
36
m_diffC12C13_z2
=
DIFFC12C13
/ 2;
37
}
38
39
FilterRemoveC13::FilterRemoveC13
(
const
FilterRemoveC13
&other)
40
:
m_precisionPtr
(other.
m_precisionPtr
)
41
{
42
m_diffC12C13_z1
=
DIFFC12C13
;
43
m_diffC12C13_z2
=
DIFFC12C13
/ 2;
44
}
45
46
FilterRemoveC13::~FilterRemoveC13
()
47
{
48
}
49
50
Trace
&
51
FilterRemoveC13::filter
(
Trace
&data_points)
const
52
{
53
54
std::vector<std::pair<double, double>> exclusionMassMap;
55
// qDebug() << data_points.size();
56
std::sort(data_points.begin(), data_points.end(), [](
const
DataPoint
&
a
,
const
DataPoint
&
b
) {
57
return (a.y > b.y);
58
});
59
60
Trace
new_trace;
61
62
for
(
auto
&data_point : data_points)
63
{
64
if
(
notExcluded
(exclusionMassMap, data_point.x))
65
{
66
new_trace.push_back(data_point);
67
}
68
addExclusionMap
(exclusionMassMap, data_point.x);
69
}
70
new_trace.
sortX
();
71
// qDebug() << new_trace.size();
72
data_points = std::move(new_trace);
73
// qDebug() << data_points.size();
74
return
data_points;
75
}
76
77
bool
78
pappso::FilterRemoveC13::notExcluded
(std::vector<std::pair<double, double>> &exclusionMassMap,
79
double
mass)
const
80
{
81
for
(
auto
&mass_range : exclusionMassMap)
82
{
83
if
((mass_range.first <= mass) && (mass_range.second >= mass))
84
{
85
return
false
;
86
}
87
}
88
return
true
;
89
}
90
91
void
92
pappso::FilterRemoveC13::addExclusionMap
(std::vector<std::pair<double, double>> &exclusionMassMap,
93
double
mass)
const
94
{
95
MzRange
range1(mass +
m_diffC12C13_z1
,
m_precisionPtr
);
96
97
exclusionMassMap.push_back(std::pair<double, double>(range1.
lower
(), range1.
upper
()));
98
99
100
MzRange
range2(mass +
m_diffC12C13_z2
,
m_precisionPtr
);
101
102
exclusionMassMap.push_back(std::pair<double, double>(range2.
lower
(), range2.
upper
()));
103
}
pappso::FilterRemoveC13::notExcluded
bool notExcluded(std::vector< std::pair< double, double > > &exclusionMassMap, double mass) const
Definition
filterremovec13.cpp:78
pappso::FilterRemoveC13::addExclusionMap
void addExclusionMap(std::vector< std::pair< double, double > > &exclusionMassMap, double mass) const
Definition
filterremovec13.cpp:92
pappso::FilterRemoveC13::m_diffC12C13_z2
double m_diffC12C13_z2
Definition
filterremovec13.h:75
pappso::FilterRemoveC13::m_diffC12C13_z1
double m_diffC12C13_z1
Definition
filterremovec13.h:74
pappso::FilterRemoveC13::filter
Trace & filter(Trace &data_points) const override
Definition
filterremovec13.cpp:51
pappso::FilterRemoveC13::m_precisionPtr
PrecisionPtr m_precisionPtr
Definition
filterremovec13.h:76
pappso::FilterRemoveC13::~FilterRemoveC13
virtual ~FilterRemoveC13()
Definition
filterremovec13.cpp:46
pappso::FilterRemoveC13::FilterRemoveC13
FilterRemoveC13(PrecisionPtr precision_ptr)
Definition
filterremovec13.cpp:33
pappso::MzRange
Definition
mzrange.h:46
pappso::MzRange::lower
pappso_double lower() const
Definition
mzrange.h:71
pappso::MzRange::upper
pappso_double upper() const
Definition
mzrange.h:77
pappso::Trace
A simple container of DataPoint instances.
Definition
trace.h:152
pappso::Trace::sortX
void sortX(Enums::SortOrder sort_order=Enums::SortOrder::ascending)
Definition
trace.cpp:1070
filterremovec13.h
mzrange.h
pappso
tries to keep as much as possible monoisotopes, removing any possible C13 peaks and changes multichar...
Definition
aa.cpp:39
pappso::PeptideIonNter::a
@ a
Definition
peptide.h:77
pappso::PeptideIonNter::b
@ b
Definition
peptide.h:74
pappso::PrecisionPtr
const PrecisionBase * PrecisionPtr
Definition
precision.h:122
pappso::DIFFC12C13
const pappso_double DIFFC12C13(1.0033548378)
pappso::DataPoint
Definition
datapoint.h:22
pappsomspp
core
processing
filters
filterremovec13.cpp
Generated on
for libpappsomspp by
1.17.0