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#include <QVariant>
33
34using namespace pappso;
35
37 : mzRange(pappso_double(1), PrecisionFactory::getPpmInstance(10.0)),
38 rtTarget(0)
39{
40}
41
42
44 : mzRange(other.mzRange), rtTarget(other.rtTarget)
45{
46 xicSptr = other.xicSptr;
47}
48
50{
51}
52
55{
56 XicCoordSPtr xic_coord_sp = std::make_shared<XicCoord>(*this);
57
58 xic_coord_sp.get()->xicSptr = std::make_shared<Xic>();
59
60 return xic_coord_sp;
61}
62
63
66{
67 XicCoordSPtr xic_coord_sp = std::make_shared<XicCoord>(*this);
68
69 // xic_coord_sp.get()->xicSptr = nullptr;
70
71 xic_coord_sp.get()->rtTarget += to_add.get()->rtTarget;
72
73 xic_coord_sp.get()->mzRange += to_add.get()->mzRange;
74
75 return xic_coord_sp;
76}
77
79XicCoord::multiplyBy(double number) const
80{
81 XicCoordSPtr xic_coord_sp = std::make_shared<XicCoord>(*this);
82
83 // xic_coord_sp.get()->xicSptr = nullptr;
84
85 xic_coord_sp.get()->rtTarget *= number;
86 xic_coord_sp.get()->mzRange *= number;
87
88 return xic_coord_sp;
89}
90
92pappso::XicCoord::divideBy(double number) const
93{
94 XicCoordSPtr xic_coord_sp = std::make_shared<XicCoord>(*this);
95
96 // xic_coord_sp.get()->xicSptr = nullptr;
97
98 xic_coord_sp.get()->rtTarget /= number;
99 xic_coord_sp.get()->mzRange *= (double)((double)1 / number);
100
101 return xic_coord_sp;
102}
103
104
105void
107{
108
109 xicSptr = nullptr;
110
111 rtTarget = 0;
112 mzRange = MzRange(0.0, 0.0);
113}
114
115QString
117{
118 return QString("mz=%1 rt=%2").arg(mzRange.toString()).arg(rtTarget);
119}
120
121
122const QVariant
123pappso::XicCoord::getParam(XicCoordParam param [[maybe_unused]]) const
124{
125 return QVariant();
126}
tries to keep as much as possible monoisotopes, removing any possible C13 peaks and changes multichar...
Definition: aa.cpp:39
XicCoordParam
Definition: xiccoord.h:50
double pappso_double
A type definition for doubles.
Definition: types.h:49
std::shared_ptr< XicCoord > XicCoordSPtr
Definition: xiccoord.h:43
coordinates of the XIC to extract and the resulting XIC after extraction
Definition: xiccoord.h:67
XicSPtr xicSptr
extracted xic
Definition: xiccoord.h:130
virtual XicCoordSPtr initializeAndClone() const
intialize the XIC and make a deep copy of object
Definition: xiccoord.cpp:54
virtual XicCoordSPtr multiplyBy(double number) const
compute a new xic coord as a product by
Definition: xiccoord.cpp:79
virtual void reset()
reset to zero
Definition: xiccoord.cpp:106
virtual XicCoordSPtr addition(XicCoordSPtr &to_add) const
compute a new XIC coord as the sum of the given one
Definition: xiccoord.cpp:65
virtual ~XicCoord()
Definition: xiccoord.cpp:49
virtual XicCoordSPtr divideBy(double number) const
compute a new xic coord as a division by
Definition: xiccoord.cpp:92
virtual const QVariant getParam(XicCoordParam param) const
get a specific XIC coordinate parameter
Definition: xiccoord.cpp:123
virtual QString toString() const
get a description of the XIC coordinate in a string
Definition: xiccoord.cpp:116
XIC coordinate in MSrun.