libpappsomspp
Library for mass spectrometry
Toggle main menu visibility
Loading...
Searching...
No Matches
filtercomplement.cpp
Go to the documentation of this file.
1
/**
2
* \file core/filter/filtercomplement.cpp
3
* \date 24/09/2026
4
* \author Olivier Langella
5
* \brief filter for complement ions
6
*/
7
8
9
/*
10
* PeptidOMS, Spectra to protein alignment tool
11
* Copyright (C) 2026 Olivier Langella
12
* <olivier.langella@cnrs.fr>
13
*
14
* This program 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
* This program 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 this program. If not, see <http://www.gnu.org/licenses/>.
26
*
27
*/
28
#include "
filtercomplement.h
"
29
#include <
pappsomspp/core/mzrange.h
>
30
#include <qlogging.h>
31
#include <utility>
32
33
FilterComplement::FilterComplement
(
double
target_mz,
34
pappso::PrecisionPtr
precision_ptr)
35
:
m_targetMzSum
(target_mz),
m_precisionPtr
(precision_ptr)
36
{
37
}
38
39
40
/**
41
* Copy constructor
42
*
43
* @param other TODO
44
*/
45
FilterComplement::FilterComplement
(
const
FilterComplement
&other)
46
:
m_targetMzSum
(other.
m_targetMzSum
),
m_precisionPtr
(other.
m_precisionPtr
)
47
{
48
}
49
50
FilterComplement::~FilterComplement
()
51
{
52
}
53
54
pappso::Trace
&
55
FilterComplement::filter
(
pappso::Trace
&data_points)
const
56
{
57
pappso::Trace
new_trace;
58
pappso::MzRange
target_sum(
m_targetMzSum
,
m_precisionPtr
);
59
60
61
auto
it = data_points.begin();
62
auto
it_reverse = data_points.rbegin();
63
while
(it->x < it_reverse->x)
64
{
65
66
if
((it->x + it_reverse->x) < target_sum.
lower
())
67
{
68
it++;
69
}
70
else
if
((it->x + it_reverse->x) > target_sum.
upper
())
71
{
72
it_reverse++;
73
}
74
else
75
{
76
new_trace.push_back(*it);
77
qDebug() <<
"itx="
<< it->x;
78
do
79
{
80
new_trace.push_back(*it_reverse);
81
qDebug() <<
"itrevx="
<< it_reverse->x;
82
it_reverse++;
83
}
84
while
(target_sum.
contains
(it->x + it_reverse->x));
85
}
86
}
87
88
data_points = std::move(new_trace);
89
data_points.
sortX
();
90
return
data_points;
91
}
FilterComplement::~FilterComplement
virtual ~FilterComplement()
Definition
filtercomplement.cpp:50
FilterComplement::filter
pappso::Trace & filter(pappso::Trace &data_points) const override
Definition
filtercomplement.cpp:55
FilterComplement::m_targetMzSum
double m_targetMzSum
Definition
filtercomplement.h:68
FilterComplement::m_precisionPtr
pappso::PrecisionPtr m_precisionPtr
Definition
filtercomplement.h:69
FilterComplement::FilterComplement
FilterComplement(double target_mz, pappso::PrecisionPtr precision_ptr)
Definition
filtercomplement.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::MzRange::contains
bool contains(pappso_double) const
Definition
mzrange.cpp:115
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
filtercomplement.h
mzrange.h
pappso::PrecisionPtr
const PrecisionBase * PrecisionPtr
Definition
precision.h:122
pappsomspp
core
processing
cbor
mzcbor
copyreplace
filtercomplement.cpp
Generated on
for libpappsomspp by
1.17.0