libpappsomspp
Library for mass spectrometry
xiccoord.cpp
Go to the documentation of this file.
1/**
2 * \file pappsomspp/msrun/xiccoord/xiccoord.cpp
3 * \date 22/04/2021
4 * \author Olivier Langella
5 * \brief XIC coordinate in MSrun
6 */
7
8
9/*******************************************************************************
10 * Copyright (c) 2021 Olivier Langella
11 *<Olivier.Langella@universite-paris-saclay.fr>.
12 *
13 * This file is part of the PAPPSOms++ library.
14 *
15 * PAPPSOms++ is free software: you can redistribute it and/or modify
16 * it under the terms of the GNU General Public License as published by
17 * the Free Software Foundation, either version 3 of the License, or
18 * (at your option) any later version.
19 *
20 * PAPPSOms++ is distributed in the hope that it will be useful,
21 * but WITHOUT ANY WARRANTY; without even the implied warranty of
22 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
23 * GNU General Public License for more details.
24 *
25 * You should have received a copy of the GNU General Public License
26 * along with PAPPSOms++. If not, see <http://www.gnu.org/licenses/>.
27 *
28 ******************************************************************************/
29
30
31#include "xiccoord.h"
32
33using namespace pappso;
34
36 : mzRange(pappso_double(1), PrecisionFactory::getPpmInstance(10.0)),
37 rtTarget(0)
38{
39}
40
41
43 : mzRange(other.mzRange), rtTarget(other.rtTarget)
44{
45 xicSptr = other.xicSptr;
46}
47
49{
50}
51
54{
55 XicCoordSPtr xic_coord_sp = std::make_shared<XicCoord>(*this);
56
57 xic_coord_sp.get()->xicSptr = std::make_shared<Xic>();
58
59 return xic_coord_sp;
60}
61
62
65{
66 XicCoordSPtr xic_coord_sp = std::make_shared<XicCoord>(*this);
67
68 // xic_coord_sp.get()->xicSptr = nullptr;
69
70 xic_coord_sp.get()->rtTarget += to_add.get()->rtTarget;
71
72 xic_coord_sp.get()->mzRange += to_add.get()->mzRange;
73
74 return xic_coord_sp;
75}
76
78XicCoord::multiplyBy(double number) const
79{
80 XicCoordSPtr xic_coord_sp = std::make_shared<XicCoord>(*this);
81
82 // xic_coord_sp.get()->xicSptr = nullptr;
83
84 xic_coord_sp.get()->rtTarget *= number;
85 xic_coord_sp.get()->mzRange *= number;
86
87 return xic_coord_sp;
88}
89
91pappso::XicCoord::divideBy(double number) const
92{
93 XicCoordSPtr xic_coord_sp = std::make_shared<XicCoord>(*this);
94
95 // xic_coord_sp.get()->xicSptr = nullptr;
96
97 xic_coord_sp.get()->rtTarget /= number;
98 xic_coord_sp.get()->mzRange *= (double)((double)1 / number);
99
100 return xic_coord_sp;
101}
102
103
104void
106{
107
108 xicSptr = nullptr;
109
110 rtTarget = 0;
111 mzRange = MzRange(0.0, 0.0);
112}
113
114QString
116{
117 return QString("mz=%1 rt=%2").arg(mzRange.toString()).arg(rtTarget);
118}
tries to keep as much as possible monoisotopes, removing any possible C13 peaks and changes multichar...
Definition: aa.cpp:39
double pappso_double
A type definition for doubles.
Definition: types.h:48
std::shared_ptr< XicCoord > XicCoordSPtr
Definition: xiccoord.h:43
coordinates of the XIC to extract and the resulting XIC after extraction
Definition: xiccoord.h:54
XicSPtr xicSptr
extracted xic
Definition: xiccoord.h:113
virtual XicCoordSPtr initializeAndClone() const
intialize the XIC and make a deep copy of object
Definition: xiccoord.cpp:53
virtual XicCoordSPtr multiplyBy(double number) const
compute a new xic coord as a product by
Definition: xiccoord.cpp:78
virtual void reset()
reset to zero
Definition: xiccoord.cpp:105
virtual XicCoordSPtr addition(XicCoordSPtr &to_add) const
compute a new XIC coord as the sum of the given one
Definition: xiccoord.cpp:64
virtual ~XicCoord()
Definition: xiccoord.cpp:48
virtual XicCoordSPtr divideBy(double number) const
compute a new xic coord as a division by
Definition: xiccoord.cpp:91
virtual QString toString() const
get a description of the XIC coordinate in a string
Definition: xiccoord.cpp:115
XIC coordinate in MSrun.