libpappsomspp
Library for mass spectrometry
Toggle main menu visibility
Loading...
Searching...
No Matches
filtertandemremovec13.cpp
Go to the documentation of this file.
1
/**
2
* \file pappsomspp/filers/filtertandemremovec13.h
3
* \date 26/04/2019
4
* \author Olivier Langella
5
* \brief new implementation of the X!Tandem filter to remove isotopes in an MS2
6
* signal
7
*/
8
9
/*******************************************************************************
10
* Copyright (c) 2019 Olivier Langella <Olivier.Langella@u-psud.fr>.
11
*
12
* This file is part of the PAPPSOms++ library.
13
*
14
* PAPPSOms++ is free software: you can redistribute it and/or modify
15
* it under the terms of the GNU General Public License as published by
16
* the Free Software Foundation, either version 3 of the License, or
17
* (at your option) any later version.
18
*
19
* PAPPSOms++ is distributed in the hope that it will be useful,
20
* but WITHOUT ANY WARRANTY; without even the implied warranty of
21
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22
* GNU General Public License for more details.
23
*
24
* You should have received a copy of the GNU General Public License
25
* along with PAPPSOms++. If not, see <http://www.gnu.org/licenses/>.
26
*
27
******************************************************************************/
28
29
#include "
filtertandemremovec13.h
"
30
31
#include "
pappsomspp/core/massspectrum/massspectrum.h
"
32
#include <algorithm>
33
34
using namespace
pappso
;
35
36
FilterTandemDeisotope::FilterTandemDeisotope
(
double
mz_range_max,
double
minimum_mz)
37
{
38
m_arbitrary_minimum_mz
= minimum_mz;
39
m_arbitrary_range_between_isotopes
= mz_range_max;
40
}
41
42
43
FilterTandemDeisotope::FilterTandemDeisotope
(
const
FilterTandemDeisotope
&other)
44
{
45
m_arbitrary_minimum_mz
= other.
m_arbitrary_minimum_mz
;
46
m_arbitrary_range_between_isotopes
= other.
m_arbitrary_range_between_isotopes
;
47
}
48
49
MassSpectrum
&
50
FilterTandemDeisotope::filter
(
MassSpectrum
&data_points)
const
51
{
52
53
MassSpectrum
massSpectrum;
54
55
if
(data_points.size() > 0)
56
{
57
// auto it_write = data_points.begin();
58
auto
it_read = data_points.begin() + 1;
59
auto
it_end = data_points.end();
60
61
62
DataPoint
value_write = *data_points.begin();
63
double
last_mz = value_write.
x
;
64
while
(it_read != it_end)
65
{
66
if
((it_read->x - last_mz) >=
m_arbitrary_range_between_isotopes
||
67
it_read->x <
m_arbitrary_minimum_mz
)
68
{
69
massSpectrum.push_back(value_write);
70
value_write = *it_read;
71
last_mz = value_write.
x
;
72
}
73
else
if
(it_read->y > value_write.
y
)
74
{
75
value_write = *it_read;
76
}
77
it_read++;
78
}
79
massSpectrum.push_back(value_write);
80
}
81
82
data_points = std::move(massSpectrum);
83
return
data_points;
84
}
pappso::FilterTandemDeisotope::filter
MassSpectrum & filter(MassSpectrum &data_points) const override
Definition
filtertandemremovec13.cpp:50
pappso::FilterTandemDeisotope::FilterTandemDeisotope
FilterTandemDeisotope(double mz_range_max=0.95, double minimum_mz=200.0)
Definition
filtertandemremovec13.cpp:36
pappso::FilterTandemDeisotope::m_arbitrary_range_between_isotopes
double m_arbitrary_range_between_isotopes
Definition
filtertandemremovec13.h:67
pappso::FilterTandemDeisotope::m_arbitrary_minimum_mz
double m_arbitrary_minimum_mz
Definition
filtertandemremovec13.h:68
pappso::MassSpectrum
Class to represent a mass spectrum.
Definition
massspectrum.h:70
filtertandemremovec13.h
massspectrum.h
pappso
tries to keep as much as possible monoisotopes, removing any possible C13 peaks and changes multichar...
Definition
aa.cpp:39
pappso::DataPoint
Definition
datapoint.h:22
pappso::DataPoint::x
pappso_double x
Definition
datapoint.h:24
pappso::DataPoint::y
pappso_double y
Definition
datapoint.h:25
pappsomspp
core
processing
filters
filtertandemremovec13.cpp
Generated on
for libpappsomspp by
1.17.0