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
31#include "../../massspectrum/massspectrum.h"
32#include <algorithm>
33
34using namespace pappso;
35
37 double minimum_mz)
38{
39 m_arbitrary_minimum_mz = minimum_mz;
41}
42
43
49
52{
53
54 MassSpectrum massSpectrum;
55
56 if(data_points.size() > 0)
57 {
58 // auto it_write = data_points.begin();
59 auto it_read = data_points.begin() + 1;
60 auto it_end = data_points.end();
61
62
63 DataPoint value_write = *data_points.begin();
64 double last_mz = value_write.x;
65 while(it_read != it_end)
66 {
67 if((it_read->x - last_mz) >= m_arbitrary_range_between_isotopes ||
68 it_read->x < m_arbitrary_minimum_mz)
69 {
70 massSpectrum.push_back(value_write);
71 value_write = *it_read;
72 last_mz = value_write.x;
73 }
74 else if(it_read->y > value_write.y)
75 {
76 value_write = *it_read;
77 }
78 it_read++;
79 }
80 massSpectrum.push_back(value_write);
81 }
82
83 data_points = std::move(massSpectrum);
84 return data_points;
85}
Deisotope the mass spectrum this mass spectrum is iterated over and according to a data point-based m...
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:23
pappso_double y
Definition datapoint.h:24