libpappsomspp
Library for mass spectrometry
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
30
32#include <algorithm>
33
34using namespace pappso;
35
36FilterTandemDeisotope::FilterTandemDeisotope(double mz_range_max, double minimum_mz)
37{
38 m_arbitrary_minimum_mz = minimum_mz;
40}
41
42
48
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}
MassSpectrum & filter(MassSpectrum &data_points) const override
FilterTandemDeisotope(double mz_range_max=0.95, double minimum_mz=200.0)
Class to represent a mass spectrum.
tries to keep as much as possible monoisotopes, removing any possible C13 peaks and changes multichar...
Definition aa.cpp:39
pappso_double x
Definition datapoint.h:24
pappso_double y
Definition datapoint.h:25